osism 0.20250602.0__py3-none-any.whl → 0.20250605.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- osism/commands/baremetal.py +36 -30
- osism/commands/vault.py +9 -1
- osism/core/enums.py +1 -0
- osism/tasks/conductor/__init__.py +54 -0
- osism/tasks/conductor/config.py +92 -0
- osism/tasks/conductor/ironic.py +323 -0
- osism/tasks/conductor/netbox.py +50 -0
- osism/tasks/conductor/utils.py +79 -0
- osism/tasks/conductor.py +13 -470
- {osism-0.20250602.0.dist-info → osism-0.20250605.0.dist-info}/METADATA +2 -2
- {osism-0.20250602.0.dist-info → osism-0.20250605.0.dist-info}/RECORD +17 -12
- osism-0.20250605.0.dist-info/pbr.json +1 -0
- osism-0.20250602.0.dist-info/pbr.json +0 -1
- {osism-0.20250602.0.dist-info → osism-0.20250605.0.dist-info}/WHEEL +0 -0
- {osism-0.20250602.0.dist-info → osism-0.20250605.0.dist-info}/entry_points.txt +0 -0
- {osism-0.20250602.0.dist-info → osism-0.20250605.0.dist-info}/licenses/AUTHORS +0 -0
- {osism-0.20250602.0.dist-info → osism-0.20250605.0.dist-info}/licenses/LICENSE +0 -0
- {osism-0.20250602.0.dist-info → osism-0.20250605.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,79 @@
|
|
1
|
+
# SPDX-License-Identifier: Apache-2.0
|
2
|
+
|
3
|
+
from ansible import constants as ansible_constants
|
4
|
+
from ansible.parsing.vault import VaultLib, VaultSecret
|
5
|
+
from loguru import logger
|
6
|
+
|
7
|
+
from osism import utils
|
8
|
+
|
9
|
+
|
10
|
+
def deep_compare(a, b, updates):
|
11
|
+
"""
|
12
|
+
Find items in a that do not exist in b or are different.
|
13
|
+
Write required changes into updates
|
14
|
+
"""
|
15
|
+
for key, value in a.items():
|
16
|
+
if type(value) is not dict:
|
17
|
+
if key not in b or b[key] != value:
|
18
|
+
updates[key] = value
|
19
|
+
else:
|
20
|
+
updates[key] = {}
|
21
|
+
deep_compare(a[key], b[key], updates[key])
|
22
|
+
if not updates[key]:
|
23
|
+
updates.pop(key)
|
24
|
+
|
25
|
+
|
26
|
+
def deep_merge(a, b):
|
27
|
+
for key, value in b.items():
|
28
|
+
if value == "DELETE":
|
29
|
+
# NOTE: Use special string to remove keys
|
30
|
+
a.pop(key, None)
|
31
|
+
elif (
|
32
|
+
key not in a.keys()
|
33
|
+
or not isinstance(a[key], dict)
|
34
|
+
or not isinstance(value, dict)
|
35
|
+
):
|
36
|
+
a[key] = value
|
37
|
+
else:
|
38
|
+
deep_merge(a[key], value)
|
39
|
+
|
40
|
+
|
41
|
+
def deep_decrypt(a, vault):
|
42
|
+
if a is None:
|
43
|
+
return
|
44
|
+
if isinstance(a, dict):
|
45
|
+
for key, value in list(a.items()):
|
46
|
+
if isinstance(value, (dict, list)):
|
47
|
+
deep_decrypt(a[key], vault)
|
48
|
+
elif vault.is_encrypted(value):
|
49
|
+
try:
|
50
|
+
a[key] = vault.decrypt(value).decode()
|
51
|
+
except Exception:
|
52
|
+
a.pop(key, None)
|
53
|
+
elif isinstance(a, list):
|
54
|
+
for i, item in enumerate(a):
|
55
|
+
if isinstance(item, (dict, list)):
|
56
|
+
deep_decrypt(item, vault)
|
57
|
+
elif vault.is_encrypted(item):
|
58
|
+
try:
|
59
|
+
a[i] = vault.decrypt(item).decode()
|
60
|
+
except Exception:
|
61
|
+
pass
|
62
|
+
|
63
|
+
|
64
|
+
def get_vault():
|
65
|
+
"""Create and return a VaultLib instance for decrypting secrets"""
|
66
|
+
try:
|
67
|
+
vault_secret = utils.get_ansible_vault_password()
|
68
|
+
vault = VaultLib(
|
69
|
+
[
|
70
|
+
(
|
71
|
+
ansible_constants.DEFAULT_VAULT_ID_MATCH,
|
72
|
+
VaultSecret(vault_secret.encode()),
|
73
|
+
)
|
74
|
+
]
|
75
|
+
)
|
76
|
+
except Exception:
|
77
|
+
logger.error("Unable to get vault secret. Dropping encrypted entries")
|
78
|
+
vault = VaultLib()
|
79
|
+
return vault
|
osism/tasks/conductor.py
CHANGED
@@ -1,472 +1,15 @@
|
|
1
1
|
# SPDX-License-Identifier: Apache-2.0
|
2
2
|
|
3
|
-
from
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
from osism import utils
|
17
|
-
from osism.tasks import Config, netbox, openstack
|
18
|
-
|
19
|
-
app = Celery("conductor")
|
20
|
-
app.config_from_object(Config)
|
21
|
-
|
22
|
-
|
23
|
-
configuration = {}
|
24
|
-
|
25
|
-
|
26
|
-
def get_nb_device_query_list():
|
27
|
-
try:
|
28
|
-
supported_nb_device_filters = [
|
29
|
-
"site",
|
30
|
-
"region",
|
31
|
-
"site_group",
|
32
|
-
"location",
|
33
|
-
"rack",
|
34
|
-
"tag",
|
35
|
-
"state",
|
36
|
-
]
|
37
|
-
nb_device_query_list = yaml.safe_load(settings.NETBOX_FILTER_CONDUCTOR)
|
38
|
-
if type(nb_device_query_list) is not list:
|
39
|
-
raise TypeError
|
40
|
-
for nb_device_query in nb_device_query_list:
|
41
|
-
if type(nb_device_query) is not dict:
|
42
|
-
raise TypeError
|
43
|
-
for key in list(nb_device_query.keys()):
|
44
|
-
if key not in supported_nb_device_filters:
|
45
|
-
raise ValueError
|
46
|
-
# NOTE: Only "location_id" and "rack_id" are supported by netbox
|
47
|
-
if key in ["location", "rack"]:
|
48
|
-
value_name = nb_device_query.pop(key, "")
|
49
|
-
if key == "location":
|
50
|
-
value_id = netbox.get_location_id(value_name)
|
51
|
-
elif key == "rack":
|
52
|
-
value_id = netbox.get_rack_id(value_name)
|
53
|
-
if value_id:
|
54
|
-
nb_device_query.update({key + "_id": value_id})
|
55
|
-
else:
|
56
|
-
raise ValueError(f"Invalid name {value_name} for {key}")
|
57
|
-
except (yaml.YAMLError, TypeError):
|
58
|
-
logger.error(
|
59
|
-
f"Setting NETBOX_FILTER_CONDUCTOR needs to be an array of mappings containing supported netbox device filters: {supported_nb_device_filters}"
|
60
|
-
)
|
61
|
-
nb_device_query_list = []
|
62
|
-
except ValueError as exc:
|
63
|
-
logger.error(f"Unknown value in NETBOX_FILTER_CONDUCTOR: {exc}")
|
64
|
-
nb_device_query_list = []
|
65
|
-
|
66
|
-
return nb_device_query_list
|
67
|
-
|
68
|
-
|
69
|
-
def get_configuration():
|
70
|
-
with open("/etc/conductor.yml") as fp:
|
71
|
-
configuration = yaml.load(fp, Loader=yaml.SafeLoader)
|
72
|
-
|
73
|
-
if not configuration:
|
74
|
-
logger.warning(
|
75
|
-
"The conductor configuration is empty. That's probably wrong"
|
76
|
-
)
|
77
|
-
return {}
|
78
|
-
|
79
|
-
if Config.enable_ironic.lower() not in ["true", "yes"]:
|
80
|
-
return configuration
|
81
|
-
|
82
|
-
if "ironic_parameters" not in configuration:
|
83
|
-
logger.error("ironic_parameters not found in the conductor configuration")
|
84
|
-
return configuration
|
85
|
-
|
86
|
-
if "driver_info" in configuration["ironic_parameters"]:
|
87
|
-
if "deploy_kernel" in configuration["ironic_parameters"]["driver_info"]:
|
88
|
-
result = openstack.image_get(
|
89
|
-
configuration["ironic_parameters"]["driver_info"]["deploy_kernel"]
|
90
|
-
)
|
91
|
-
configuration["ironic_parameters"]["driver_info"][
|
92
|
-
"deploy_kernel"
|
93
|
-
] = result.id
|
94
|
-
|
95
|
-
if "deploy_ramdisk" in configuration["ironic_parameters"]["driver_info"]:
|
96
|
-
result = openstack.image_get(
|
97
|
-
configuration["ironic_parameters"]["driver_info"]["deploy_ramdisk"]
|
98
|
-
)
|
99
|
-
configuration["ironic_parameters"]["driver_info"][
|
100
|
-
"deploy_ramdisk"
|
101
|
-
] = result.id
|
102
|
-
|
103
|
-
if "cleaning_network" in configuration["ironic_parameters"]["driver_info"]:
|
104
|
-
result = openstack.network_get(
|
105
|
-
configuration["ironic_parameters"]["driver_info"][
|
106
|
-
"cleaning_network"
|
107
|
-
]
|
108
|
-
)
|
109
|
-
configuration["ironic_parameters"]["driver_info"][
|
110
|
-
"cleaning_network"
|
111
|
-
] = result.id
|
112
|
-
|
113
|
-
if (
|
114
|
-
"provisioning_network"
|
115
|
-
in configuration["ironic_parameters"]["driver_info"]
|
116
|
-
):
|
117
|
-
result = openstack.network_get(
|
118
|
-
configuration["ironic_parameters"]["driver_info"][
|
119
|
-
"provisioning_network"
|
120
|
-
]
|
121
|
-
)
|
122
|
-
configuration["ironic_parameters"]["driver_info"][
|
123
|
-
"provisioning_network"
|
124
|
-
] = result.id
|
125
|
-
|
126
|
-
return configuration
|
127
|
-
|
128
|
-
|
129
|
-
@worker_process_init.connect
|
130
|
-
def celery_init_worker(**kwargs):
|
131
|
-
global configuration
|
132
|
-
configuration = get_configuration()
|
133
|
-
|
134
|
-
|
135
|
-
@app.on_after_configure.connect
|
136
|
-
def setup_periodic_tasks(sender, **kwargs):
|
137
|
-
pass
|
138
|
-
|
139
|
-
|
140
|
-
@app.task(bind=True, name="osism.tasks.conductor.get_ironic_parameters")
|
141
|
-
def get_ironic_parameters(self):
|
142
|
-
if "ironic_parameters" in configuration:
|
143
|
-
# NOTE: Do not pass by reference, everybody gets their own copy to work with
|
144
|
-
return copy.deepcopy(configuration["ironic_parameters"])
|
145
|
-
|
146
|
-
return {}
|
147
|
-
|
148
|
-
|
149
|
-
@app.task(bind=True, name="osism.tasks.conductor.sync_netbox")
|
150
|
-
def sync_netbox(self, force_update=False):
|
151
|
-
logger.info("Not implemented")
|
152
|
-
|
153
|
-
|
154
|
-
@app.task(bind=True, name="osism.tasks.conductor.sync_ironic")
|
155
|
-
def sync_ironic(self, force_update=False):
|
156
|
-
def deep_compare(a, b, updates):
|
157
|
-
"""
|
158
|
-
Find items in a that do not exist in b or are different.
|
159
|
-
Write required changes into updates
|
160
|
-
"""
|
161
|
-
for key, value in a.items():
|
162
|
-
if type(value) is not dict:
|
163
|
-
if key not in b or b[key] != value:
|
164
|
-
updates[key] = value
|
165
|
-
else:
|
166
|
-
updates[key] = {}
|
167
|
-
deep_compare(a[key], b[key], updates[key])
|
168
|
-
if not updates[key]:
|
169
|
-
updates.pop(key)
|
170
|
-
|
171
|
-
def deep_merge(a, b):
|
172
|
-
for key, value in b.items():
|
173
|
-
if value == "DELETE":
|
174
|
-
# NOTE: Use special string to remove keys
|
175
|
-
a.pop(key, None)
|
176
|
-
elif (
|
177
|
-
key not in a.keys()
|
178
|
-
or not isinstance(a[key], dict)
|
179
|
-
or not isinstance(value, dict)
|
180
|
-
):
|
181
|
-
a[key] = value
|
182
|
-
else:
|
183
|
-
deep_merge(a[key], value)
|
184
|
-
|
185
|
-
def deep_decrypt(a, vault):
|
186
|
-
for key, value in list(a.items()):
|
187
|
-
if not isinstance(value, dict):
|
188
|
-
if vault.is_encrypted(value):
|
189
|
-
try:
|
190
|
-
a[key] = vault.decrypt(value).decode()
|
191
|
-
except Exception:
|
192
|
-
a.pop(key, None)
|
193
|
-
else:
|
194
|
-
deep_decrypt(a[key], vault)
|
195
|
-
|
196
|
-
driver_params = {
|
197
|
-
"ipmi": {
|
198
|
-
"address": "ipmi_address",
|
199
|
-
"port": "ipmi_port",
|
200
|
-
"password": "ipmi_password",
|
201
|
-
},
|
202
|
-
"redfish": {
|
203
|
-
"address": "redfish_address",
|
204
|
-
"password": "redfish_password",
|
205
|
-
},
|
206
|
-
}
|
207
|
-
|
208
|
-
devices = set()
|
209
|
-
nb_device_query_list = get_nb_device_query_list()
|
210
|
-
for nb_device_query in nb_device_query_list:
|
211
|
-
devices |= set(netbox.get_devices(**nb_device_query))
|
212
|
-
|
213
|
-
# NOTE: Find nodes in Ironic which are no longer present in netbox and remove them
|
214
|
-
device_names = {dev.name for dev in devices}
|
215
|
-
nodes = openstack.baremetal_node_list()
|
216
|
-
for node in nodes:
|
217
|
-
logger.info(f"Looking for {node['Name']} in netbox")
|
218
|
-
if node["Name"] not in device_names:
|
219
|
-
if (
|
220
|
-
not node["Instance UUID"]
|
221
|
-
and node["Provisioning State"] in ["enroll", "manageable", "available"]
|
222
|
-
and node["Power State"] in ["power off", None]
|
223
|
-
):
|
224
|
-
logger.info(
|
225
|
-
f"Cleaning up baremetal node not found in netbox: {node['Name']}"
|
226
|
-
)
|
227
|
-
for port in openstack.baremetal_port_list(
|
228
|
-
details=False, attributes=dict(node_uuid=node["UUID"])
|
229
|
-
):
|
230
|
-
openstack.baremetal_port_delete(port.id)
|
231
|
-
openstack.baremetal_node_delete(node["UUID"])
|
232
|
-
else:
|
233
|
-
logger.error(
|
234
|
-
f"Cannot remove baremetal node because it is still provisioned or running: {node}"
|
235
|
-
)
|
236
|
-
|
237
|
-
# NOTE: Find nodes in netbox which are not present in Ironic and add them
|
238
|
-
for device in devices:
|
239
|
-
logger.info(f"Looking for {device.name} in ironic")
|
240
|
-
logger.info(device)
|
241
|
-
|
242
|
-
node_interfaces = list(netbox.get_interfaces_by_device(device.name))
|
243
|
-
|
244
|
-
node_attributes = get_ironic_parameters()
|
245
|
-
if (
|
246
|
-
"ironic_parameters" in device.custom_fields
|
247
|
-
and device.custom_fields["ironic_parameters"]
|
248
|
-
):
|
249
|
-
# NOTE: Update node attributes with overrides from netbox device
|
250
|
-
deep_merge(node_attributes, device.custom_fields["ironic_parameters"])
|
251
|
-
# NOTE: Decrypt ansible vaulted secrets
|
252
|
-
try:
|
253
|
-
vault_secret = utils.get_ansible_vault_password()
|
254
|
-
vault = VaultLib(
|
255
|
-
[
|
256
|
-
(
|
257
|
-
ansible_constants.DEFAULT_VAULT_ID_MATCH,
|
258
|
-
VaultSecret(vault_secret.encode()),
|
259
|
-
)
|
260
|
-
]
|
261
|
-
)
|
262
|
-
except Exception:
|
263
|
-
logger.error("Unable to get vault secret. Dropping encrypted entries")
|
264
|
-
vault = VaultLib()
|
265
|
-
deep_decrypt(node_attributes, vault)
|
266
|
-
if (
|
267
|
-
"driver" in node_attributes
|
268
|
-
and node_attributes["driver"] in driver_params.keys()
|
269
|
-
):
|
270
|
-
if "driver_info" in node_attributes:
|
271
|
-
# NOTE: Pop all fields belonging to a different driver
|
272
|
-
unused_drivers = [
|
273
|
-
driver
|
274
|
-
for driver in driver_params.keys()
|
275
|
-
if driver != node_attributes["driver"]
|
276
|
-
]
|
277
|
-
for key in list(node_attributes["driver_info"].keys()):
|
278
|
-
for driver in unused_drivers:
|
279
|
-
if key.startswith(driver + "_"):
|
280
|
-
node_attributes["driver_info"].pop(key, None)
|
281
|
-
# NOTE: Render driver address field
|
282
|
-
address_key = driver_params[node_attributes["driver"]]["address"]
|
283
|
-
if address_key in node_attributes["driver_info"]:
|
284
|
-
if device.oob_ip and "address" in device.oob_ip:
|
285
|
-
node_mgmt_address = device.oob_ip["address"]
|
286
|
-
else:
|
287
|
-
node_mgmt_addresses = [
|
288
|
-
interface["address"]
|
289
|
-
for interface in node_interfaces
|
290
|
-
if interface.mgmt_only
|
291
|
-
and "address" in interface
|
292
|
-
and interface["address"]
|
293
|
-
]
|
294
|
-
if len(node_mgmt_addresses) > 0:
|
295
|
-
node_mgmt_address = node_mgmt_addresses[0]
|
296
|
-
else:
|
297
|
-
node_mgmt_address = None
|
298
|
-
if node_mgmt_address:
|
299
|
-
node_attributes["driver_info"][address_key] = (
|
300
|
-
jinja2.Environment(loader=jinja2.BaseLoader())
|
301
|
-
.from_string(node_attributes["driver_info"][address_key])
|
302
|
-
.render(
|
303
|
-
remote_board_address=str(
|
304
|
-
ipaddress.ip_interface(node_mgmt_address).ip
|
305
|
-
)
|
306
|
-
)
|
307
|
-
)
|
308
|
-
node_attributes.update({"resource_class": device.name})
|
309
|
-
# NOTE: Write metadata used for provisioning into 'extra' field, so that it is available during node deploy without querying the netbox again
|
310
|
-
if "extra" not in node_attributes:
|
311
|
-
node_attributes["extra"] = {}
|
312
|
-
if (
|
313
|
-
"netplan_parameters" in device.custom_fields
|
314
|
-
and device.custom_fields["netplan_parameters"]
|
315
|
-
):
|
316
|
-
node_attributes["extra"].update(
|
317
|
-
{
|
318
|
-
"netplan_parameters": json.dumps(
|
319
|
-
device.custom_fields["netplan_parameters"]
|
320
|
-
)
|
321
|
-
}
|
322
|
-
)
|
323
|
-
if (
|
324
|
-
"frr_parameters" in device.custom_fields
|
325
|
-
and device.custom_fields["frr_parameters"]
|
326
|
-
):
|
327
|
-
node_attributes["extra"].update(
|
328
|
-
{"frr_parameters": json.dumps(device.custom_fields["frr_parameters"])}
|
329
|
-
)
|
330
|
-
ports_attributes = [
|
331
|
-
dict(address=interface.mac_address)
|
332
|
-
for interface in node_interfaces
|
333
|
-
if interface.enabled and not interface.mgmt_only and interface.mac_address
|
334
|
-
]
|
335
|
-
|
336
|
-
lock = Redlock(
|
337
|
-
key=f"lock_osism_tasks_conductor_sync_ironic-{device.name}",
|
338
|
-
masters={utils.redis},
|
339
|
-
auto_release_time=600,
|
340
|
-
)
|
341
|
-
if lock.acquire(timeout=120):
|
342
|
-
try:
|
343
|
-
logger.info(f"Processing device {device.name}")
|
344
|
-
node = openstack.baremetal_node_show(device.name, ignore_missing=True)
|
345
|
-
if not node:
|
346
|
-
logger.info(f"Creating baremetal node for {device.name}")
|
347
|
-
node = openstack.baremetal_node_create(device.name, node_attributes)
|
348
|
-
else:
|
349
|
-
# NOTE: The listener service only reacts to changes in the baremetal node. Explicitly sync provision and power state in case updates were missed by the listener.
|
350
|
-
if (
|
351
|
-
device.custom_fields["provision_state"]
|
352
|
-
!= node["provision_state"]
|
353
|
-
):
|
354
|
-
netbox.set_provision_state(device.name, node["provision_state"])
|
355
|
-
if device.custom_fields["power_state"] != node["power_state"]:
|
356
|
-
netbox.set_power_state(device.name, node["power_state"])
|
357
|
-
# NOTE: Check whether the baremetal node needs to be updated
|
358
|
-
node_updates = {}
|
359
|
-
deep_compare(node_attributes, node, node_updates)
|
360
|
-
if "driver_info" in node_updates:
|
361
|
-
# NOTE: The password is not returned by ironic, so we cannot make a comparision and it would always be updated. Therefore we pop it from the dictionary
|
362
|
-
password_key = driver_params[node_attributes["driver"]][
|
363
|
-
"password"
|
364
|
-
]
|
365
|
-
if password_key in node_updates["driver_info"]:
|
366
|
-
node_updates["driver_info"].pop(password_key, None)
|
367
|
-
if not node_updates["driver_info"]:
|
368
|
-
node_updates.pop("driver_info", None)
|
369
|
-
if node_updates or force_update:
|
370
|
-
logger.info(
|
371
|
-
f"Updating baremetal node for {device.name} with {node_updates}"
|
372
|
-
)
|
373
|
-
# NOTE: Do the actual updates with all values in node_attributes. Otherwise nested dicts like e.g. driver_info will be overwritten as a whole and contain only changed values
|
374
|
-
node = openstack.baremetal_node_update(
|
375
|
-
node["uuid"], node_attributes
|
376
|
-
)
|
377
|
-
|
378
|
-
node_ports = openstack.baremetal_port_list(
|
379
|
-
details=False, attributes=dict(node_uuid=node["uuid"])
|
380
|
-
)
|
381
|
-
# NOTE: Baremetal ports are only required for (i)pxe boot
|
382
|
-
if node["boot_interface"] in ["pxe", "ipxe"]:
|
383
|
-
for port_attributes in ports_attributes:
|
384
|
-
port_attributes.update({"node_id": node["uuid"]})
|
385
|
-
port = [
|
386
|
-
port
|
387
|
-
for port in node_ports
|
388
|
-
if port_attributes["address"].upper()
|
389
|
-
== port["address"].upper()
|
390
|
-
]
|
391
|
-
if not port:
|
392
|
-
logger.info(
|
393
|
-
f"Creating baremetal port with MAC address {port_attributes['address']} for {device.name}"
|
394
|
-
)
|
395
|
-
openstack.baremetal_port_create(port_attributes)
|
396
|
-
else:
|
397
|
-
node_ports.remove(port[0])
|
398
|
-
for node_port in node_ports:
|
399
|
-
# NOTE: Delete remaining ports not found in netbox
|
400
|
-
logger.info(
|
401
|
-
f"Deleting baremetal port with MAC address {node_port['address']} for {device.name}"
|
402
|
-
)
|
403
|
-
openstack.baremetal_port_delete(node_port["id"])
|
404
|
-
|
405
|
-
node_validation = openstack.baremetal_node_validate(node["uuid"])
|
406
|
-
if node_validation["management"].result:
|
407
|
-
logger.info(
|
408
|
-
f"Validation of management interface successful for baremetal node for {device.name}"
|
409
|
-
)
|
410
|
-
if node["provision_state"] == "enroll":
|
411
|
-
logger.info(
|
412
|
-
f"Transitioning baremetal node to manageable state for {device.name}"
|
413
|
-
)
|
414
|
-
node = openstack.baremetal_node_set_provision_state(
|
415
|
-
node["uuid"], "manage"
|
416
|
-
)
|
417
|
-
node = openstack.baremetal_node_wait_for_nodes_provision_state(
|
418
|
-
node["uuid"], "manageable"
|
419
|
-
)
|
420
|
-
logger.info(f"Baremetal node for {device.name} is manageable")
|
421
|
-
if node_validation["boot"].result:
|
422
|
-
logger.info(
|
423
|
-
f"Validation of boot interface successful for baremetal node for {device.name}"
|
424
|
-
)
|
425
|
-
if node["provision_state"] == "manageable":
|
426
|
-
logger.info(
|
427
|
-
f"Transitioning baremetal node to available state for {device.name}"
|
428
|
-
)
|
429
|
-
node = openstack.baremetal_node_set_provision_state(
|
430
|
-
node["uuid"], "provide"
|
431
|
-
)
|
432
|
-
node = (
|
433
|
-
openstack.baremetal_node_wait_for_nodes_provision_state(
|
434
|
-
node["uuid"], "available"
|
435
|
-
)
|
436
|
-
)
|
437
|
-
logger.info(
|
438
|
-
f"Baremetal node for {device.name} is available"
|
439
|
-
)
|
440
|
-
else:
|
441
|
-
logger.info(
|
442
|
-
f"Validation of boot interface failed for baremetal node for {device.name}\nReason: {node_validation['boot'].reason}"
|
443
|
-
)
|
444
|
-
if node["provision_state"] == "available":
|
445
|
-
# NOTE: Demote node to manageable
|
446
|
-
logger.info(
|
447
|
-
f"Transitioning baremetal node to manageable state for {device.name}"
|
448
|
-
)
|
449
|
-
node = openstack.baremetal_node_set_provision_state(
|
450
|
-
node["uuid"], "manage"
|
451
|
-
)
|
452
|
-
node = (
|
453
|
-
openstack.baremetal_node_wait_for_nodes_provision_state(
|
454
|
-
node["uuid"], "manageable"
|
455
|
-
)
|
456
|
-
)
|
457
|
-
logger.info(
|
458
|
-
f"Baremetal node for {device.name} is manageable"
|
459
|
-
)
|
460
|
-
else:
|
461
|
-
logger.info(
|
462
|
-
f"Validation of management interface failed for baremetal node for {device.name}\nReason: {node_validation['management'].reason}"
|
463
|
-
)
|
464
|
-
except Exception as exc:
|
465
|
-
logger.info(
|
466
|
-
f"Could not fully synchronize device {device.name} with ironic: {exc}"
|
467
|
-
)
|
468
|
-
finally:
|
469
|
-
lock.release()
|
470
|
-
|
471
|
-
else:
|
472
|
-
logger.error("Could not acquire lock for node {device.name}")
|
3
|
+
from osism.tasks.conductor import (
|
4
|
+
app,
|
5
|
+
get_ironic_parameters,
|
6
|
+
sync_netbox,
|
7
|
+
sync_ironic,
|
8
|
+
)
|
9
|
+
|
10
|
+
__all__ = [
|
11
|
+
"app",
|
12
|
+
"get_ironic_parameters",
|
13
|
+
"sync_netbox",
|
14
|
+
"sync_ironic",
|
15
|
+
]
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: osism
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.20250605.0
|
4
4
|
Summary: OSISM manager interface
|
5
5
|
Home-page: https://github.com/osism/python-osism
|
6
6
|
Author: OSISM GmbH
|
@@ -42,7 +42,7 @@ Requires-Dist: kubernetes==32.0.1
|
|
42
42
|
Requires-Dist: loguru==0.7.3
|
43
43
|
Requires-Dist: nbcli==0.10.0.dev2
|
44
44
|
Requires-Dist: netmiko==4.5.0
|
45
|
-
Requires-Dist: openstacksdk==4.
|
45
|
+
Requires-Dist: openstacksdk==4.6.0
|
46
46
|
Requires-Dist: pottery==3.0.1
|
47
47
|
Requires-Dist: prompt-toolkit==3.0.51
|
48
48
|
Requires-Dist: pynetbox==7.5.0
|
@@ -6,7 +6,7 @@ osism/settings.py,sha256=mkvbxVQ64ZD7Ypk-bRePHn0gZ5j6Lcu2a578eLU0gQs,1309
|
|
6
6
|
osism/actions/__init__.py,sha256=bG7Ffen4LvQtgnYPFEpFccsWs81t4zqqeqn9ZeirH6E,38
|
7
7
|
osism/commands/__init__.py,sha256=Ag4wX_DCgXRdoLn6t069jqb3DdRylsX2nyYkiyCx4uk,456
|
8
8
|
osism/commands/apply.py,sha256=q645f4qxmOAaUjVD7npzM2aNuOqfptVAkCLfE6x5IV8,16833
|
9
|
-
osism/commands/baremetal.py,sha256=
|
9
|
+
osism/commands/baremetal.py,sha256=PHXV-OV5M2sezvlidFwRF78OuO1-forXAJ9LYUBBVPk,7965
|
10
10
|
osism/commands/compose.py,sha256=iqzG7mS9E1VWaLNN6yQowjOqiHn3BMdj-yfXb3Dc4Ok,1200
|
11
11
|
osism/commands/compute.py,sha256=cgqXWJa5wAvn-7e3FWCgX6hie_aK0yrKRkcNzjLXwDY,25799
|
12
12
|
osism/commands/configuration.py,sha256=sPe8b0dVKFRbr30xoeVdAnHbGwCwgUh0xa_Vzv5pSQQ,954
|
@@ -25,12 +25,12 @@ osism/commands/status.py,sha256=X-Rcj-XuNPDBoxsGkf96NswwpmTognxz1V6E2NX2ZgY,1997
|
|
25
25
|
osism/commands/sync.py,sha256=Vf9k7uVQTIu-8kK1u7Gjs3et3RRBEkmnNikot_PFJIE,484
|
26
26
|
osism/commands/task.py,sha256=mwJJ7a71Lw3o_FX7j3rR0-NbPdPwMDOjbOAiiXE4uGc,543
|
27
27
|
osism/commands/validate.py,sha256=cA0CSvcbTr0K_6C5EofULrJSEp5xthpRC0TZgb_eazU,4233
|
28
|
-
osism/commands/vault.py,sha256=
|
28
|
+
osism/commands/vault.py,sha256=llaqNN8UH8t8cCu2KmdaURvprA4zeG6izCen_W7ulPs,2029
|
29
29
|
osism/commands/volume.py,sha256=l6oAk__dFM8KKdLTWOvuSiI7tLh9wAPZp8hwmYF-NX0,6595
|
30
30
|
osism/commands/wait.py,sha256=mKFDqEXcaLlKw1T3MuBEZpNh7CeL3lpUXgubD2_f8es,6580
|
31
31
|
osism/commands/worker.py,sha256=iraCOEhCp7WgfjfZ0-12XQYQPUjpi9rSJK5Z9JfNJk4,1651
|
32
32
|
osism/core/__init__.py,sha256=bG7Ffen4LvQtgnYPFEpFccsWs81t4zqqeqn9ZeirH6E,38
|
33
|
-
osism/core/enums.py,sha256=
|
33
|
+
osism/core/enums.py,sha256=gItIjOK6xWuOZSkMxpMdYLRyt4ezyhzkqA7BGiah2o0,10030
|
34
34
|
osism/core/playbooks.py,sha256=M3T3ajV-8Lt-orsRO3jAoukhaoYFr4EZ2dzYXQjt1kg,728
|
35
35
|
osism/data/__init__.py,sha256=izXdh0J3vPLQI7kBhJI7ibJQzPqU_nlONP0L4Cf_k6A,1504
|
36
36
|
osism/plugins/__init__.py,sha256=bG7Ffen4LvQtgnYPFEpFccsWs81t4zqqeqn9ZeirH6E,38
|
@@ -39,18 +39,23 @@ osism/services/listener.py,sha256=eEamlQsJqCuU9K2QFmk3yM9LAJZEanVcTLtGMsNCKjs,97
|
|
39
39
|
osism/tasks/__init__.py,sha256=68mP3DBhGr0om4_oxBLPF8TWBiVMr61lU7kdWiqV0dk,8769
|
40
40
|
osism/tasks/ansible.py,sha256=_2zrHwynwwEv9nDnX-LbNCzcwy9dTUGo_yyutt34HyQ,1346
|
41
41
|
osism/tasks/ceph.py,sha256=eIQkah3Kj4INtOkF9kTjHbXJ3_J2lg48EWJKfHc-UYw,615
|
42
|
-
osism/tasks/conductor.py,sha256=
|
42
|
+
osism/tasks/conductor.py,sha256=i-X4AOxOz7xV0g610AREBmDQPqc8i3kVmT2L5uuE2Rg,240
|
43
43
|
osism/tasks/kolla.py,sha256=wJQpWn_01iWLkr7l7T7RNrQGfRgsgmYi4WQlTmNGvew,618
|
44
44
|
osism/tasks/kubernetes.py,sha256=VzXq_VrYU_CLm4cOruqnE3Kq2ydfO9glZ3p0bp3OYoc,625
|
45
45
|
osism/tasks/netbox.py,sha256=Dq2hg2yiv_dHV-zygJgy9T1ZhTSE32_a34fhfURUfTA,5912
|
46
46
|
osism/tasks/openstack.py,sha256=g15tCll5vP1pC6ysxRCTZxplsdGmXbxaCH3k1Qdv5Xg,6367
|
47
47
|
osism/tasks/reconciler.py,sha256=tnZEZZpveBCK4vHZkHE6wDcHfJAlsPcSjIVxB5ItSFM,1981
|
48
|
+
osism/tasks/conductor/__init__.py,sha256=H428puHzYqik1AEqHijVUMGizEt0mDZL0RaxCiTsRYg,1315
|
49
|
+
osism/tasks/conductor/config.py,sha256=tvfuYNgvw0F_ZbvrjqnyHfrj3vF6z0zhsRtGNu-Lgvo,3410
|
50
|
+
osism/tasks/conductor/ironic.py,sha256=cHcoa32Oa8hjoGY_GZtmnJO4qvOle301dDa0ACn1uF0,15355
|
51
|
+
osism/tasks/conductor/netbox.py,sha256=Wv_FG75M1S9hCZBq_vC5ge30R7vcH57bpLqX011Xct8,1875
|
52
|
+
osism/tasks/conductor/utils.py,sha256=-a0-pRuhV4Fjj0SgdgBqtRJtAdGdqck5pzfi6NYBApU,2338
|
48
53
|
osism/utils/__init__.py,sha256=_Y4qchR5yyI_JKhBWd_jcsvDLYZjxO0c3iMA_VRQl58,4304
|
49
|
-
osism-0.
|
50
|
-
osism-0.
|
51
|
-
osism-0.
|
52
|
-
osism-0.
|
53
|
-
osism-0.
|
54
|
-
osism-0.
|
55
|
-
osism-0.
|
56
|
-
osism-0.
|
54
|
+
osism-0.20250605.0.dist-info/licenses/AUTHORS,sha256=oWotd63qsnNR945QLJP9mEXaXNtCMaesfo8ZNuLjwpU,39
|
55
|
+
osism-0.20250605.0.dist-info/licenses/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
|
56
|
+
osism-0.20250605.0.dist-info/METADATA,sha256=tVmPS34kED3Kf1V34RHb-3WPXmu8-8jqzRUYf3EKwx4,2903
|
57
|
+
osism-0.20250605.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
58
|
+
osism-0.20250605.0.dist-info/entry_points.txt,sha256=cTxzUWJff6JKe1Jv-iMMKayIiC26S1_Fph3k5faiQvw,3252
|
59
|
+
osism-0.20250605.0.dist-info/pbr.json,sha256=g9rrfXMHNdenzVrBTsDuavh4yqaAchyC2SB81rty5Gc,47
|
60
|
+
osism-0.20250605.0.dist-info/top_level.txt,sha256=8L8dsI9hcaGHsdnR4k_LN9EM78EhwrXRFHyAryPXZtY,6
|
61
|
+
osism-0.20250605.0.dist-info/RECORD,,
|
@@ -0,0 +1 @@
|
|
1
|
+
{"git_version": "f816350", "is_release": false}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"git_version": "e6f441e", "is_release": false}
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|