1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

kubevirt: cleanup module docs (#54119)

This commit is contained in:
Mariusz Mazur 2019-03-26 22:22:50 +01:00 committed by René Moser
parent 5d32dbd532
commit 53b56825cd
6 changed files with 50 additions and 56 deletions

View file

@ -24,20 +24,20 @@ API_GROUP = 'kubevirt.io'
VM_COMMON_ARG_SPEC = { VM_COMMON_ARG_SPEC = {
'name': {}, 'name': {'required': True},
'namespace': {'required': True},
'state': {
'default': 'present',
'choices': ['present', 'absent'],
},
'force': { 'force': {
'type': 'bool', 'type': 'bool',
'default': False, 'default': False,
}, },
'resource_definition': { 'resource_definition': {
'type': list_dict_str, 'type': 'dict',
'aliases': ['definition', 'inline'] 'aliases': ['definition', 'inline']
}, },
'src': {
'type': 'path',
},
'namespace': {},
'api_version': {'type': 'str', 'default': '%s/%s' % (API_GROUP, MAX_SUPPORTED_API_VERSION), 'aliases': ['api', 'version']},
'merge_type': {'type': 'list', 'choices': ['json', 'merge', 'strategic-merge']}, 'merge_type': {'type': 'list', 'choices': ['json', 'merge', 'strategic-merge']},
'wait': {'type': 'bool', 'default': True}, 'wait': {'type': 'bool', 'default': True},
'wait_timeout': {'type': 'int', 'default': 120}, 'wait_timeout': {'type': 'int', 'default': 120},

View file

@ -51,7 +51,6 @@ options:
extends_documentation_fragment: extends_documentation_fragment:
- k8s_auth_options - k8s_auth_options
- k8s_resource_options
- kubevirt_vm_options - kubevirt_vm_options
- kubevirt_common_options - kubevirt_common_options
@ -93,7 +92,7 @@ import copy
import traceback import traceback
from ansible.module_utils.k8s.common import AUTH_ARG_SPEC, COMMON_ARG_SPEC from ansible.module_utils.k8s.common import AUTH_ARG_SPEC
from ansible.module_utils.kubevirt import ( from ansible.module_utils.kubevirt import (
virtdict, virtdict,
@ -113,8 +112,7 @@ class KubeVirtVMPreset(KubeVirtRawModule):
@property @property
def argspec(self): def argspec(self):
""" argspec property builder """ """ argspec property builder """
argument_spec = copy.deepcopy(COMMON_ARG_SPEC) argument_spec = copy.deepcopy(AUTH_ARG_SPEC)
argument_spec.update(copy.deepcopy(AUTH_ARG_SPEC))
argument_spec.update(VM_COMMON_ARG_SPEC) argument_spec.update(VM_COMMON_ARG_SPEC)
argument_spec.update(VMP_ARG_SPEC) argument_spec.update(VMP_ARG_SPEC)
return argument_spec return argument_spec

View file

@ -57,7 +57,6 @@ options:
extends_documentation_fragment: extends_documentation_fragment:
- k8s_auth_options - k8s_auth_options
- k8s_resource_options
- kubevirt_vm_options - kubevirt_vm_options
- kubevirt_common_options - kubevirt_common_options
@ -112,7 +111,7 @@ import copy
import traceback import traceback
from ansible.module_utils.k8s.common import AUTH_ARG_SPEC, COMMON_ARG_SPEC from ansible.module_utils.k8s.common import AUTH_ARG_SPEC
try: try:
from openshift.dynamic.client import ResourceInstance from openshift.dynamic.client import ResourceInstance
@ -139,8 +138,7 @@ class KubeVirtVMIRS(KubeVirtRawModule):
@property @property
def argspec(self): def argspec(self):
""" argspec property builder """ """ argspec property builder """
argument_spec = copy.deepcopy(COMMON_ARG_SPEC) argument_spec = copy.deepcopy(AUTH_ARG_SPEC)
argument_spec.update(copy.deepcopy(AUTH_ARG_SPEC))
argument_spec.update(copy.deepcopy(VM_COMMON_ARG_SPEC)) argument_spec.update(copy.deepcopy(VM_COMMON_ARG_SPEC))
argument_spec.update(copy.deepcopy(VMIR_ARG_SPEC)) argument_spec.update(copy.deepcopy(VMIR_ARG_SPEC))
return argument_spec return argument_spec

View file

@ -26,6 +26,16 @@ version_added: "2.8"
author: KubeVirt Team (@kubevirt) author: KubeVirt Team (@kubevirt)
options: options:
name:
description:
- Name of the Template object.
required: true
type: str
namespace:
description:
- Namespace where the Template object exists.
required: true
type: str
objects: objects:
description: description:
- List of any valid API objects, such as a I(DeploymentConfig), I(Service), etc. The object - List of any valid API objects, such as a I(DeploymentConfig), I(Service), etc. The object
@ -129,9 +139,7 @@ options:
extends_documentation_fragment: extends_documentation_fragment:
- k8s_auth_options - k8s_auth_options
- k8s_resource_options
- k8s_state_options - k8s_state_options
- k8s_name_options
requirements: requirements:
- python >= 2.7 - python >= 2.7
@ -197,7 +205,7 @@ kubevirt_template:
import copy import copy
import traceback import traceback
from ansible.module_utils.k8s.common import AUTH_ARG_SPEC, COMMON_ARG_SPEC from ansible.module_utils.k8s.common import AUTH_ARG_SPEC
from ansible.module_utils.kubevirt import ( from ansible.module_utils.kubevirt import (
virtdict, virtdict,
@ -207,12 +215,15 @@ from ansible.module_utils.kubevirt import (
TEMPLATE_ARG_SPEC = { TEMPLATE_ARG_SPEC = {
'name': {'required': True},
'namespace': {'required': True},
'state': { 'state': {
'type': 'str', 'default': 'present',
'choices': [ 'choices': ['present', 'absent'],
'present', 'absent' },
], 'force': {
'default': 'present' 'type': 'bool',
'default': False,
}, },
'merge_type': { 'merge_type': {
'type': 'list', 'type': 'list',
@ -271,8 +282,7 @@ class KubeVirtVMTemplate(KubeVirtRawModule):
@property @property
def argspec(self): def argspec(self):
""" argspec property builder """ """ argspec property builder """
argument_spec = copy.deepcopy(COMMON_ARG_SPEC) argument_spec = copy.deepcopy(AUTH_ARG_SPEC)
argument_spec.update(copy.deepcopy(AUTH_ARG_SPEC))
argument_spec.update(TEMPLATE_ARG_SPEC) argument_spec.update(TEMPLATE_ARG_SPEC)
return argument_spec return argument_spec

View file

@ -65,7 +65,6 @@ options:
extends_documentation_fragment: extends_documentation_fragment:
- k8s_auth_options - k8s_auth_options
- k8s_resource_options
- kubevirt_vm_options - kubevirt_vm_options
- kubevirt_common_options - kubevirt_common_options
@ -210,7 +209,7 @@ kubevirt_vm:
import copy import copy
import traceback import traceback
from ansible.module_utils.k8s.common import AUTH_ARG_SPEC, COMMON_ARG_SPEC from ansible.module_utils.k8s.common import AUTH_ARG_SPEC
try: try:
from openshift.dynamic.client import ResourceInstance from openshift.dynamic.client import ResourceInstance
@ -243,8 +242,7 @@ class KubeVirtVM(KubeVirtRawModule):
@property @property
def argspec(self): def argspec(self):
""" argspec property builder """ """ argspec property builder """
argument_spec = copy.deepcopy(COMMON_ARG_SPEC) argument_spec = copy.deepcopy(AUTH_ARG_SPEC)
argument_spec.update(copy.deepcopy(AUTH_ARG_SPEC))
argument_spec.update(VM_COMMON_ARG_SPEC) argument_spec.update(VM_COMMON_ARG_SPEC)
argument_spec.update(VM_ARG_SPEC) argument_spec.update(VM_ARG_SPEC)
return argument_spec return argument_spec

View file

@ -5,21 +5,23 @@
class ModuleDocFragment(object): class ModuleDocFragment(object):
# Standard oVirt documentation fragment
DOCUMENTATION = r''' DOCUMENTATION = r'''
options: options:
resource_definition:
description:
- "A partial YAML definition of the object being created/updated. Here you can define Kubernetes
resource parameters not covered by this module's parameters."
- "NOTE: I(resource_definition) has lower priority than module parameters. If you try to define e.g.
I(metadata.namespace) here, that value will be ignored and I(namespace) used instead."
aliases:
- definition
- inline
type: dict
wait: wait:
description: description:
- "I(True) if the module should wait for the resource to get into desired state." - "I(True) if the module should wait for the resource to get into desired state."
type: bool type: bool
default: yes default: yes
kind:
description:
- Use to specify an object model. Use to create, delete, or discover an object without providing a full
resource definition. Use in conjunction with I(api_version), I(name), and I(namespace) to identify a
specific object. If I(resource definition) is provided, the I(kind) from the I(resource_definition)
will override this option.
force: force:
description: description:
- If set to C(no), and I(state) is C(present), an existing object will be replaced. - If set to C(no), and I(state) is C(present), an existing object will be replaced.
@ -30,14 +32,6 @@ options:
- The amount of time in seconds the module should wait for the resource to get into desired state. - The amount of time in seconds the module should wait for the resource to get into desired state.
type: int type: int
default: 120 default: 120
api_version:
description:
- "Specify the API version to be used."
type: str
default: kubevirt.io/v1alpha3
aliases:
- api
- version
memory: memory:
description: description:
- The amount of memory to be requested by virtual machine. - The amount of memory to be requested by virtual machine.
@ -54,16 +48,12 @@ options:
type: str type: str
merge_type: merge_type:
description: description:
- Whether to override the default patch merge approach with a specific type. By default, the strategic - Whether to override the default patch merge approach with a specific type.
merge will typically be used. - If more than one merge type is given, the merge types will be tried in order.
- For example, Custom Resource Definitions typically aren't updatable by the usual strategic merge. You may - "Defaults to C(['strategic-merge', 'merge']), which is ideal for using the same parameters
want to use C(merge) if you see "strategic merge patch format is not supported" on resource kinds that combine Custom Resources and built-in resources, as
- See U(https://kubernetes.io/docs/tasks/run-application/update-api-object-kubectl-patch/#use-a-json-merge-patch-to-update-a-deployment) Custom Resource Definitions typically aren't updatable by the usual strategic merge."
- Requires openshift >= 0.6.2 - "See U(https://kubernetes.io/docs/tasks/run-application/update-api-object-kubectl-patch/#use-a-json-merge-patch-to-update-a-deployment)"
- If more than one merge_type is given, the merge_types will be tried in order
- If openshift >= 0.6.2, this defaults to C(['strategic-merge', 'merge']), which is ideal for using the same parameters
on resource kinds that combine Custom Resources and built-in resources. For openshift < 0.6.2, the default
is simply C(strategic-merge).
type: list type: list
choices: [ json, merge, strategic-merge ] choices: [ json, merge, strategic-merge ]
cpu_shares: cpu_shares:
@ -122,5 +112,5 @@ requirements:
notes: notes:
- "In order to use this module you have to install Openshift Python SDK. - "In order to use this module you have to install Openshift Python SDK.
To ensure it's installed with correct version you can create the following task: To ensure it's installed with correct version you can create the following task:
I(pip: name=openshift version=0.8.2)" I(pip: name=openshift>=0.8.2)"
''' '''