Fix linter issue

This commit is contained in:
beeankha
2020-05-01 09:46:34 -04:00
committed by AlanCoding
parent 7478a2aa5e
commit 09c10a6f59
2 changed files with 60 additions and 58 deletions

View File

@@ -1,63 +1,64 @@
- name: Get date time data ---
setup: - name: Get date time data
gather_subset: min setup:
gather_subset: min
- name: Create module directory - name: Create module directory
file: file:
state: directory state: directory
name: "modules" name: "modules"
- name: Load api/v2 - name: Load api/v2
uri: uri:
method: GET method: GET
url: "{{ api_url }}/api/v2/" url: "{{ api_url }}/api/v2/"
register: endpoints register: endpoints
- name: Load endpoint options - name: Load endpoint options
uri: uri:
method: "OPTIONS" method: "OPTIONS"
url: "{{ api_url }}{{ item.value }}" url: "{{ api_url }}{{ item.value }}"
loop: "{{ endpoints['json'] | dict2items }}" loop: "{{ endpoints['json'] | dict2items }}"
loop_control: loop_control:
label: "{{ item.key }}" label: "{{ item.key }}"
register: end_point_options register: end_point_options
when: "generate_for is not defined or item.key in generate_for" when: "generate_for is not defined or item.key in generate_for"
- name: Scan POST options for different things - name: Scan POST options for different things
set_fact: set_fact:
all_options: "{{ all_options | default({}) | combine(options[0]) }}" all_options: "{{ all_options | default({}) | combine(options[0]) }}"
loop: "{{ end_point_options.results }}" loop: "{{ end_point_options.results }}"
vars: vars:
options: "{{ item | json_query('json.actions.POST.[*]') }}" options: "{{ item | json_query('json.actions.POST.[*]') }}"
loop_control: loop_control:
label: "{{ item['item']['key'] }}" label: "{{ item['item']['key'] }}"
when: when:
- item is not skipped - item is not skipped
- options is defined - options is defined
- name: Process endpoint - name: Process endpoint
template: template:
src: "templates/tower_module.j2" src: "templates/tower_module.j2"
dest: "{{ playbook_dir | dirname }}/plugins/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'] }}"
when: "'json' in item and 'actions' in item['json'] and 'POST' in item['json']['actions']" when: "'json' in item and 'actions' in item['json'] and 'POST' in item['json']['actions']"
vars: vars:
item_type: "{{ item['item']['key'] }}" item_type: "{{ item['item']['key'] }}"
human_readable: "{{ item_type | replace('_', ' ') }}" human_readable: "{{ item_type | replace('_', ' ') }}"
singular_item_type: "{{ item['item']['key'] | regex_replace('ies$', 'y') | regex_replace('s$', '') }}" singular_item_type: "{{ item['item']['key'] | regex_replace('ies$', 'y') | regex_replace('s$', '') }}"
file_name: "tower_{% if item['item']['key'] in ['settings'] %}{{ item['item']['key'] }}{% else %}{{ singular_item_type }}{% endif %}.py" file_name: "tower_{% if item['item']['key'] in ['settings'] %}{{ item['item']['key'] }}{% else %}{{ singular_item_type }}{% endif %}.py"
type_map: type_map:
bool: 'bool' bool: 'bool'
boolean: 'bool' boolean: 'bool'
choice: 'str' choice: 'str'
datetime: 'str' datetime: 'str'
id: 'str' id: 'str'
int: 'int' int: 'int'
integer: 'int' integer: 'int'
json: 'dict' json: 'dict'
list: 'list' list: 'list'
object: 'dict' object: 'dict'
password: 'str' password: 'str'
string: 'str' string: 'str'

View File

@@ -1,3 +1,4 @@
---
- name: Set the collection version in the tower_api.py file - name: Set the collection version in the tower_api.py file
replace: replace:
path: "{{ collection_path }}/plugins/module_utils/tower_api.py" path: "{{ collection_path }}/plugins/module_utils/tower_api.py"