fix!: don't set inventory image vars if server image is undefined (#275)

Related to #116

Don't set "No Image * found" string if the server image is not defined. This is not an intuitive behavior.

This is a breaking change.
This commit is contained in:
Jonas L 2023-07-24 14:44:52 +02:00 committed by GitHub
parent c15377c672
commit 652a41df9d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View file

@ -0,0 +1,4 @@
breaking_changes:
- >
inventory plugin - Don't set the server image variables (`image_id`,
`image_os_flavor` and `image_name`) when the server image is not defined.

View file

@ -270,10 +270,6 @@ class InventoryModule(BaseInventoryPlugin, Constructable):
self.inventory.set_variable(server.name, "image_name", to_native(server.image.name))
else:
self.inventory.set_variable(server.name, "image_name", to_native(server.image.description))
else:
self.inventory.set_variable(server.name, "image_id", to_native("No Image ID found"))
self.inventory.set_variable(server.name, "image_name", to_native("No Image Name found"))
self.inventory.set_variable(server.name, "image_os_flavor", to_native("No Image OS Flavor found"))
# Labels
self.inventory.set_variable(server.name, "labels", dict(server.labels))