mirror of
https://github.com/ansible/awx.git
synced 2026-02-22 13:36:02 -03:30
Collection meta runtime updates (#11952)
* Update runtime.yml * Extending test_completness to include meta/runtime.yml and adding remaining missing modules from runtime.yml Co-authored-by: quasd <quasd@users.noreply.github.com>
This commit is contained in:
@@ -2,13 +2,23 @@
|
|||||||
requires_ansible: '>=2.9.10'
|
requires_ansible: '>=2.9.10'
|
||||||
action_groups:
|
action_groups:
|
||||||
controller:
|
controller:
|
||||||
|
- ad_hoc_command
|
||||||
|
- ad_hoc_command_cancel
|
||||||
|
- ad_hoc_command_wait
|
||||||
|
- application
|
||||||
|
- controller_meta
|
||||||
- credential_input_source
|
- credential_input_source
|
||||||
- credential
|
- credential
|
||||||
- credential_type
|
- credential_type
|
||||||
|
- execution_environment
|
||||||
|
- export
|
||||||
- group
|
- group
|
||||||
- host
|
- host
|
||||||
|
- import
|
||||||
|
- instance_group
|
||||||
- inventory
|
- inventory
|
||||||
- inventory_source
|
- inventory_source
|
||||||
|
- inventory_source_update
|
||||||
- job_cancel
|
- job_cancel
|
||||||
- job_launch
|
- job_launch
|
||||||
- job_list
|
- job_list
|
||||||
@@ -16,18 +26,21 @@ action_groups:
|
|||||||
- job_wait
|
- job_wait
|
||||||
- label
|
- label
|
||||||
- license
|
- license
|
||||||
- notification
|
- notification_template
|
||||||
- organization
|
- organization
|
||||||
- project
|
- project
|
||||||
|
- project_update
|
||||||
- role
|
- role
|
||||||
- schedule
|
- schedule
|
||||||
- settings
|
- settings
|
||||||
- team
|
- team
|
||||||
- token
|
- token
|
||||||
- user
|
- user
|
||||||
|
- workflow_approval
|
||||||
- workflow_job_template_node
|
- workflow_job_template_node
|
||||||
- workflow_job_template
|
- workflow_job_template
|
||||||
- workflow_launch
|
- workflow_launch
|
||||||
|
- workflow_node_wait
|
||||||
plugin_routing:
|
plugin_routing:
|
||||||
inventory:
|
inventory:
|
||||||
tower:
|
tower:
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ from ansible.module_utils.six import string_types
|
|||||||
import yaml
|
import yaml
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
import glob
|
||||||
|
|
||||||
# Analysis variables
|
# Analysis variables
|
||||||
# -----------------------------------------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------------------------------------
|
||||||
@@ -93,6 +94,40 @@ def cause_error(msg):
|
|||||||
return msg
|
return msg
|
||||||
|
|
||||||
|
|
||||||
|
def test_meta_runtime():
|
||||||
|
base_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir))
|
||||||
|
meta_filename = 'meta/runtime.yml'
|
||||||
|
module_dir = 'plugins/modules'
|
||||||
|
|
||||||
|
print("\nMeta check:")
|
||||||
|
|
||||||
|
with open('{0}/{1}'.format(base_dir, meta_filename), 'r') as f:
|
||||||
|
meta_data_string = f.read()
|
||||||
|
|
||||||
|
meta_data = yaml.load(meta_data_string, Loader=yaml.Loader)
|
||||||
|
|
||||||
|
needs_grouping = []
|
||||||
|
for file_name in glob.glob('{0}/{1}/*'.format(base_dir, module_dir)):
|
||||||
|
if not os.path.isfile(file_name) or os.path.islink(file_name):
|
||||||
|
continue
|
||||||
|
with open(file_name, 'r') as f:
|
||||||
|
if 'extends_documentation_fragment: awx.awx.auth' in f.read():
|
||||||
|
needs_grouping.append(os.path.splitext(os.path.basename(file_name))[0])
|
||||||
|
|
||||||
|
needs_to_be_removed = list(set(meta_data['action_groups']['controller']) - set(needs_grouping))
|
||||||
|
needs_to_be_added = list(set(needs_grouping) - set(meta_data['action_groups']['controller']))
|
||||||
|
|
||||||
|
needs_to_be_removed.sort()
|
||||||
|
needs_to_be_added.sort()
|
||||||
|
|
||||||
|
group = 'action-groups.controller'
|
||||||
|
if needs_to_be_removed:
|
||||||
|
print(cause_error("The following items should be removed from the {0} {1}:\n {2}".format(meta_filename, group, '\n '.join(needs_to_be_removed))))
|
||||||
|
|
||||||
|
if needs_to_be_added:
|
||||||
|
print(cause_error("The following items should be added to the {0} {1}:\n {2}".format(meta_filename, group, '\n '.join(needs_to_be_added))))
|
||||||
|
|
||||||
|
|
||||||
def determine_state(module_id, endpoint, module, parameter, api_option, module_option):
|
def determine_state(module_id, endpoint, module, parameter, api_option, module_option):
|
||||||
# This is a hierarchical list of things that are ok/failures based on conditions
|
# This is a hierarchical list of things that are ok/failures based on conditions
|
||||||
|
|
||||||
@@ -319,5 +354,7 @@ def test_completeness(collection_import, request, admin_user, job_template, exec
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
test_meta_runtime()
|
||||||
|
|
||||||
if return_value != 0:
|
if return_value != 0:
|
||||||
raise Exception("One or more failures caused issues")
|
raise Exception("One or more failures caused issues")
|
||||||
|
|||||||
Reference in New Issue
Block a user