mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 18:09:57 -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:
parent
5297a87ad4
commit
e2135b8d68
@ -2,13 +2,23 @@
|
||||
requires_ansible: '>=2.9.10'
|
||||
action_groups:
|
||||
controller:
|
||||
- ad_hoc_command
|
||||
- ad_hoc_command_cancel
|
||||
- ad_hoc_command_wait
|
||||
- application
|
||||
- controller_meta
|
||||
- credential_input_source
|
||||
- credential
|
||||
- credential_type
|
||||
- execution_environment
|
||||
- export
|
||||
- group
|
||||
- host
|
||||
- import
|
||||
- instance_group
|
||||
- inventory
|
||||
- inventory_source
|
||||
- inventory_source_update
|
||||
- job_cancel
|
||||
- job_launch
|
||||
- job_list
|
||||
@ -16,18 +26,21 @@ action_groups:
|
||||
- job_wait
|
||||
- label
|
||||
- license
|
||||
- notification
|
||||
- notification_template
|
||||
- organization
|
||||
- project
|
||||
- project_update
|
||||
- role
|
||||
- schedule
|
||||
- settings
|
||||
- team
|
||||
- token
|
||||
- user
|
||||
- workflow_approval
|
||||
- workflow_job_template_node
|
||||
- workflow_job_template
|
||||
- workflow_launch
|
||||
- workflow_node_wait
|
||||
plugin_routing:
|
||||
inventory:
|
||||
tower:
|
||||
|
||||
@ -7,6 +7,7 @@ from ansible.module_utils.six import string_types
|
||||
import yaml
|
||||
import os
|
||||
import re
|
||||
import glob
|
||||
|
||||
# Analysis variables
|
||||
# -----------------------------------------------------------------------------------------------------------
|
||||
@ -93,6 +94,40 @@ def cause_error(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):
|
||||
# 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:
|
||||
raise Exception("One or more failures caused issues")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user