mirror of
https://github.com/ansible/awx.git
synced 2026-05-08 01:47:35 -02:30
Compensating for default of '' for a JSON typed field
This commit is contained in:
committed by
beeankha
parent
9dbf75f2a9
commit
357e22eb51
@@ -41,8 +41,13 @@ 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 item['json']['actions']['POST'][option].get('default', '') != '' %}
|
{% if 'default' in item['json']['actions']['POST'][option] %}
|
||||||
default: {{ item['json']['actions']['POST'][option]['default'] }}
|
{# for tower_job_template/extra vars, its type is dict but its default is '', so we want to make that {} #}
|
||||||
|
{% if item['json']['actions']['POST'][option]['default'] == '' and type_map[ item['json']['actions']['POST'][option]['type'] ] == 'dict' %}
|
||||||
|
default: {}
|
||||||
|
{% else %}
|
||||||
|
default: '{{ item['json']['actions']['POST'][option]['default'] }}'
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if 'choices' in item['json']['actions']['POST'][option] %}
|
{% if 'choices' in item['json']['actions']['POST'][option] %}
|
||||||
choices:
|
choices:
|
||||||
@@ -106,7 +111,11 @@ def main():
|
|||||||
{{ option_data.append('choices=[{}]'.format(all_choices | join(', '))) -}}
|
{{ option_data.append('choices=[{}]'.format(all_choices | join(', '))) -}}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if item['json']['actions']['POST'][option].get('default', '') != '' %}
|
{% if item['json']['actions']['POST'][option].get('default', '') != '' %}
|
||||||
{{ option_data.append("default='{}'".format(item['json']['actions']['POST'][option]['default'])) -}}
|
{% set default_value = item['json']['actions']['POST'][option]['default'] %}
|
||||||
|
{% if item['json']['actions']['POST'][option]['default'] == '' and type_map[ item['json']['actions']['POST'][option]['type'] ] == 'dict' %}
|
||||||
|
{% set default_value = '{}' %}
|
||||||
|
{% endif %}
|
||||||
|
{{ option_data.append("default='{}'".format(default_value)) -}}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if aliases[item_type][option] | default(False) %}
|
{% if aliases[item_type][option] | default(False) %}
|
||||||
{% set alias_list = [] %}
|
{% set alias_list = [] %}
|
||||||
|
|||||||
Reference in New Issue
Block a user