atomic: PEP8 compliancy and doc fixes (#30918)
This PR includes: - PEP8 compliancy fixes - Documentation fixespull/4420/head
parent
3ffc62b43b
commit
bedfd0a5a4
|
@ -7,43 +7,40 @@
|
||||||
from __future__ import absolute_import, division, print_function
|
from __future__ import absolute_import, division, print_function
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
'supported_by': 'community'}
|
'supported_by': 'community'}
|
||||||
|
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: atomic_host
|
module: atomic_host
|
||||||
short_description: Manage the atomic host platform
|
short_description: Manage the atomic host platform
|
||||||
description:
|
description:
|
||||||
- Manage the atomic host platform
|
- Manage the atomic host platform.
|
||||||
- Rebooting of Atomic host platform should be done outside this module
|
- Rebooting of Atomic host platform should be done outside this module.
|
||||||
version_added: "2.2"
|
version_added: "2.2"
|
||||||
author: "Saravanan KR @krsacme"
|
author:
|
||||||
|
- Saravanan KR (@krsacme)
|
||||||
notes:
|
notes:
|
||||||
- Host should be an atomic platform (verified by existence of '/run/ostree-booted' file)
|
- Host should be an atomic platform (verified by existence of '/run/ostree-booted' file).
|
||||||
requirements:
|
requirements:
|
||||||
- atomic
|
- atomic
|
||||||
- "python >= 2.6"
|
- python >= 2.6
|
||||||
options:
|
options:
|
||||||
revision:
|
revision:
|
||||||
description:
|
description:
|
||||||
- The version number of the atomic host to be deployed. Providing C(latest) will upgrade to the latest available version.
|
- The version number of the atomic host to be deployed. Providing C(latest) will upgrade to the latest available version.
|
||||||
required: false
|
|
||||||
default: latest
|
default: latest
|
||||||
aliases: ["version"]
|
aliases: [ version ]
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
|
- name: Upgrade the atomic host platform to the latest version (atomic host upgrade)
|
||||||
# Upgrade the atomic host platform to the latest version (atomic host upgrade)
|
atomic_host:
|
||||||
- atomic_host:
|
|
||||||
revision: latest
|
revision: latest
|
||||||
|
|
||||||
# Deploy a specific revision as the atomic host (atomic host deploy 23.130)
|
- name: Deploy a specific revision as the atomic host (atomic host deploy 23.130)
|
||||||
- atomic_host:
|
atomic_host:
|
||||||
revision: 23.130
|
revision: 23.130
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
@ -89,9 +86,9 @@ def core(module):
|
||||||
def main():
|
def main():
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec=dict(
|
argument_spec=dict(
|
||||||
revision=dict(default='latest', required=False, aliases=["version"]),
|
revision=dict(type='str', default='latest', aliases=["version"]),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
# Verify that the platform is atomic host
|
# Verify that the platform is atomic host
|
||||||
if not os.path.exists("/run/ostree-booted"):
|
if not os.path.exists("/run/ostree-booted"):
|
||||||
|
|
|
@ -7,63 +7,56 @@
|
||||||
from __future__ import absolute_import, division, print_function
|
from __future__ import absolute_import, division, print_function
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
|
|
||||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||||
'status': ['preview'],
|
'status': ['preview'],
|
||||||
'supported_by': 'community'}
|
'supported_by': 'community'}
|
||||||
|
|
||||||
|
|
||||||
DOCUMENTATION = '''
|
DOCUMENTATION = '''
|
||||||
---
|
---
|
||||||
module: atomic_image
|
module: atomic_image
|
||||||
short_description: Manage the container images on the atomic host platform
|
short_description: Manage the container images on the atomic host platform
|
||||||
description:
|
description:
|
||||||
- Manage the container images on the atomic host platform
|
- Manage the container images on the atomic host platform.
|
||||||
- Allows to execute the commands specified by the RUN label in the container image when present
|
- Allows to execute the commands specified by the RUN label in the container image when present.
|
||||||
version_added: "2.2"
|
version_added: "2.2"
|
||||||
author: "Saravanan KR @krsacme"
|
author:
|
||||||
|
- Saravanan KR (@krsacme)
|
||||||
notes:
|
notes:
|
||||||
- Host should support C(atomic) command
|
- Host should support C(atomic) command.
|
||||||
requirements:
|
requirements:
|
||||||
- atomic
|
- atomic
|
||||||
- "python >= 2.6"
|
- python >= 2.6
|
||||||
options:
|
options:
|
||||||
backend:
|
backend:
|
||||||
description:
|
description:
|
||||||
- Define the backend where the image is pulled.
|
- Define the backend where the image is pulled.
|
||||||
required: False
|
choices: [ docker, ostree ]
|
||||||
choices: ["docker", "ostree"]
|
|
||||||
default: None
|
|
||||||
version_added: "2.4"
|
version_added: "2.4"
|
||||||
name:
|
name:
|
||||||
description:
|
description:
|
||||||
- Name of the container image
|
- Name of the container image.
|
||||||
required: True
|
required: True
|
||||||
default: null
|
|
||||||
state:
|
state:
|
||||||
description:
|
description:
|
||||||
- The state of the container image.
|
- The state of the container image.
|
||||||
- The state C(latest) will ensure container image is upgraded to the latest version and forcefully restart container, if running.
|
- The state C(latest) will ensure container image is upgraded to the latest version and forcefully restart container, if running.
|
||||||
required: False
|
choices: [ absent, latest, present ]
|
||||||
choices: ["present", "absent", "latest"]
|
|
||||||
default: latest
|
default: latest
|
||||||
started:
|
started:
|
||||||
description:
|
description:
|
||||||
- Start or Stop the container
|
- Start or Stop the container.
|
||||||
required: False
|
type: bool
|
||||||
choices: ["yes", "no"]
|
default: 'yes'
|
||||||
default: yes
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
|
- name: Execute the run command on rsyslog container image (atomic run rhel7/rsyslog)
|
||||||
# Execute the run command on rsyslog container image (atomic run rhel7/rsyslog)
|
atomic_image:
|
||||||
- atomic_image:
|
|
||||||
name: rhel7/rsyslog
|
name: rhel7/rsyslog
|
||||||
state: latest
|
state: latest
|
||||||
|
|
||||||
# Pull busybox to the OSTree backend
|
- name: Pull busybox to the OSTree backend
|
||||||
- atomic_image:
|
atomic_image:
|
||||||
name: busybox
|
name: busybox
|
||||||
state: latest
|
state: latest
|
||||||
backend: ostree
|
backend: ostree
|
||||||
|
@ -85,7 +78,7 @@ from ansible.module_utils._text import to_native
|
||||||
def do_upgrade(module, image):
|
def do_upgrade(module, image):
|
||||||
args = ['atomic', 'update', '--force', image]
|
args = ['atomic', 'update', '--force', image]
|
||||||
rc, out, err = module.run_command(args, check_rc=False)
|
rc, out, err = module.run_command(args, check_rc=False)
|
||||||
if rc != 0: # something went wrong emit the msg
|
if rc != 0: # something went wrong emit the msg
|
||||||
module.fail_json(rc=rc, msg=err)
|
module.fail_json(rc=rc, msg=err)
|
||||||
elif 'Image is up to date' in out:
|
elif 'Image is up to date' in out:
|
||||||
return False
|
return False
|
||||||
|
@ -122,7 +115,7 @@ def core(module):
|
||||||
changed = "Extracting" in out or "Copying blob" in out
|
changed = "Extracting" in out or "Copying blob" in out
|
||||||
module.exit_json(msg=(out + out_run), changed=changed)
|
module.exit_json(msg=(out + out_run), changed=changed)
|
||||||
elif state == 'absent':
|
elif state == 'absent':
|
||||||
args = ['atomic', 'images', 'delete', "--storage=%s" % backend, image]
|
args = ['atomic', 'images', 'delete', "--storage=%s" % backend, image]
|
||||||
if rc < 0:
|
if rc < 0:
|
||||||
module.fail_json(rc=rc, msg=err)
|
module.fail_json(rc=rc, msg=err)
|
||||||
else:
|
else:
|
||||||
|
@ -156,12 +149,12 @@ def core(module):
|
||||||
def main():
|
def main():
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec=dict(
|
argument_spec=dict(
|
||||||
backend=dict(default=None, choices=['docker', 'ostree']),
|
backend=dict(type='str', choices=['docker', 'ostree']),
|
||||||
name=dict(default=None, required=True),
|
name=dict(type='str', required=True),
|
||||||
state=dict(default='latest', choices=['present', 'absent', 'latest']),
|
state=dict(type='str', default='latest', choices=['absent', 'latest', 'present']),
|
||||||
started=dict(default='yes', type='bool'),
|
started=dict(type='bool', default=True),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
# Verify that the platform supports atomic command
|
# Verify that the platform supports atomic command
|
||||||
rc, out, err = module.run_command('atomic -v', check_rc=False)
|
rc, out, err = module.run_command('atomic -v', check_rc=False)
|
||||||
|
|
|
@ -57,8 +57,6 @@ lib/ansible/modules/cloud/amazon/s3_website.py
|
||||||
lib/ansible/modules/cloud/amazon/sns_topic.py
|
lib/ansible/modules/cloud/amazon/sns_topic.py
|
||||||
lib/ansible/modules/cloud/amazon/sts_assume_role.py
|
lib/ansible/modules/cloud/amazon/sts_assume_role.py
|
||||||
lib/ansible/modules/cloud/amazon/sts_session_token.py
|
lib/ansible/modules/cloud/amazon/sts_session_token.py
|
||||||
lib/ansible/modules/cloud/atomic/atomic_host.py
|
|
||||||
lib/ansible/modules/cloud/atomic/atomic_image.py
|
|
||||||
lib/ansible/modules/cloud/azure/azure_rm_deployment.py
|
lib/ansible/modules/cloud/azure/azure_rm_deployment.py
|
||||||
lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py
|
lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py
|
||||||
lib/ansible/modules/cloud/azure/azure_rm_publicipaddress.py
|
lib/ansible/modules/cloud/azure/azure_rm_publicipaddress.py
|
||||||
|
|
Loading…
Reference in New Issue