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/commands/manage.py
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# SPDX-License-Identifier: Apache-2.0
|
2
2
|
|
3
|
-
import os
|
4
3
|
from re import findall
|
5
|
-
import subprocess
|
6
4
|
from urllib.parse import urljoin
|
7
5
|
|
8
6
|
from cliff.command import Command
|
@@ -12,6 +10,7 @@ from loguru import logger
|
|
12
10
|
import requests
|
13
11
|
|
14
12
|
from osism.data import TEMPLATE_IMAGE_CLUSTERAPI, TEMPLATE_IMAGE_OCTAVIA
|
13
|
+
from osism.tasks import openstack, handle_task
|
15
14
|
|
16
15
|
SUPPORTED_CLUSTERAPI_K8S_IMAGES = ["1.29", "1.30", "1.31"]
|
17
16
|
|
@@ -20,6 +19,12 @@ class ImageClusterapi(Command):
|
|
20
19
|
def get_parser(self, prog_name):
|
21
20
|
parser = super(ImageClusterapi, self).get_parser(prog_name)
|
22
21
|
|
22
|
+
parser.add_argument(
|
23
|
+
"--no-wait",
|
24
|
+
default=False,
|
25
|
+
help="Do not wait until image management has been completed",
|
26
|
+
action="store_true",
|
27
|
+
)
|
23
28
|
parser.add_argument(
|
24
29
|
"--base-url",
|
25
30
|
type=str,
|
@@ -56,13 +61,14 @@ class ImageClusterapi(Command):
|
|
56
61
|
cloud = parsed_args.cloud
|
57
62
|
filter = parsed_args.filter
|
58
63
|
tag = parsed_args.tag
|
64
|
+
wait = not parsed_args.no_wait
|
59
65
|
|
60
66
|
if filter:
|
61
67
|
supported_cluterapi_k8s_images = [filter]
|
62
68
|
else:
|
63
69
|
supported_cluterapi_k8s_images = SUPPORTED_CLUSTERAPI_K8S_IMAGES
|
64
70
|
|
65
|
-
|
71
|
+
result = []
|
66
72
|
for kubernetes_release in supported_cluterapi_k8s_images:
|
67
73
|
url = urljoin(base_url, f"last-{kubernetes_release}")
|
68
74
|
|
@@ -84,18 +90,18 @@ class ImageClusterapi(Command):
|
|
84
90
|
logger.info(f"checksum: {splitted_checksum[0]}")
|
85
91
|
|
86
92
|
template = Template(TEMPLATE_IMAGE_CLUSTERAPI)
|
87
|
-
result
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
93
|
+
result.extend(
|
94
|
+
[
|
95
|
+
template.render(
|
96
|
+
image_url=url,
|
97
|
+
image_checksum=f"sha256:{splitted_checksum[0]}",
|
98
|
+
image_version=r[0].strip(),
|
99
|
+
image_builddate=splitted[0],
|
100
|
+
)
|
101
|
+
]
|
92
102
|
)
|
93
|
-
with open(f"/tmp/clusterapi/k8s-{kubernetes_release}.yml", "w+") as fp:
|
94
|
-
fp.write(result)
|
95
103
|
|
96
104
|
args = [
|
97
|
-
"openstack-image-manager",
|
98
|
-
"--images=/tmp/clusterapi",
|
99
105
|
"--cloud",
|
100
106
|
cloud,
|
101
107
|
"--filter",
|
@@ -105,15 +111,32 @@ class ImageClusterapi(Command):
|
|
105
111
|
args.extend(["--tag", tag])
|
106
112
|
if parsed_args.dry_run:
|
107
113
|
args.append("--dry-run")
|
108
|
-
|
114
|
+
|
115
|
+
task_signature = openstack.image_manager.si(*args, configs=result)
|
116
|
+
task = task_signature.apply_async()
|
117
|
+
if wait:
|
118
|
+
logger.info(
|
119
|
+
f"It takes a moment until task {task.task_id} (image-manager) has been started and output is visible here."
|
120
|
+
)
|
121
|
+
|
122
|
+
return handle_task(task, wait, format="script", timeout=3600)
|
109
123
|
|
110
124
|
|
111
125
|
class ImageOctavia(Command):
|
112
126
|
def get_parser(self, prog_name):
|
113
127
|
parser = super(ImageOctavia, self).get_parser(prog_name)
|
128
|
+
parser.add_argument(
|
129
|
+
"--no-wait",
|
130
|
+
default=False,
|
131
|
+
help="Do not wait until image management has been completed",
|
132
|
+
action="store_true",
|
133
|
+
)
|
114
134
|
|
115
135
|
parser.add_argument(
|
116
|
-
"--cloud",
|
136
|
+
"--cloud",
|
137
|
+
type=str,
|
138
|
+
help="Cloud name in clouds.yaml (will be overruled by OS_AUTH_URL envvar)",
|
139
|
+
default="octavia",
|
117
140
|
)
|
118
141
|
parser.add_argument(
|
119
142
|
"--base-url",
|
@@ -124,6 +147,7 @@ class ImageOctavia(Command):
|
|
124
147
|
return parser
|
125
148
|
|
126
149
|
def take_action(self, parsed_args):
|
150
|
+
wait = not parsed_args.no_wait
|
127
151
|
cloud = parsed_args.cloud
|
128
152
|
base_url = parsed_args.base_url
|
129
153
|
|
@@ -147,21 +171,31 @@ class ImageOctavia(Command):
|
|
147
171
|
logger.info(f"checksum: {splitted_checksum[0]}")
|
148
172
|
|
149
173
|
template = Template(TEMPLATE_IMAGE_OCTAVIA)
|
150
|
-
result =
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
174
|
+
result = []
|
175
|
+
result.extend(
|
176
|
+
[
|
177
|
+
template.render(
|
178
|
+
image_url=url,
|
179
|
+
image_checksum=f"sha256:{splitted_checksum[0]}",
|
180
|
+
image_version=splitted[0],
|
181
|
+
image_builddate=splitted[0],
|
182
|
+
)
|
183
|
+
]
|
155
184
|
)
|
185
|
+
arguments = [
|
186
|
+
"--cloud",
|
187
|
+
cloud,
|
188
|
+
"--deactivate",
|
189
|
+
]
|
156
190
|
|
157
|
-
|
158
|
-
|
159
|
-
|
191
|
+
task_signature = openstack.image_manager.si(*arguments, configs=result)
|
192
|
+
task = task_signature.apply_async()
|
193
|
+
if wait:
|
194
|
+
logger.info(
|
195
|
+
f"It takes a moment until task {task.task_id} (image-manager) has been started and output is visible here."
|
196
|
+
)
|
160
197
|
|
161
|
-
|
162
|
-
"/usr/local/bin/openstack-image-manager --images=/tmp/octavia --cloud octavia --deactivate",
|
163
|
-
shell=True,
|
164
|
-
)
|
198
|
+
return handle_task(task, wait, format="script", timeout=3600)
|
165
199
|
|
166
200
|
|
167
201
|
class Images(Command):
|
@@ -173,6 +207,12 @@ class Images(Command):
|
|
173
207
|
# to typer. Then openstack-image-manager can simply be included directly at this
|
174
208
|
# point.
|
175
209
|
|
210
|
+
parser.add_argument(
|
211
|
+
"--no-wait",
|
212
|
+
default=False,
|
213
|
+
help="Do not wait until image management has been completed",
|
214
|
+
action="store_true",
|
215
|
+
)
|
176
216
|
parser.add_argument(
|
177
217
|
"--dry-run",
|
178
218
|
default=False,
|
@@ -185,6 +225,12 @@ class Images(Command):
|
|
185
225
|
help="Hide images that should be deleted",
|
186
226
|
action="store_true",
|
187
227
|
)
|
228
|
+
parser.add_argument(
|
229
|
+
"--delete",
|
230
|
+
default=False,
|
231
|
+
help="Delete images that should be deleted",
|
232
|
+
action="store_true",
|
233
|
+
)
|
188
234
|
parser.add_argument(
|
189
235
|
"--latest",
|
190
236
|
default=False,
|
@@ -210,35 +256,39 @@ class Images(Command):
|
|
210
256
|
return parser
|
211
257
|
|
212
258
|
def take_action(self, parsed_args):
|
213
|
-
|
214
|
-
dry_run = parsed_args.dry_run
|
215
|
-
filter = parsed_args.filter
|
216
|
-
hide = parsed_args.hide
|
217
|
-
latest = parsed_args.latest
|
218
|
-
images = parsed_args.images
|
259
|
+
wait = not parsed_args.no_wait
|
219
260
|
|
220
261
|
arguments = []
|
221
|
-
if cloud:
|
222
|
-
arguments.append(
|
223
|
-
|
224
|
-
|
225
|
-
|
262
|
+
if parsed_args.cloud:
|
263
|
+
arguments.append("--cloud")
|
264
|
+
arguments.append(parsed_args.cloud)
|
265
|
+
if parsed_args.filter:
|
266
|
+
arguments.append("--filter")
|
267
|
+
arguments.append(parsed_args.filter)
|
268
|
+
if parsed_args.delete:
|
269
|
+
arguments.append("--delete")
|
270
|
+
arguments.append("--yes-i-really-know-what-i-do")
|
271
|
+
if parsed_args.dry_run:
|
226
272
|
arguments.append("--dry-run")
|
227
|
-
if latest:
|
273
|
+
if parsed_args.latest:
|
228
274
|
arguments.append("--latest")
|
229
|
-
if hide:
|
275
|
+
if parsed_args.hide:
|
230
276
|
arguments.append("--hide")
|
231
277
|
|
232
|
-
|
233
|
-
|
278
|
+
arguments.append("--images")
|
279
|
+
if parsed_args.images:
|
280
|
+
arguments.append(parsed_args.images)
|
234
281
|
else:
|
235
|
-
arguments.append("
|
282
|
+
arguments.append("/etc/images")
|
236
283
|
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
284
|
+
task_signature = openstack.image_manager.si(*arguments)
|
285
|
+
task = task_signature.apply_async()
|
286
|
+
if wait:
|
287
|
+
logger.info(
|
288
|
+
f"It takes a moment until task {task.task_id} (image-manager) has been started and output is visible here."
|
289
|
+
)
|
290
|
+
|
291
|
+
return handle_task(task, wait, format="script", timeout=3600)
|
242
292
|
|
243
293
|
|
244
294
|
class Flavors(Command):
|
@@ -250,6 +300,12 @@ class Flavors(Command):
|
|
250
300
|
# to typer. Then openstack-flavor-manager can simply be included directly at this
|
251
301
|
# point.
|
252
302
|
|
303
|
+
parser.add_argument(
|
304
|
+
"--no-wait",
|
305
|
+
default=False,
|
306
|
+
help="Do not wait until flavor management has been completed",
|
307
|
+
action="store_true",
|
308
|
+
)
|
253
309
|
parser.add_argument(
|
254
310
|
"--cloud", type=str, help="Cloud name in clouds.yaml", default="admin"
|
255
311
|
)
|
@@ -276,23 +332,29 @@ class Flavors(Command):
|
|
276
332
|
return parser
|
277
333
|
|
278
334
|
def take_action(self, parsed_args):
|
335
|
+
wait = not parsed_args.no_wait
|
279
336
|
cloud = parsed_args.cloud
|
280
337
|
name = parsed_args.name
|
281
338
|
recommended = parsed_args.recommended
|
282
339
|
url = parsed_args.url
|
283
340
|
|
284
|
-
arguments = [
|
341
|
+
arguments = ["--name", name]
|
285
342
|
if cloud:
|
286
|
-
arguments.append(
|
343
|
+
arguments.append("--cloud")
|
344
|
+
arguments.append(cloud)
|
287
345
|
|
288
346
|
if recommended:
|
289
347
|
arguments.append("--recommended")
|
290
348
|
|
291
349
|
if url:
|
292
|
-
arguments.append(
|
350
|
+
arguments.append("--url")
|
351
|
+
arguments.append(url)
|
352
|
+
|
353
|
+
task_signature = openstack.flavor_manager.si(*arguments)
|
354
|
+
task = task_signature.apply_async()
|
355
|
+
if wait:
|
356
|
+
logger.info(
|
357
|
+
f"It takes a moment until task {task.task_id} (flavor-manager) has been started and output is visible here."
|
358
|
+
)
|
293
359
|
|
294
|
-
|
295
|
-
subprocess.call(
|
296
|
-
f"/usr/local/bin/openstack-flavor-manager {joined_arguments}",
|
297
|
-
shell=True,
|
298
|
-
)
|
360
|
+
return handle_task(task, wait, format="script", timeout=3600)
|