mirror of
https://github.com/ansible/awx.git
synced 2026-03-21 19:07:39 -02:30
Patches to generator to better align with modules
This commit is contained in:
@@ -45,7 +45,7 @@ options:
|
|||||||
type: str
|
type: str
|
||||||
is_superuser:
|
is_superuser:
|
||||||
description:
|
description:
|
||||||
- User is a system wide administrator.
|
- Designates that this user has all permissions without explicitly assigning them.
|
||||||
required: False
|
required: False
|
||||||
type: bool
|
type: bool
|
||||||
default: False
|
default: False
|
||||||
@@ -59,10 +59,9 @@ options:
|
|||||||
aliases: ['auditor']
|
aliases: ['auditor']
|
||||||
password:
|
password:
|
||||||
description:
|
description:
|
||||||
- Password of the user; write-only field.
|
- Write-only field used to change the password.
|
||||||
required: False
|
required: False
|
||||||
type: str
|
type: str
|
||||||
default: ''
|
|
||||||
state:
|
state:
|
||||||
description:
|
description:
|
||||||
- Desired state of the resource.
|
- Desired state of the resource.
|
||||||
@@ -128,7 +127,7 @@ def main():
|
|||||||
email=dict(required=False, type='str'),
|
email=dict(required=False, type='str'),
|
||||||
is_superuser=dict(required=False, type='bool', default=False, aliases=['superuser']),
|
is_superuser=dict(required=False, type='bool', default=False, aliases=['superuser']),
|
||||||
is_system_auditor=dict(required=False, type='bool', default=False, aliases=['auditor']),
|
is_system_auditor=dict(required=False, type='bool', default=False, aliases=['auditor']),
|
||||||
password=dict(required=False, type='str', default=''),
|
password=dict(required=False, type='str'),
|
||||||
state=dict(choices=['present', 'absent'], default='present'),
|
state=dict(choices=['present', 'absent'], default='present'),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,7 @@
|
|||||||
- name: Process endpoint
|
- name: Process endpoint
|
||||||
template:
|
template:
|
||||||
src: "templates/tower_module.j2"
|
src: "templates/tower_module.j2"
|
||||||
dest: "modules/{{ file_name }}"
|
dest: "{{ playbook_dir | dirname }}/plugins/modules/{{ file_name }}"
|
||||||
loop: "{{ end_point_options['results'] }}"
|
loop: "{{ end_point_options['results'] }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item['item']['key'] }}"
|
label: "{{ item['item']['key'] }}"
|
||||||
|
|||||||
@@ -41,8 +41,8 @@ options:
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
required: {{ item['json']['actions']['POST'][option]['required'] }}
|
required: {{ item['json']['actions']['POST'][option]['required'] }}
|
||||||
type: {{ type_map[ item['json']['actions']['POST'][option]['type'] ] }}
|
type: {{ type_map[ item['json']['actions']['POST'][option]['type'] ] }}
|
||||||
{% if 'default' in item['json']['actions']['POST'][option] %}
|
{% if item['json']['actions']['POST'][option].get('default', '') != '' %}
|
||||||
default: '{{ item['json']['actions']['POST'][option]['default'] }}'
|
default: {{ item['json']['actions']['POST'][option]['default'] }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if 'choices' in item['json']['actions']['POST'][option] %}
|
{% if 'choices' in item['json']['actions']['POST'][option] %}
|
||||||
choices:
|
choices:
|
||||||
@@ -94,7 +94,7 @@ def main():
|
|||||||
{% for option in item['json']['actions']['POST'] %}
|
{% for option in item['json']['actions']['POST'] %}
|
||||||
{% set option_data = [] %}
|
{% set option_data = [] %}
|
||||||
{{ option_data.append('required={}'.format(item['json']['actions']['POST'][option]['required'])) -}}
|
{{ option_data.append('required={}'.format(item['json']['actions']['POST'][option]['required'])) -}}
|
||||||
{{ option_data.append('type={}'.format(type_map[item['json']['actions']['POST'][option]['type']])) -}}
|
{{ option_data.append('type=\'{}\''.format(type_map[item['json']['actions']['POST'][option]['type']])) -}}
|
||||||
{% if item['json']['actions']['POST'][option]['type'] == 'password' %}
|
{% if item['json']['actions']['POST'][option]['type'] == 'password' %}
|
||||||
{{ option_data.append('no_log=True') -}}
|
{{ option_data.append('no_log=True') -}}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -105,7 +105,7 @@ def main():
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
{{ option_data.append('choices=[{}]'.format(all_choices | join(', '))) -}}
|
{{ option_data.append('choices=[{}]'.format(all_choices | join(', '))) -}}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if 'default' in item['json']['actions']['POST'][option] %}
|
{% if item['json']['actions']['POST'][option].get('default', '') != '' %}
|
||||||
{{ option_data.append("default='{}'".format(item['json']['actions']['POST'][option]['default'])) -}}
|
{{ option_data.append("default='{}'".format(item['json']['actions']['POST'][option]['default'])) -}}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if aliases[item_type][option] | default(False) %}
|
{% if aliases[item_type][option] | default(False) %}
|
||||||
@@ -129,18 +129,6 @@ def main():
|
|||||||
# Extract our parameters
|
# Extract our parameters
|
||||||
{% for option in item['json']['actions']['POST'] %}
|
{% for option in item['json']['actions']['POST'] %}
|
||||||
{{ option }} = module.params.get('{{ option }}')
|
{{ option }} = module.params.get('{{ option }}')
|
||||||
{% if 'min_value' in item['json']['actions']['POST'][option] %}
|
|
||||||
if {{ option }} < {{ item['json']['actions']['POST'][option]['min_value'] }}:
|
|
||||||
module.fail_msg(msg="The value for {{ option }} can not be less than {{ item['json']['actions']['POST'][option]['min_value'] }}")
|
|
||||||
{% endif %}
|
|
||||||
{% if 'max_value' in item['json']['actions']['POST'][option] %}
|
|
||||||
if {{ option }} > {{ item['json']['actions']['POST'][option]['max_value'] }}:
|
|
||||||
module.fail_msg(msg="The value for {{ option }} can not be larger than {{ item['json']['actions']['POST'][option]['max_value'] }}")
|
|
||||||
{% endif %}
|
|
||||||
{% if 'max_length' in item['json']['actions']['POST'][option] %}
|
|
||||||
if {{ option }} and len({{ option }}) > {{ item['json']['actions']['POST'][option]['max_length'] }}:
|
|
||||||
module.fail_msg(msg="The value for {{ option }} can not be longer than {{ item['json']['actions']['POST'][option]['max_length'] }}")
|
|
||||||
{% endif %}
|
|
||||||
{% if option == name_option %}
|
{% if option == name_option %}
|
||||||
new_{{ name_option }} = module.params.get("new_{{ name_option }}")
|
new_{{ name_option }} = module.params.get("new_{{ name_option }}")
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
Reference in New Issue
Block a user