-
Notifications
You must be signed in to change notification settings - Fork 53
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
Conversation
There was a problem hiding this 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: |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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
Is this what you were thinking? |
|
||
try: | ||
entries["dhcp_enabled"] = ( | ||
interface.get_value("EnableDHCP") == 1 |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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.
regipy_tests/plugin_tests.py
Outdated
@@ -891,6 +891,7 @@ def test_network_data_plugin(system_hive): | |||
]["interfaces"][0] == { |
There was a problem hiding this comment.
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.
No description provided.