smartos imgadm man page reference (#11071)

This commit is contained in:
Alexei Znamensky
2025-11-10 14:08:06 +13:00
committed by GitHub
parent 0175d75a7c
commit 60828e82a4
2 changed files with 15 additions and 7 deletions

View File

@@ -11,7 +11,7 @@ DOCUMENTATION = r"""
module: imgadm module: imgadm
short_description: Manage SmartOS images short_description: Manage SmartOS images
description: description:
- Manage SmartOS virtual machine images through imgadm(1M). - Manage SmartOS virtual machine images through imgadm(8).
author: Jasper Lievisse Adriaanse (@jasperla) author: Jasper Lievisse Adriaanse (@jasperla)
extends_documentation_fragment: extends_documentation_fragment:
- community.general.attributes - community.general.attributes
@@ -24,7 +24,7 @@ options:
force: force:
type: bool type: bool
description: description:
- Force a given operation (where supported by imgadm(1M)). - Force a given operation (where supported by imgadm(8)).
pool: pool:
default: zones default: zones
description: description:
@@ -53,6 +53,10 @@ options:
description: description:
- Image UUID. Can either be a full UUID or V(*) for all images. - Image UUID. Can either be a full UUID or V(*) for all images.
type: str type: str
seealso:
- name: imgadm(8)
description: Complete manual page for the command C(imgadm).
link: https://smartos.org/man/8/imgadm
""" """
EXAMPLES = r""" EXAMPLES = r"""
@@ -115,7 +119,7 @@ import re
from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.basic import AnsibleModule
# Shortcut for the imgadm(1M) command. While imgadm(1M) supports a # Shortcut for the imgadm(8) command. While imgadm(8) supports a
# -E option to return any errors in JSON, the generated JSON does not play well # -E option to return any errors in JSON, the generated JSON does not play well
# with the JSON parsers of Python. The returned message contains '\n' as part of # with the JSON parsers of Python. The returned message contains '\n' as part of
# the stacktrace, which breaks the parsers. # the stacktrace, which breaks the parsers.
@@ -160,7 +164,7 @@ class Imgadm:
if rc != 0: if rc != 0:
self.module.fail_json(msg=f"Failed to update images: {self.errmsg(stderr)}") self.module.fail_json(msg=f"Failed to update images: {self.errmsg(stderr)}")
# There is no feedback from imgadm(1M) to determine if anything # There is no feedback from imgadm(8) to determine if anything
# was actually changed. So treat this as an 'always-changes' operation. # was actually changed. So treat this as an 'always-changes' operation.
# Note that 'imgadm -v' produces unparsable JSON... # Note that 'imgadm -v' produces unparsable JSON...
self.changed = True self.changed = True
@@ -194,7 +198,7 @@ class Imgadm:
if re.match(regex, stdout): if re.match(regex, stdout):
self.changed = True self.changed = True
else: else:
# Type is ignored by imgadm(1M) here # Type is ignored by imgadm(8) here
cmd += f" -d {source}" cmd += f" -d {source}"
(rc, stdout, stderr) = self.module.run_command(cmd) (rc, stdout, stderr) = self.module.run_command(cmd)
@@ -269,7 +273,7 @@ def main():
type=dict(default="imgapi", choices=["imgapi", "docker", "dsapi"]), type=dict(default="imgapi", choices=["imgapi", "docker", "dsapi"]),
uuid=dict(), uuid=dict(),
), ),
# This module relies largely on imgadm(1M) to enforce idempotency, which does not # This module relies largely on imgadm(8) to enforce idempotency, which does not
# provide a "noop" (or equivalent) mode to do a dry-run. # provide a "noop" (or equivalent) mode to do a dry-run.
supports_check_mode=False, supports_check_mode=False,
) )

View File

@@ -25,8 +25,12 @@ options:
description: description:
- Criteria for selecting image. Can be any value from image manifest and V(published_date), V(published), V(source), - Criteria for selecting image. Can be any value from image manifest and V(published_date), V(published), V(source),
V(clones), and V(size). V(clones), and V(size).
- More information can be found at U(https://smartos.org/man/1m/imgadm) under C(imgadm list). - More information can be found at U(https://smartos.org/man/8/imgadm) under C(imgadm list).
type: str type: str
seealso:
- name: imgadm(8)
description: Complete manual page for the command C(imgadm).
link: https://smartos.org/man/8/imgadm
""" """
EXAMPLES = r""" EXAMPLES = r"""