-
Notifications
You must be signed in to change notification settings - Fork 2
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
Replace netbox subcommands with netbox-manager #1214
base: main
Are you sure you want to change the base?
Conversation
* Refactors tasks in `/osism/services/listener.py` to be reusable in the API * Add API endpoint for baremetal notifications Allows to send baremetal notifications to another osism manager instance. Signed-off-by: Jan Horstmann <horstmann@osism.tech> logger.error(f"Received HTTP status code {e.response.status_code} while connecting to {self.osism_baremetal_api_url}")
@@ -836,144 +83,3 @@ def set_power_state(device, state): | |||
device_a = utils.nb.dcim.devices.get(name=device) | |||
device_a.custom_fields = {"power_state": state} | |||
device_a.save() |
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.
Potential Data Race in Device State Update Functions
The functions set_power_state
and set_provision_state
update the device state without any locking mechanism. This could lead to data races if multiple processes try to update the state of the same device concurrently.
Recommendation:
Implement a locking mechanism, such as the one used in set_state
function, to ensure that updates to the device state are atomic and thread-safe. This will prevent data inconsistencies and potential application errors due to concurrent updates.
timestamp: str | ||
publisher_id: str | ||
message_id: UUID | ||
payload: dict |
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.
The payload
field in the NotificationBaremetal
model is defined as a generic dict
type. This can lead to unstructured data handling and potential security risks if the payload data is not properly validated or sanitized before use.
Recommendation:
Define a more specific model for the payload
or at least use Pydantic's Field
to include validations (like maximum size, required keys, etc.). This will help ensure that the data structure is consistent and secure.
Part of osism/issues#1223 Signed-off-by: Jan Horstmann <horstmann@osism.tech>
This will require a new release of |
Part of osism/issues#1223