Files
ports/sysutils/salt/patches/patch-salt_modules_vmctl_py
2024-08-04 05:58:23 +00:00

46 lines
1.2 KiB
Plaintext

Fix order of argument for vmctl(8)
https://github.com/saltstack/salt/pull/57984
Index: salt/modules/vmctl.py
--- salt/modules/vmctl.py.orig
+++ salt/modules/vmctl.py
@@ -59,8 +59,9 @@ def create_disk(name, size):
salt '*' vmctl.create_disk /path/to/disk.img size=10G
"""
ret = False
- cmd = f"vmctl create {name} -s {size}"
+ cmd = f"vmctl create -s {size} {name}"
+
result = __salt__["cmd.run_all"](cmd, output_loglevel="trace", python_shell=False)
if result["retcode"] == 0:
@@ -219,12 +220,7 @@ def start(
if not (name or id):
raise SaltInvocationError('Must provide either "name" or "id"')
- elif name:
- cmd.append(name)
- else:
- cmd.append(id)
- name = _id_to_name(id)
-
+
if nics > 0:
cmd.append(f"-i {nics}")
@@ -250,6 +246,13 @@ def start(
if disks:
cmd.extend(["-d", x] for x in disks)
+
+ if name:
+ cmd.append(name)
+ else:
+ cmd.append(id)
+ name = _id_to_name(id)
+ log.warning(f'cmd: {cmd}')
# Before attempting to define a new VM, make sure it doesn't already exist.
# Otherwise return to indicate nothing was changed.