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

Replace netbox subcommands with netbox-manager #1214

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Conversation

janhorstmann
Copy link
Contributor

@janhorstmann janhorstmann commented Mar 4, 2025

* 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()

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

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>
@janhorstmann
Copy link
Contributor Author

This will require a new release of openstack-image-manager and openstack-flavor-manager to align their dependencies with those of netbox-manager

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.

1 participant