Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix datetime.utcfromtimestamp() is deprecated in Python 3.12 #277

Merged
merged 7 commits into from
Aug 31, 2024

Conversation

ZarKyo
Copy link
Contributor

@ZarKyo ZarKyo commented Aug 14, 2024

No description provided.

Copy link
Owner

@mkorman90 mkorman90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please handle the exceptions in the plugins specifically, so at least some data can be returned by the plugin.

sub_interfaces = self.get_network_info(interface, sub_interfaces)
entries["sub_interface"] = sub_interfaces

except Exception as e:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a specific issue that is being handled here? It's better to return from the plugin as much data as possible, possibly with an additional key indicating that it is incomplete.
In the close future when I refactor plugin output we'll be able to handle that there.

except Exception as ex:
logger.error(f"Error processing registry key {control_set_interfaces_path}: {ex}")

except Exception as ex:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same, please handle the specific exception

@ZarKyo
Copy link
Contributor Author

ZarKyo commented Aug 25, 2024

Is this what you were thinking?


try:
entries["dhcp_enabled"] = (
interface.get_value("EnableDHCP") == 1
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Calling get_value should not raise an exception, so what is the exact exception being handled here?

interfaces = []
interfaces = self.get_network_info(subkey, interfaces)
self.entries[control_set_interfaces_path]["interfaces"] = interfaces
try:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for the high level exception handling if handling all internal expected exceptions.

@@ -891,6 +891,7 @@ def test_network_data_plugin(system_hive):
]["interfaces"][0] == {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Starting Regipy v5 (which is now on master branch) plugin tests were deprecated in favor of validation cases. This file can be deleted on your branch to avoid conflicts.

@mkorman90 mkorman90 merged commit 82ac457 into mkorman90:master Aug 31, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants