osism 0.20250312.0__py3-none-any.whl → 0.20250326.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/actions/manage_device.py +28 -887
- osism/commands/manage.py +117 -55
- osism/commands/netbox.py +45 -343
- osism/services/listener.py +0 -40
- osism/settings.py +0 -3
- osism/tasks/__init__.py +44 -14
- osism/tasks/ansible.py +0 -15
- osism/tasks/netbox.py +22 -98
- osism/tasks/openstack.py +64 -15
- osism/tasks/reconciler.py +0 -16
- {osism-0.20250312.0.dist-info → osism-0.20250326.0.dist-info}/METADATA +12 -11
- {osism-0.20250312.0.dist-info → osism-0.20250326.0.dist-info}/RECORD +18 -22
- {osism-0.20250312.0.dist-info → osism-0.20250326.0.dist-info}/WHEEL +1 -1
- {osism-0.20250312.0.dist-info → osism-0.20250326.0.dist-info}/entry_points.txt +1 -10
- osism-0.20250326.0.dist-info/licenses/AUTHORS +1 -0
- osism-0.20250326.0.dist-info/pbr.json +1 -0
- osism/actions/check_configuration.py +0 -49
- osism/actions/deploy_configuration.py +0 -92
- osism/actions/diff_configuration.py +0 -59
- osism/actions/generate_configuration.py +0 -137
- osism-0.20250312.0.dist-info/AUTHORS +0 -1
- osism-0.20250312.0.dist-info/pbr.json +0 -1
- {osism-0.20250312.0.dist-info → osism-0.20250326.0.dist-info/licenses}/LICENSE +0 -0
- {osism-0.20250312.0.dist-info → osism-0.20250326.0.dist-info}/top_level.txt +0 -0
osism/tasks/netbox.py
CHANGED
@@ -1,8 +1,5 @@
|
|
1
1
|
# SPDX-License-Identifier: Apache-2.0
|
2
2
|
|
3
|
-
import os
|
4
|
-
import subprocess
|
5
|
-
|
6
3
|
from celery import Celery
|
7
4
|
from celery.signals import worker_process_init
|
8
5
|
import json
|
@@ -10,15 +7,8 @@ import pynetbox
|
|
10
7
|
from redis import Redis
|
11
8
|
|
12
9
|
from osism import settings
|
13
|
-
from osism.actions import
|
14
|
-
|
15
|
-
deploy_configuration,
|
16
|
-
diff_configuration,
|
17
|
-
generate_configuration,
|
18
|
-
manage_device,
|
19
|
-
manage_interface,
|
20
|
-
)
|
21
|
-
from osism.tasks import Config, openstack
|
10
|
+
from osism.actions import manage_device, manage_interface
|
11
|
+
from osism.tasks import Config, openstack, run_command
|
22
12
|
|
23
13
|
app = Celery("netbox")
|
24
14
|
app.config_from_object(Config)
|
@@ -73,35 +63,6 @@ def update_network_interface_name(self, mac_address, network_interface_name):
|
|
73
63
|
manage_interface.update_network_interface_name(mac_address, network_interface_name)
|
74
64
|
|
75
65
|
|
76
|
-
@app.task(bind=True, name="osism.tasks.netbox.import_device_types")
|
77
|
-
def import_device_types(self, vendors, library=False):
|
78
|
-
global redis
|
79
|
-
|
80
|
-
if library:
|
81
|
-
env = {**os.environ, "BASE_PATH": "/devicetype-library/device-types/"}
|
82
|
-
else:
|
83
|
-
env = {**os.environ, "BASE_PATH": "/netbox/device-types/"}
|
84
|
-
|
85
|
-
if vendors:
|
86
|
-
p = subprocess.Popen(
|
87
|
-
f"python3 /import/main.py --vendors {vendors}",
|
88
|
-
shell=True,
|
89
|
-
stdout=subprocess.PIPE,
|
90
|
-
stderr=subprocess.STDOUT,
|
91
|
-
env=env,
|
92
|
-
)
|
93
|
-
else:
|
94
|
-
p = subprocess.Popen(
|
95
|
-
"python3 /import/main.py",
|
96
|
-
shell=True,
|
97
|
-
stdout=subprocess.PIPE,
|
98
|
-
stderr=subprocess.STDOUT,
|
99
|
-
env=env,
|
100
|
-
)
|
101
|
-
|
102
|
-
p.communicate()
|
103
|
-
|
104
|
-
|
105
66
|
@app.task(bind=True, name="osism.tasks.netbox.synchronize_device_state")
|
106
67
|
def synchronize_device_state(self, data):
|
107
68
|
"""Synchronize the state of Ironic with Netbox"""
|
@@ -123,23 +84,6 @@ def states(self, data):
|
|
123
84
|
return result
|
124
85
|
|
125
86
|
|
126
|
-
@app.task(bind=True, name="osism.tasks.netbox.transitions")
|
127
|
-
def transitions(self, data):
|
128
|
-
result = manage_device.get_transitions(data.keys())
|
129
|
-
return result
|
130
|
-
|
131
|
-
|
132
|
-
@app.task(bind=True, name="osism.tasks.netbox.data")
|
133
|
-
def data(self, collection, device, state):
|
134
|
-
result = manage_device.load_data_from_filesystem(collection, device, state)
|
135
|
-
return result
|
136
|
-
|
137
|
-
|
138
|
-
@app.task(bind=True, name="osism.tasks.netbox.connect")
|
139
|
-
def connect(self, device=None, state=None, data={}, enforce=False):
|
140
|
-
manage_device.run(device, state, data, enforce)
|
141
|
-
|
142
|
-
|
143
87
|
@app.task(bind=True, name="osism.tasks.netbox.set_state")
|
144
88
|
def set_state(self, device=None, state=None, state_type=None):
|
145
89
|
manage_device.set_state(device, state, state_type)
|
@@ -150,47 +94,7 @@ def set_maintenance(self, device=None, state=None):
|
|
150
94
|
manage_device.set_maintenance(device, state)
|
151
95
|
|
152
96
|
|
153
|
-
@app.task(bind=True, name="osism.tasks.netbox.disable")
|
154
|
-
def disable(self, name):
|
155
|
-
global nb
|
156
|
-
|
157
|
-
for interface in nb.dcim.interfaces.filter(device=name):
|
158
|
-
if str(interface.type) in ["Virtual"]:
|
159
|
-
continue
|
160
|
-
|
161
|
-
if "Port-Channel" in interface.name:
|
162
|
-
continue
|
163
|
-
|
164
|
-
if not interface.connected_endpoint and interface.enabled:
|
165
|
-
interface.enabled = False
|
166
|
-
interface.save()
|
167
|
-
|
168
|
-
# FIXME: only enable devices that are not disabled by configuration
|
169
|
-
if interface.connected_endpoint and not interface.enabled:
|
170
|
-
interface.enabled = True
|
171
|
-
interface.save()
|
172
|
-
|
173
|
-
|
174
|
-
@app.task(bind=True, name="osism.tasks.netbox.generate")
|
175
|
-
def generate(self, name, template=None):
|
176
|
-
generate_configuration.for_device(name, template)
|
177
|
-
|
178
|
-
|
179
|
-
@app.task(bind=True, name="osism.tasks.netbox.deploy")
|
180
|
-
def deploy(self, name):
|
181
|
-
deploy_configuration.for_device(name)
|
182
|
-
|
183
|
-
|
184
|
-
@app.task(bind=True, name="osism.tasks.netbox.check")
|
185
|
-
def check(self, name):
|
186
|
-
check_configuration.for_device(name)
|
187
|
-
|
188
|
-
|
189
97
|
@app.task(bind=True, name="osism.tasks.netbox.diff")
|
190
|
-
def diff(self, name):
|
191
|
-
diff_configuration.for_device(name)
|
192
|
-
|
193
|
-
|
194
98
|
@app.task(bind=True, name="osism.tasks.netbox.get_devices_not_yet_registered_in_ironic")
|
195
99
|
def get_devices_not_yet_registered_in_ironic(
|
196
100
|
self, status="active", tags=["managed-by-ironic"], ironic_enabled=True
|
@@ -238,6 +142,26 @@ def get_devices_that_should_have_an_allocation_in_ironic(self):
|
|
238
142
|
return result
|
239
143
|
|
240
144
|
|
145
|
+
@app.task(bind=True, name="osism.tasks.netbox.manage")
|
146
|
+
def manage(self, *arguments, publish=True, locking=False, auto_release_time=3600):
|
147
|
+
netbox_manager_env = {
|
148
|
+
"NETBOX_MANAGER_URL": str(settings.NETBOX_URL),
|
149
|
+
"NETBOX_MANAGER_TOKEN": str(settings.NETBOX_TOKEN),
|
150
|
+
"NETBOX_MANAGER_IGNORE_SSL_ERRORS": str(settings.IGNORE_SSL_ERRORS),
|
151
|
+
"NETBOX_MANAGER_VERBOSE": "true",
|
152
|
+
}
|
153
|
+
|
154
|
+
return run_command(
|
155
|
+
self.request.id,
|
156
|
+
"/usr/local/bin/netbox-manager",
|
157
|
+
netbox_manager_env,
|
158
|
+
*arguments,
|
159
|
+
publish=publish,
|
160
|
+
locking=locking,
|
161
|
+
auto_release_time=auto_release_time
|
162
|
+
)
|
163
|
+
|
164
|
+
|
241
165
|
@app.task(bind=True, name="osism.tasks.netbox.ping")
|
242
166
|
def ping(self):
|
243
167
|
global nb
|
osism/tasks/openstack.py
CHANGED
@@ -1,34 +1,21 @@
|
|
1
1
|
# SPDX-License-Identifier: Apache-2.0
|
2
2
|
|
3
|
-
import functools
|
4
3
|
import copy
|
5
4
|
import ipaddress
|
6
|
-
from threading import RLock
|
7
5
|
|
8
6
|
from celery import Celery
|
9
7
|
from celery.signals import worker_process_init
|
10
8
|
import jinja2
|
11
9
|
import keystoneauth1
|
12
|
-
import kombu.utils
|
13
10
|
import openstack
|
14
11
|
from pottery import Redlock
|
15
12
|
from redis import Redis
|
13
|
+
import tempfile
|
16
14
|
|
17
15
|
from osism import settings
|
18
|
-
from osism.tasks import Config, conductor, netbox
|
16
|
+
from osism.tasks import Config, conductor, netbox, run_command
|
19
17
|
from osism import utils
|
20
18
|
|
21
|
-
# https://github.com/celery/kombu/issues/1804
|
22
|
-
if not getattr(kombu.utils.cached_property, "lock", None):
|
23
|
-
setattr(
|
24
|
-
kombu.utils.cached_property,
|
25
|
-
"lock",
|
26
|
-
functools.cached_property(lambda _: RLock()),
|
27
|
-
)
|
28
|
-
# Must call __set_name__ here since this cached property is not defined in the context of a class
|
29
|
-
# Refer to https://docs.python.org/3/reference/datamodel.html#object.__set_name__
|
30
|
-
kombu.utils.cached_property.lock.__set_name__(kombu.utils.cached_property, "lock")
|
31
|
-
|
32
19
|
app = Celery("openstack")
|
33
20
|
app.config_from_object(Config)
|
34
21
|
|
@@ -267,3 +254,65 @@ def baremetal_create_internal_flavor(self, node):
|
|
267
254
|
def baremetal_delete_internal_flavor(self, node):
|
268
255
|
flavor = conn.compute.get_flavor(f"osism-{node}")
|
269
256
|
conn.compute.delete_flavor(flavor)
|
257
|
+
|
258
|
+
|
259
|
+
@app.task(bind=True, name="osism.tasks.openstack.image_manager")
|
260
|
+
def image_manager(
|
261
|
+
self, *arguments, configs=None, publish=True, locking=False, auto_release_time=3600
|
262
|
+
):
|
263
|
+
command = "/usr/local/bin/openstack-image-manager"
|
264
|
+
if configs:
|
265
|
+
with tempfile.TemporaryDirectory() as temp_dir:
|
266
|
+
for config in configs:
|
267
|
+
with tempfile.NamedTemporaryFile(
|
268
|
+
mode="w+", suffix=".yml", dir=temp_dir, delete=False
|
269
|
+
) as temp_file:
|
270
|
+
temp_file.write(config)
|
271
|
+
|
272
|
+
sanitized_args = [
|
273
|
+
arg for arg in arguments if not arg.startswith("--images=")
|
274
|
+
]
|
275
|
+
|
276
|
+
try:
|
277
|
+
images_index = sanitized_args.index("--images")
|
278
|
+
sanitized_args.pop(images_index)
|
279
|
+
sanitized_args.pop(images_index)
|
280
|
+
except ValueError:
|
281
|
+
pass
|
282
|
+
sanitized_args.extend(["--images", temp_dir])
|
283
|
+
rc = run_command(
|
284
|
+
self.request.id,
|
285
|
+
command,
|
286
|
+
{},
|
287
|
+
*sanitized_args,
|
288
|
+
publish=publish,
|
289
|
+
locking=locking,
|
290
|
+
auto_release_time=auto_release_time,
|
291
|
+
)
|
292
|
+
return rc
|
293
|
+
else:
|
294
|
+
return run_command(
|
295
|
+
self.request.id,
|
296
|
+
command,
|
297
|
+
{},
|
298
|
+
*arguments,
|
299
|
+
publish=publish,
|
300
|
+
locking=locking,
|
301
|
+
auto_release_time=auto_release_time,
|
302
|
+
)
|
303
|
+
|
304
|
+
|
305
|
+
@app.task(bind=True, name="osism.tasks.openstack.flavor_manager")
|
306
|
+
def flavor_manager(
|
307
|
+
self, *arguments, publish=True, locking=False, auto_release_time=3600
|
308
|
+
):
|
309
|
+
command = "/usr/local/bin/openstack-flavor-manager"
|
310
|
+
return run_command(
|
311
|
+
self.request.id,
|
312
|
+
command,
|
313
|
+
{},
|
314
|
+
*arguments,
|
315
|
+
publish=publish,
|
316
|
+
locking=locking,
|
317
|
+
auto_release_time=auto_release_time,
|
318
|
+
)
|
osism/tasks/reconciler.py
CHANGED
@@ -1,32 +1,16 @@
|
|
1
1
|
# SPDX-License-Identifier: Apache-2.0
|
2
2
|
|
3
|
-
import functools
|
4
3
|
import io
|
5
4
|
import subprocess
|
6
|
-
from threading import RLock
|
7
5
|
|
8
6
|
from celery import Celery
|
9
7
|
from celery.signals import worker_process_init
|
10
|
-
import kombu.utils
|
11
8
|
from loguru import logger
|
12
9
|
from pottery import Redlock
|
13
10
|
from redis import Redis
|
14
|
-
|
15
11
|
from osism import settings
|
16
12
|
from osism.tasks import Config
|
17
13
|
|
18
|
-
|
19
|
-
# https://github.com/celery/kombu/issues/1804
|
20
|
-
if not getattr(kombu.utils.cached_property, "lock", None):
|
21
|
-
setattr(
|
22
|
-
kombu.utils.cached_property,
|
23
|
-
"lock",
|
24
|
-
functools.cached_property(lambda _: RLock()),
|
25
|
-
)
|
26
|
-
# Must call __set_name__ here since this cached property is not defined in the context of a class
|
27
|
-
# Refer to https://docs.python.org/3/reference/datamodel.html#object.__set_name__
|
28
|
-
kombu.utils.cached_property.lock.__set_name__(kombu.utils.cached_property, "lock")
|
29
|
-
|
30
14
|
app = Celery("reconciler")
|
31
15
|
app.config_from_object(Config)
|
32
16
|
|
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: osism
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.20250326.0
|
4
4
|
Summary: OSISM manager interface
|
5
5
|
Home-page: https://github.com/osism/python-osism
|
6
6
|
Author: OSISM GmbH
|
@@ -29,28 +29,28 @@ Requires-Dist: PyYAML==6.0.2
|
|
29
29
|
Requires-Dist: ara==1.7.2
|
30
30
|
Requires-Dist: celery[redis]==5.4.0
|
31
31
|
Requires-Dist: cliff==4.9.1
|
32
|
-
Requires-Dist: deepdiff==8.
|
32
|
+
Requires-Dist: deepdiff==8.4.2
|
33
33
|
Requires-Dist: docker==7.1.0
|
34
34
|
Requires-Dist: dtrack-auditor==1.5.0
|
35
|
-
Requires-Dist: fastapi==0.115.
|
35
|
+
Requires-Dist: fastapi==0.115.12
|
36
36
|
Requires-Dist: flower==2.0.1
|
37
37
|
Requires-Dist: hiredis==3.1.0
|
38
38
|
Requires-Dist: jc==1.25.4
|
39
39
|
Requires-Dist: keystoneauth1==5.10.0
|
40
|
-
Requires-Dist: kombu==5.
|
40
|
+
Requires-Dist: kombu==5.5.1
|
41
41
|
Requires-Dist: kubernetes==32.0.1
|
42
42
|
Requires-Dist: loguru==0.7.3
|
43
43
|
Requires-Dist: netmiko==4.5.0
|
44
44
|
Requires-Dist: nornir-ansible==2023.12.28
|
45
45
|
Requires-Dist: nornir==3.5.0
|
46
|
-
Requires-Dist: openstacksdk==4.
|
47
|
-
Requires-Dist: pottery==3.0.
|
46
|
+
Requires-Dist: openstacksdk==4.4.0
|
47
|
+
Requires-Dist: pottery==3.0.1
|
48
48
|
Requires-Dist: prompt-toolkit==3.0.50
|
49
49
|
Requires-Dist: pydantic==1.10.21
|
50
50
|
Requires-Dist: pynetbox==7.4.1
|
51
51
|
Requires-Dist: pytest-testinfra==10.1.1
|
52
52
|
Requires-Dist: python-dateutil==2.9.0.post0
|
53
|
-
Requires-Dist: setuptools==
|
53
|
+
Requires-Dist: setuptools==78.1.0
|
54
54
|
Requires-Dist: sqlmodel==0.0.24
|
55
55
|
Requires-Dist: sushy==5.5.0
|
56
56
|
Requires-Dist: tabulate==0.9.0
|
@@ -58,15 +58,16 @@ Requires-Dist: transitions==0.9.2
|
|
58
58
|
Requires-Dist: uvicorn[standard]==0.34.0
|
59
59
|
Requires-Dist: watchdog==6.0.0
|
60
60
|
Provides-Extra: ansible
|
61
|
-
Requires-Dist: ansible-runner==2.4.
|
62
|
-
Requires-Dist: ansible-core==2.18.
|
61
|
+
Requires-Dist: ansible-runner==2.4.1; extra == "ansible"
|
62
|
+
Requires-Dist: ansible-core==2.18.4; extra == "ansible"
|
63
63
|
Provides-Extra: openstack-image-manager
|
64
|
-
Requires-Dist: openstack-image-manager==0.
|
64
|
+
Requires-Dist: openstack-image-manager==0.20250314.0; extra == "openstack-image-manager"
|
65
65
|
Dynamic: author
|
66
66
|
Dynamic: author-email
|
67
67
|
Dynamic: classifier
|
68
68
|
Dynamic: description
|
69
69
|
Dynamic: home-page
|
70
|
+
Dynamic: license-file
|
70
71
|
Dynamic: requires-dist
|
71
72
|
Dynamic: requires-python
|
72
73
|
Dynamic: summary
|
@@ -2,13 +2,9 @@ osism/__init__.py,sha256=1UiNTBus0V0f2AbZQzAtVtu6zkfCCrw0OTq--NwFAqY,341
|
|
2
2
|
osism/__main__.py,sha256=ILe4gu61xEISiBsxanqTQIdSkV-YhpZXTRlguCYyssk,141
|
3
3
|
osism/api.py,sha256=X3IVLWbKMtfozJ5sEx6sLEZ1rD4U9s3uNnLLwxiwDjs,4802
|
4
4
|
osism/main.py,sha256=Dt2-9sLXcS-Ny4DAz7hrha-KRc7zd7BFUTRdfs_X8z4,893
|
5
|
-
osism/settings.py,sha256=
|
5
|
+
osism/settings.py,sha256=m__DltxKQo5D-vDKKwY8RNBVs5bverYdJmtyVyln_6o,1049
|
6
6
|
osism/actions/__init__.py,sha256=bG7Ffen4LvQtgnYPFEpFccsWs81t4zqqeqn9ZeirH6E,38
|
7
|
-
osism/actions/
|
8
|
-
osism/actions/deploy_configuration.py,sha256=uHrW6J0908zloK3SnOcKq3m53H8KCihplU1IA10mZMA,2712
|
9
|
-
osism/actions/diff_configuration.py,sha256=sGoUPQWxINE_qqqBgePxOtEOXgtMFRM43TGJtGFFwhs,1513
|
10
|
-
osism/actions/generate_configuration.py,sha256=eAv1IfKYMw3466rStHB1HXHVksM0wn4CrHjZDfTgV40,4391
|
11
|
-
osism/actions/manage_device.py,sha256=VXrRRcu78i05QjmN3t3vdeF1OoMAE7oYUaSyK0aJOjo,37457
|
7
|
+
osism/actions/manage_device.py,sha256=joQwPnwEUw5V1ZRRbdrM0FjfNlG4vPNc0r8FBRTOJiA,3541
|
12
8
|
osism/actions/manage_interface.py,sha256=iDp7zY16XXtwdLk1sxa-TBAkpdPxmtbVeEvMZuP5h4s,472
|
13
9
|
osism/commands/__init__.py,sha256=Ag4wX_DCgXRdoLn6t069jqb3DdRylsX2nyYkiyCx4uk,456
|
14
10
|
osism/commands/apply.py,sha256=n3lLb1cS3GahQqRT0723di98hg47MjVzDzkAoeZX7qU,16780
|
@@ -19,8 +15,8 @@ osism/commands/console.py,sha256=8BPz1hio5Wi6kONVAWFuSqkDRrMcLEYeFIY8dbtN6e4,321
|
|
19
15
|
osism/commands/container.py,sha256=Fku2GaCM3Idq_FxExUtNqjrEM0XYjpVvXmueSVO8S_c,1601
|
20
16
|
osism/commands/get.py,sha256=ryytjtXWmlMV0NucP5tGkMZu0nIlC4xVtjRk4iMZ06c,8967
|
21
17
|
osism/commands/log.py,sha256=2IpYuosC7FZwwLvM8HmKSU1NRNIelVVYzqjjVMCrOJk,4072
|
22
|
-
osism/commands/manage.py,sha256=
|
23
|
-
osism/commands/netbox.py,sha256=
|
18
|
+
osism/commands/manage.py,sha256=SDJyH3zwdaOjVWURIIjm8WMo6zSor1Y_TiTYgeMt4pI,11932
|
19
|
+
osism/commands/netbox.py,sha256=DMAgP9o9AUjw1Cf3MLjSQ36vr5NckGKIsAPNQictboc,4702
|
24
20
|
osism/commands/noset.py,sha256=7zDFuFMyNpo7DUOKcNiYV8nodtdMOYFp5LDPcuJhlZ8,1481
|
25
21
|
osism/commands/reconciler.py,sha256=Ja_b86gX6-_Pr3DmrUUvskmEnnJpHQ-XJNQLycMJeyc,2818
|
26
22
|
osism/commands/server.py,sha256=zFXRdYoj4ZNDJNPSaGddMPEWxt8G2GyMomPOcCOaN3c,4137
|
@@ -40,22 +36,22 @@ osism/core/playbooks.py,sha256=M3T3ajV-8Lt-orsRO3jAoukhaoYFr4EZ2dzYXQjt1kg,728
|
|
40
36
|
osism/data/__init__.py,sha256=izXdh0J3vPLQI7kBhJI7ibJQzPqU_nlONP0L4Cf_k6A,1504
|
41
37
|
osism/plugins/__init__.py,sha256=bG7Ffen4LvQtgnYPFEpFccsWs81t4zqqeqn9ZeirH6E,38
|
42
38
|
osism/services/__init__.py,sha256=bG7Ffen4LvQtgnYPFEpFccsWs81t4zqqeqn9ZeirH6E,38
|
43
|
-
osism/services/listener.py,sha256
|
44
|
-
osism/tasks/__init__.py,sha256=
|
45
|
-
osism/tasks/ansible.py,sha256=
|
39
|
+
osism/services/listener.py,sha256=JjCdwPG5U9b_xYDpGFQeiLPP4y00GM3Me6NW1tt6Jws,11275
|
40
|
+
osism/tasks/__init__.py,sha256=qZQGMeaaeUN9CUBqVXGEx2pvDZpDJbhudq0jl4-7GRU,9111
|
41
|
+
osism/tasks/ansible.py,sha256=RcLxLrjzL5_X6OjNHm3H0lZlmKKlYKIANB0M4_d4chE,1109
|
46
42
|
osism/tasks/ceph.py,sha256=eIQkah3Kj4INtOkF9kTjHbXJ3_J2lg48EWJKfHc-UYw,615
|
47
43
|
osism/tasks/conductor.py,sha256=g9ulqWlGim0DjwQkVgW8Tl8MsXBGuukuQvM12CXbEmM,3892
|
48
44
|
osism/tasks/kolla.py,sha256=wJQpWn_01iWLkr7l7T7RNrQGfRgsgmYi4WQlTmNGvew,618
|
49
45
|
osism/tasks/kubernetes.py,sha256=VzXq_VrYU_CLm4cOruqnE3Kq2ydfO9glZ3p0bp3OYoc,625
|
50
|
-
osism/tasks/netbox.py,sha256=
|
51
|
-
osism/tasks/openstack.py,sha256=
|
52
|
-
osism/tasks/reconciler.py,sha256=
|
46
|
+
osism/tasks/netbox.py,sha256=yR8z6VYkNXmNCsHzxP6KGmPtGW5mbpLks8XEw6TUwjk,4692
|
47
|
+
osism/tasks/openstack.py,sha256=RkP1K-UhD3yJea1YD9cPyc5IWEvS-E8L6CCAiJlEpf8,10463
|
48
|
+
osism/tasks/reconciler.py,sha256=q_J825nw8haIcYS-FME5oWlaiSPmDbAGeB6NK6Vj00w,2974
|
53
49
|
osism/utils/__init__.py,sha256=5yng8l5Jd6GhNO4FNi6iYH4569UuTYAynamANgZnm1E,1258
|
54
|
-
osism-0.
|
55
|
-
osism-0.
|
56
|
-
osism-0.
|
57
|
-
osism-0.
|
58
|
-
osism-0.
|
59
|
-
osism-0.
|
60
|
-
osism-0.
|
61
|
-
osism-0.
|
50
|
+
osism-0.20250326.0.dist-info/licenses/AUTHORS,sha256=EKFIR9F27AvoEXp1cA6FkGbjEOFt4Rcbipr5RJc7jSs,64
|
51
|
+
osism-0.20250326.0.dist-info/licenses/LICENSE,sha256=tAkwu8-AdEyGxGoSvJ2gVmQdcicWw3j1ZZueVV74M-E,11357
|
52
|
+
osism-0.20250326.0.dist-info/METADATA,sha256=7k0X9KTHpjfEgTKYV-Rw3biNu57oWLwLlEXT5EtG2vE,2972
|
53
|
+
osism-0.20250326.0.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
54
|
+
osism-0.20250326.0.dist-info/entry_points.txt,sha256=DlfrvU14rI55WuTrwNRoce9FY3ric4HeZKZx_Z3NzCw,3015
|
55
|
+
osism-0.20250326.0.dist-info/pbr.json,sha256=i-cyCN-68l6O9MTObxxZqkRCTq2ElZumvNW_esL1WmI,47
|
56
|
+
osism-0.20250326.0.dist-info/top_level.txt,sha256=8L8dsI9hcaGHsdnR4k_LN9EM78EhwrXRFHyAryPXZtY,6
|
57
|
+
osism-0.20250326.0.dist-info/RECORD,,
|
@@ -36,19 +36,10 @@ manage flavors = osism.commands.manage:Flavors
|
|
36
36
|
manage image clusterapi = osism.commands.manage:ImageClusterapi
|
37
37
|
manage image octavia = osism.commands.manage:ImageOctavia
|
38
38
|
manage images = osism.commands.manage:Images
|
39
|
+
manage netbox = osism.commands.netbox:Manage
|
39
40
|
manage server list = osism.commands.server:ServerList
|
40
41
|
manage server migrate = osism.commands.server:ServerMigrate
|
41
42
|
manage volume list = osism.commands.volume:VolumeList
|
42
|
-
netbox = osism.commands.netbox:Run
|
43
|
-
netbox check = osism.commands.netbox:Check
|
44
|
-
netbox connect = osism.commands.netbox:Connect
|
45
|
-
netbox deploy = osism.commands.netbox:Deploy
|
46
|
-
netbox diff = osism.commands.netbox:Diff
|
47
|
-
netbox disable = osism.commands.netbox:Disable
|
48
|
-
netbox generate = osism.commands.netbox:Generate
|
49
|
-
netbox import = osism.commands.netbox:Import
|
50
|
-
netbox init = osism.commands.netbox:Init
|
51
|
-
netbox manage = osism.commands.netbox:Manage
|
52
43
|
netbox ping = osism.commands.netbox:Ping
|
53
44
|
netbox sync = osism.commands.netbox:Sync
|
54
45
|
netbox sync ironic = osism.commands.netbox:Ironic
|
@@ -0,0 +1 @@
|
|
1
|
+
renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
|
@@ -0,0 +1 @@
|
|
1
|
+
{"git_version": "908ac32", "is_release": false}
|
@@ -1,49 +0,0 @@
|
|
1
|
-
# SPDX-License-Identifier: Apache-2.0
|
2
|
-
|
3
|
-
from loguru import logger
|
4
|
-
from pottery import Redlock
|
5
|
-
|
6
|
-
from osism import utils
|
7
|
-
|
8
|
-
|
9
|
-
def for_device(name, parameters={}):
|
10
|
-
device = utils.nb.dcim.devices.get(name=name)
|
11
|
-
|
12
|
-
if (
|
13
|
-
"device_type" not in device.custom_fields
|
14
|
-
or device.custom_fields["device_type"] != "switch"
|
15
|
-
):
|
16
|
-
return
|
17
|
-
|
18
|
-
if "Managed by OSISM" not in [str(x) for x in device.tags]:
|
19
|
-
return
|
20
|
-
|
21
|
-
if "deployment_enabled" in device.custom_fields and not bool(
|
22
|
-
device.custom_fields["deployment_enabled"]
|
23
|
-
):
|
24
|
-
return
|
25
|
-
|
26
|
-
if "deployment_type" not in device.custom_fields:
|
27
|
-
return
|
28
|
-
|
29
|
-
# Allow only one change per time
|
30
|
-
lock = Redlock(
|
31
|
-
key=f"lock_check_{name}", masters={utils.redis}, auto_release_time=120
|
32
|
-
)
|
33
|
-
lock.acquire()
|
34
|
-
|
35
|
-
logger.info(
|
36
|
-
f"Check configuration for device {device.name} with plugin {device.custom_fields['deployment_type']}"
|
37
|
-
)
|
38
|
-
|
39
|
-
deployment_type = device.custom_fields["deployment_type"]
|
40
|
-
logger.error(
|
41
|
-
f"Deployment type {deployment_type} for device {device.name} not supported"
|
42
|
-
)
|
43
|
-
last_configuration = None
|
44
|
-
|
45
|
-
if last_configuration:
|
46
|
-
for line in last_configuration.split("\n"):
|
47
|
-
logger.info(f"configuration - {device.name}: {line}")
|
48
|
-
|
49
|
-
lock.release()
|
@@ -1,92 +0,0 @@
|
|
1
|
-
# SPDX-License-Identifier: Apache-2.0
|
2
|
-
|
3
|
-
from loguru import logger
|
4
|
-
from pottery import Redlock
|
5
|
-
import git
|
6
|
-
import jinja2
|
7
|
-
|
8
|
-
from osism import utils
|
9
|
-
|
10
|
-
|
11
|
-
def for_device(name, parameters={}, mode="deploy"):
|
12
|
-
device = utils.nb.dcim.devices.get(name=name)
|
13
|
-
|
14
|
-
if (
|
15
|
-
"device_type" not in device.custom_fields
|
16
|
-
or device.custom_fields["device_type"] != "switch"
|
17
|
-
):
|
18
|
-
return
|
19
|
-
|
20
|
-
if "Managed by OSISM" not in [str(x) for x in device.tags]:
|
21
|
-
return
|
22
|
-
|
23
|
-
if "deployment_enabled" in device.custom_fields and not bool(
|
24
|
-
device.custom_fields["deployment_enabled"]
|
25
|
-
):
|
26
|
-
return
|
27
|
-
|
28
|
-
if "deployment_type" not in device.custom_fields:
|
29
|
-
return
|
30
|
-
|
31
|
-
# Allow only one change per time
|
32
|
-
lock = Redlock(
|
33
|
-
key=f"lock_deploy_{name}", masters={utils.redis}, auto_release_time=120
|
34
|
-
)
|
35
|
-
lock.acquire()
|
36
|
-
|
37
|
-
repo = git.Repo.init(path="/state")
|
38
|
-
|
39
|
-
first = False
|
40
|
-
|
41
|
-
if device.name in repo.tags:
|
42
|
-
last_commit = repo.commit(device.name)
|
43
|
-
current_commit = repo.head.commit
|
44
|
-
else:
|
45
|
-
first = True
|
46
|
-
last_commit = repo.head.commit
|
47
|
-
current_commit = repo.head.commit
|
48
|
-
|
49
|
-
if device.name in repo.tags and mode == "deploy":
|
50
|
-
repo.delete_tag(name)
|
51
|
-
|
52
|
-
if not first and last_commit == current_commit and mode == "deploy":
|
53
|
-
logger.info(f"No deployment for device {device.name} required")
|
54
|
-
else:
|
55
|
-
if not first:
|
56
|
-
try:
|
57
|
-
last_configuration = repo.git.show(
|
58
|
-
f"{last_commit.hexsha}:{device.name}.cfg.j2"
|
59
|
-
)
|
60
|
-
except git.exc.GitCommandError:
|
61
|
-
last_configuration = None
|
62
|
-
else:
|
63
|
-
last_configuration = None
|
64
|
-
|
65
|
-
try:
|
66
|
-
current_configuration = repo.git.show(
|
67
|
-
f"{current_commit.hexsha}:{device.name}.cfg.j2"
|
68
|
-
)
|
69
|
-
except git.exc.GitCommandError:
|
70
|
-
current_configuration = None
|
71
|
-
|
72
|
-
if not current_configuration:
|
73
|
-
logger.error(f"There is no prepared configuration for device {device.name}")
|
74
|
-
else:
|
75
|
-
t = jinja2.Environment(loader=jinja2.BaseLoader()).from_string(
|
76
|
-
current_configuration
|
77
|
-
)
|
78
|
-
rendered_current_configuration = t.render(**parameters)
|
79
|
-
|
80
|
-
logger.info(
|
81
|
-
f"{mode} configuration for device {device.name} with plugin {device.custom_fields['deployment_type']}"
|
82
|
-
)
|
83
|
-
|
84
|
-
deployment_type = device.custom_fields["deployment_type"]
|
85
|
-
logger.error(
|
86
|
-
f"Deployment type {deployment_type} for device {device.name} not supported"
|
87
|
-
)
|
88
|
-
|
89
|
-
if mode == "deploy":
|
90
|
-
repo.create_tag(device.name, current_commit)
|
91
|
-
|
92
|
-
lock.release()
|
@@ -1,59 +0,0 @@
|
|
1
|
-
# SPDX-License-Identifier: Apache-2.0
|
2
|
-
|
3
|
-
from loguru import logger
|
4
|
-
import git
|
5
|
-
from pottery import Redlock
|
6
|
-
|
7
|
-
from osism import utils
|
8
|
-
|
9
|
-
|
10
|
-
def for_device(name, parameters={}):
|
11
|
-
device = utils.nb.dcim.devices.get(name=name)
|
12
|
-
|
13
|
-
if (
|
14
|
-
"device_type" not in device.custom_fields
|
15
|
-
or device.custom_fields["device_type"] != "switch"
|
16
|
-
):
|
17
|
-
return
|
18
|
-
|
19
|
-
if "Managed by OSISM" not in [str(x) for x in device.tags]:
|
20
|
-
return
|
21
|
-
|
22
|
-
if "deployment_enabled" in device.custom_fields and not bool(
|
23
|
-
device.custom_fields["deployment_enabled"]
|
24
|
-
):
|
25
|
-
return
|
26
|
-
|
27
|
-
if "deployment_type" not in device.custom_fields:
|
28
|
-
return
|
29
|
-
|
30
|
-
# Allow only one change per time
|
31
|
-
lock = Redlock(
|
32
|
-
key=f"lock_diff_{name}", masters={utils.redis}, auto_release_time=120
|
33
|
-
)
|
34
|
-
lock.acquire()
|
35
|
-
|
36
|
-
logger.info(
|
37
|
-
f"Diff configuration for device {device.name} with plugin {device.custom_fields['deployment_type']}"
|
38
|
-
)
|
39
|
-
|
40
|
-
deployment_type = device.custom_fields["deployment_type"]
|
41
|
-
logger.error(
|
42
|
-
f"Deployment type {deployment_type} for device {device.name} not supported"
|
43
|
-
)
|
44
|
-
current_configuration = None
|
45
|
-
|
46
|
-
repo = git.Repo.init(path="/state")
|
47
|
-
|
48
|
-
try:
|
49
|
-
last_configuration = repo.git.show(
|
50
|
-
f"{repo.head.commit.hexsha}:{device.name}.cfg.j2"
|
51
|
-
)
|
52
|
-
except git.exc.GitCommandError:
|
53
|
-
last_configuration = None
|
54
|
-
|
55
|
-
logger.error(
|
56
|
-
f"Deployment type {deployment_type} for device {device.name} not supported"
|
57
|
-
)
|
58
|
-
|
59
|
-
lock.release()
|