mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-06-16 04:47:30 +00:00
move common argument specs to shared module_utils
This commit is contained in:
parent
91ef50cef7
commit
125dc6f5e2
3 changed files with 35 additions and 33 deletions
|
|
@ -323,6 +323,7 @@ from ansible.module_utils.basic import AnsibleModule, json_dict_bytes_to_unicode
|
|||
from ansible.module_utils.common.text.converters import to_bytes
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils._xml import (
|
||||
COMMON_ARGUMENT_SPEC,
|
||||
check_lxml,
|
||||
collect_element_attr,
|
||||
collect_element_text,
|
||||
|
|
@ -796,29 +797,22 @@ def finish(module, tree, xpath, namespaces, changed=False, msg="", hitcount=0, m
|
|||
|
||||
|
||||
def main():
|
||||
argument_spec = copy.deepcopy(COMMON_ARGUMENT_SPEC)
|
||||
argument_spec.update(
|
||||
state=dict(type="str", default="present", choices=["absent", "present"], aliases=["ensure"]),
|
||||
value=dict(type="raw"),
|
||||
attribute=dict(type="raw"),
|
||||
add_children=dict(type="list", elements="raw"),
|
||||
set_children=dict(type="list", elements="raw"),
|
||||
pretty_print=dict(type="bool", default=False),
|
||||
input_type=dict(type="str", default="yaml", choices=["xml", "yaml"]),
|
||||
backup=dict(type="bool", default=False),
|
||||
insertbefore=dict(type="bool", default=False),
|
||||
insertafter=dict(type="bool", default=False),
|
||||
create_if_missing=dict(type="bool", default=True),
|
||||
)
|
||||
module = AnsibleModule(
|
||||
argument_spec=dict(
|
||||
path=dict(type="path", aliases=["dest", "file"]),
|
||||
xmlstring=dict(type="str"),
|
||||
xpath=dict(type="str"),
|
||||
namespaces=dict(type="dict", default={}),
|
||||
state=dict(type="str", default="present", choices=["absent", "present"], aliases=["ensure"]),
|
||||
value=dict(type="raw"),
|
||||
attribute=dict(type="raw"),
|
||||
add_children=dict(type="list", elements="raw"),
|
||||
set_children=dict(type="list", elements="raw"),
|
||||
count=dict(type="bool", default=False),
|
||||
print_match=dict(type="bool", default=False),
|
||||
pretty_print=dict(type="bool", default=False),
|
||||
content=dict(type="str", choices=["attribute", "text"]),
|
||||
input_type=dict(type="str", default="yaml", choices=["xml", "yaml"]),
|
||||
backup=dict(type="bool", default=False),
|
||||
strip_cdata_tags=dict(type="bool", default=False),
|
||||
huge_tree=dict(type="bool", default=False),
|
||||
insertbefore=dict(type="bool", default=False),
|
||||
insertafter=dict(type="bool", default=False),
|
||||
create_if_missing=dict(type="bool", default=True),
|
||||
),
|
||||
argument_spec=argument_spec,
|
||||
supports_check_mode=True,
|
||||
required_by=dict(
|
||||
add_children=["xpath"],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue