Run collection sanity tests in CI (#13356)

* Run collection sanity tests in CI

This requires adding a Makefile install of ansible-core

Fake the version to make semver check happy

* Fixes from ansible-test sanity failures

* Exclude the export module due to awxkit requirement

* Fix broken ansible-test rule exceptions

remove Ansible 2.14 exclusions that make ansible-test ERROR, saying they are not needed
This commit is contained in:
Alan Rominger
2022-12-20 16:06:25 -05:00
committed by GitHub
parent 8f6849fc22
commit ac8cff75ce
22 changed files with 73 additions and 122 deletions

View File

@@ -7,7 +7,6 @@ __metaclass__ = type
DOCUMENTATION = '''
name: controller
plugin_type: inventory
author:
- Matthew Jones (@matburt)
- Yunfan Zhang (@YunfanZhang42)

View File

@@ -5,7 +5,7 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = """
lookup: controller_api
name: controller_api
author: John Westcott IV (@john-westcott-iv)
short_description: Search the API for objects
requirements:

View File

@@ -5,7 +5,7 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = """
lookup: schedule_rrule
name: schedule_rrule
author: John Westcott IV (@john-westcott-iv)
short_description: Generate an rrule string which can be used for Schedules
requirements:

View File

@@ -5,7 +5,7 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = """
lookup: schedule_rruleset
name: schedule_rruleset
author: John Westcott IV (@john-westcott-iv)
short_description: Generate an rruleset string
requirements:
@@ -31,7 +31,8 @@ DOCUMENTATION = """
rules:
description:
- Array of rules in the rruleset
type: array
type: list
elements: dict
required: True
suboptions:
frequency:
@@ -192,14 +193,14 @@ class LookupModule(LookupBase):
# something: [1,2,3] - A list of ints
return_values = []
# If they give us a single int, lets make it a list of ints
if type(rule[field_name]) == int:
if isinstance(rule[field_name], int):
rule[field_name] = [rule[field_name]]
# If its not a list, we need to split it into a list
if type(rule[field_name]) != list:
if isinstance(rule[field_name], list):
rule[field_name] = rule[field_name].split(',')
for value in rule[field_name]:
# If they have a list of strs we want to strip the str incase its space delineated
if type(value) == str:
if isinstance(value, str):
value = value.strip()
# If value happens to be an int (from a list of ints) we need to coerce it into a str for the re.match
if not re.match(r"^\d+$", str(value)) or int(value) < min_value or int(value) > max_value:
@@ -209,7 +210,7 @@ class LookupModule(LookupBase):
def process_list(self, field_name, rule, valid_list, rule_number):
return_values = []
if type(rule[field_name]) != list:
if isinstance(rule[field_name], list):
rule[field_name] = rule[field_name].split(',')
for value in rule[field_name]:
value = value.strip()

View File

@@ -4,6 +4,7 @@ __metaclass__ = type
from ansible.module_utils.basic import AnsibleModule, env_fallback
from ansible.module_utils.urls import Request, SSLValidationError, ConnectionError
from ansible.module_utils.parsing.convert_bool import boolean as strtobool
from ansible.module_utils.six import PY2
from ansible.module_utils.six import raise_from, string_types
from ansible.module_utils.six.moves import StringIO
@@ -11,14 +12,21 @@ from ansible.module_utils.six.moves.urllib.error import HTTPError
from ansible.module_utils.six.moves.http_cookiejar import CookieJar
from ansible.module_utils.six.moves.urllib.parse import urlparse, urlencode
from ansible.module_utils.six.moves.configparser import ConfigParser, NoOptionError
from distutils.version import LooseVersion as Version
from socket import getaddrinfo, IPPROTO_TCP
import time
import re
from json import loads, dumps
from os.path import isfile, expanduser, split, join, exists, isdir
from os import access, R_OK, getcwd
from distutils.util import strtobool
try:
from ansible.module_utils.compat.version import LooseVersion as Version
except ImportError:
try:
from distutils.version import LooseVersion as Version
except ImportError:
raise AssertionError('To use this plugin or module with ansible-core 2.11, you need to use Python < 3.12 with distutils.version present')
try:
import yaml

View File

@@ -55,7 +55,6 @@ options:
description:
- The arguments to pass to the module.
type: str
default: ""
forks:
description:
- The number of forks to use for this ad hoc execution.

View File

@@ -42,6 +42,7 @@ options:
- Maximum time in seconds to wait for a job to finish.
- Not specifying means the task will wait until the controller cancels the command.
type: int
default: 0
extends_documentation_fragment: awx.awx.auth
'''

View File

@@ -80,9 +80,9 @@ def main():
name=dict(required=True),
new_name=dict(),
image=dict(required=True),
description=dict(default=''),
description=dict(),
organization=dict(),
credential=dict(default=''),
credential=dict(),
state=dict(choices=['present', 'absent'], default='present'),
pull=dict(choices=['always', 'missing', 'never'], default='missing'),
)

View File

@@ -86,6 +86,16 @@ options:
- workflow names to export
type: list
elements: str
applications:
description:
- OAuth2 application names to export
type: list
elements: str
schedules:
description:
- schedule names to export
type: list
elements: str
requirements:
- "awxkit >= 9.3.0"
notes:

View File

@@ -266,6 +266,7 @@ options:
description:
- Maximum time in seconds to wait for a job to finish (server-side).
type: int
default: 0
job_slice_count:
description:
- The number of jobs to slice into at runtime. Will cause the Job Template to launch a workflow if value is greater than 1.
@@ -287,7 +288,6 @@ options:
description:
- Branch to use in job run. Project default used if blank. Only allowed if project allow_override field is set to true.
type: str
default: ''
labels:
description:
- The labels applied to this job template

View File

@@ -60,12 +60,10 @@ options:
description:
- The branch to use for the SCM resource.
type: str
default: ''
scm_refspec:
description:
- The refspec to use for the SCM resource.
type: str
default: ''
credential:
description:
- Name of the credential to use with this SCM resource.

View File

@@ -51,7 +51,6 @@ options:
- Specify C(extra_vars) for the template.
required: False
type: dict
default: {}
forks:
description:
- Forks applied as a prompt, assuming job template prompts for forks

View File

@@ -39,6 +39,7 @@ options:
- Note This is a client side search, not an API side search
required: False
type: dict
default: {}
extends_documentation_fragment: awx.awx.auth
'''

View File

@@ -35,7 +35,6 @@ options:
- Optional description of this access token.
required: False
type: str
default: ''
application:
description:
- The application tied to this token.

View File

@@ -214,7 +214,8 @@ options:
type: int
job_slice_count:
description:
- The number of jobs to slice into at runtime, if job template prompts for job slices. Will cause the Job Template to launch a workflow if value is greater than 1.
- The number of jobs to slice into at runtime, if job template prompts for job slices.
- Will cause the Job Template to launch a workflow if value is greater than 1.
type: int
default: '1'
timeout:
@@ -328,42 +329,46 @@ options:
- Nodes that will run after this node completes.
- List of node identifiers.
type: list
elements: dict
suboptions:
identifier:
description:
- Identifier of Node that will run after this node completes given this option.
elements: str
type: str
success_nodes:
description:
- Nodes that will run after this node on success.
- List of node identifiers.
type: list
elements: dict
suboptions:
identifier:
description:
- Identifier of Node that will run after this node completes given this option.
elements: str
type: str
failure_nodes:
description:
- Nodes that will run after this node on failure.
- List of node identifiers.
type: list
elements: dict
suboptions:
identifier:
description:
- Identifier of Node that will run after this node completes given this option.
elements: str
type: str
credentials:
description:
- Credentials to be applied to job as launch-time prompts.
- List of credential names.
- Uniqueness is not handled rigorously.
type: list
elements: dict
suboptions:
name:
description:
- Name Credentials to be applied to job as launch-time prompts.
elements: str
type: str
organization:
description:
- Name of key for use in model for organizational reference
@@ -379,11 +384,12 @@ options:
- List of Label names.
- Uniqueness is not handled rigorously.
type: list
elements: dict
suboptions:
name:
description:
- Name Labels to be applied to job as launch-time prompts.
elements: str
type: str
organization:
description:
- Name of key for use in model for organizational reference
@@ -399,11 +405,12 @@ options:
- List of Instance group names.
- Uniqueness is not handled rigorously.
type: list
elements: dict
suboptions:
name:
description:
- Name of Instance groups to be applied to job as launch-time prompts.
elements: str
type: str
destroy_current_nodes:
description:
- Set in order to destroy current workflow_nodes on the workflow.
@@ -789,7 +796,7 @@ def main():
allow_simultaneous=dict(type='bool'),
ask_variables_on_launch=dict(type='bool'),
ask_labels_on_launch=dict(type='bool', aliases=['ask_labels']),
ask_tags_on_launch=dict(type='bool'),
ask_tags_on_launch=dict(type='bool', aliases=['ask_tags']),
ask_skip_tags_on_launch=dict(type='bool', aliases=['ask_skip_tags']),
inventory=dict(),
limit=dict(),

View File

@@ -30,7 +30,6 @@ options:
- Variables to apply at launch time.
- Will only be accepted if job template prompts for vars or has a survey asking for those vars.
type: dict
default: {}
inventory:
description:
- Inventory applied as a prompt, if job template prompts for inventory