You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: Improve add_device, get_device methods in inventory_api. Add optional config_only parameter to update_device in inventory_app. Bump version for 0.2.3 release
Method to update a devices configuration in VideoIPath-Inventory.
@@ -102,6 +104,7 @@ def update_device(
102
104
Args:
103
105
device (InventoryDevice): Device to update in Inventory.
104
106
compare_config (bool, optional): Compare the configuration of the device with the existing device configuration in Inventory, to prevent unnecessary updates. Defaults to True.
107
+
config_only (bool, optional): Update device with configuration only. Defaults to False.
105
108
106
109
Raises:
107
110
ValueError: If no device_id is given in device configuration (in InventoryDevice instance).
self._logger.warning("status_fetch_retry must be an integer. Using default value of 20.")
@@ -80,7 +86,7 @@ def get_device(
80
86
break
81
87
exceptValueError:
82
88
self._logger.debug(
83
-
f"Failed to get device status for device '{online_device.configuration.id}', retrying ({21-retry_cnt}/{status_fetch_retry}) ..."
89
+
f"Failed to get device status for device '{online_device.configuration.id}', retrying ({21-retry_cnt}/{status_fetch_retry}) ..."
84
90
)
85
91
time.sleep(status_fetch_delay)
86
92
retry_cnt-=1
@@ -90,6 +96,7 @@ def get_device(
90
96
)
91
97
else:
92
98
self._logger.debug(f"Skipping status update for device '{device_id}'.")
99
+
93
100
self._logger.debug(f"Device '{device_id}' retrieved from VideoIPath-Inventory.")
94
101
returnonline_device
95
102
@@ -120,11 +127,11 @@ def add_device(
120
127
ifdevice.configuration.id!="":
121
128
raiseValueError(
122
129
"Device ID must be empty when adding a new device! "
123
-
"Set 'id' to an empty string 'InventoryDevice.remove_device_id()' or use 'inventory_api.update_device()' for existing devices."
130
+
"Set 'id' to an empty string 'InventoryDevice.remove_device_id()' or use 'inventory_api.update_device()' if an existing device should be updated."
124
131
)
125
132
126
133
self._logger.debug(
127
-
f"Adding new device with label '{device.configuration.config.desc.label}' to VideoIPath-Inventory."
134
+
f"Adding new device with label '{device.configuration.config.desc.label}' and address '{device.configuration.config.cinfo.address}' to VideoIPath-Inventory."
0 commit comments