mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-30 10:26:52 +00:00
Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a3c711491a | ||
|
|
d6a57882d2 | ||
|
|
edbef2266d | ||
|
|
2b88ee01d3 | ||
|
|
afd24ccd35 | ||
|
|
26ada26df1 | ||
|
|
59999a89f1 | ||
|
|
e1f4be1e01 | ||
|
|
e7e2f095ee | ||
|
|
45200fc233 | ||
|
|
154d1b7024 | ||
|
|
541fcec900 | ||
|
|
dc6ccbea63 | ||
|
|
6cb044ac13 | ||
|
|
af78b2068a | ||
|
|
73569b1c36 |
@@ -112,19 +112,6 @@ stages:
|
||||
- test: 2
|
||||
- test: 3
|
||||
- test: 4
|
||||
- stage: Sanity_2_12
|
||||
displayName: Sanity 2.12
|
||||
dependsOn: []
|
||||
jobs:
|
||||
- template: templates/matrix.yml
|
||||
parameters:
|
||||
nameFormat: Test {0}
|
||||
testFormat: 2.12/sanity/{0}
|
||||
targets:
|
||||
- test: 1
|
||||
- test: 2
|
||||
- test: 3
|
||||
- test: 4
|
||||
### Units
|
||||
- stage: Units_devel
|
||||
displayName: Units devel
|
||||
@@ -136,7 +123,6 @@ stages:
|
||||
testFormat: devel/units/{0}/1
|
||||
targets:
|
||||
- test: 2.7
|
||||
- test: 3.5
|
||||
- test: 3.6
|
||||
- test: 3.7
|
||||
- test: 3.8
|
||||
@@ -152,6 +138,7 @@ stages:
|
||||
nameFormat: Python {0}
|
||||
testFormat: 2.15/units/{0}/1
|
||||
targets:
|
||||
- test: 3.5
|
||||
- test: "3.10"
|
||||
- stage: Units_2_14
|
||||
displayName: Units 2.14
|
||||
@@ -174,17 +161,6 @@ stages:
|
||||
targets:
|
||||
- test: 2.7
|
||||
- test: 3.8
|
||||
- stage: Units_2_12
|
||||
displayName: Units 2.12
|
||||
dependsOn: []
|
||||
jobs:
|
||||
- template: templates/matrix.yml
|
||||
parameters:
|
||||
nameFormat: Python {0}
|
||||
testFormat: 2.12/units/{0}/1
|
||||
targets:
|
||||
- test: 2.6
|
||||
- test: 3.8
|
||||
|
||||
## Remote
|
||||
- stage: Remote_devel_extra_vms
|
||||
@@ -199,8 +175,6 @@ stages:
|
||||
test: alpine/3.17
|
||||
# - name: Fedora 37
|
||||
# test: fedora/37
|
||||
# - name: Ubuntu 20.04
|
||||
# test: ubuntu/20.04
|
||||
- name: Ubuntu 22.04
|
||||
test: ubuntu/22.04
|
||||
groups:
|
||||
@@ -269,22 +243,6 @@ stages:
|
||||
test: macos/12.0
|
||||
- name: RHEL 8.5
|
||||
test: rhel/8.5
|
||||
groups:
|
||||
- 1
|
||||
- 2
|
||||
- 3
|
||||
- stage: Remote_2_12
|
||||
displayName: Remote 2.12
|
||||
dependsOn: []
|
||||
jobs:
|
||||
- template: templates/matrix.yml
|
||||
parameters:
|
||||
testFormat: 2.12/{0}
|
||||
targets:
|
||||
- name: macOS 11.1
|
||||
test: macos/11.1
|
||||
- name: RHEL 8.4
|
||||
test: rhel/8.4
|
||||
- name: FreeBSD 13.0
|
||||
test: freebsd/13.0
|
||||
groups:
|
||||
@@ -361,24 +319,6 @@ stages:
|
||||
- 1
|
||||
- 2
|
||||
- 3
|
||||
- stage: Docker_2_12
|
||||
displayName: Docker 2.12
|
||||
dependsOn: []
|
||||
jobs:
|
||||
- template: templates/matrix.yml
|
||||
parameters:
|
||||
testFormat: 2.12/linux/{0}
|
||||
targets:
|
||||
- name: CentOS 6
|
||||
test: centos6
|
||||
- name: Fedora 34
|
||||
test: fedora34
|
||||
- name: Ubuntu 18.04
|
||||
test: ubuntu1804
|
||||
groups:
|
||||
- 1
|
||||
- 2
|
||||
- 3
|
||||
|
||||
### Community Docker
|
||||
- stage: Docker_community_devel
|
||||
@@ -442,45 +382,30 @@ stages:
|
||||
testFormat: 2.13/generic/{0}/1
|
||||
targets:
|
||||
- test: 3.9
|
||||
- stage: Generic_2_12
|
||||
displayName: Generic 2.12
|
||||
dependsOn: []
|
||||
jobs:
|
||||
- template: templates/matrix.yml
|
||||
parameters:
|
||||
nameFormat: Python {0}
|
||||
testFormat: 2.12/generic/{0}/1
|
||||
targets:
|
||||
- test: 3.8
|
||||
|
||||
- stage: Summary
|
||||
condition: succeededOrFailed()
|
||||
dependsOn:
|
||||
- Sanity_devel
|
||||
- Sanity_2_12
|
||||
- Sanity_2_13
|
||||
- Sanity_2_14
|
||||
- Sanity_2_15
|
||||
- Units_devel
|
||||
- Units_2_12
|
||||
- Units_2_13
|
||||
- Units_2_14
|
||||
- Units_2_15
|
||||
- Remote_devel_extra_vms
|
||||
- Remote_devel
|
||||
- Remote_2_12
|
||||
- Remote_2_13
|
||||
- Remote_2_14
|
||||
- Remote_2_15
|
||||
- Docker_devel
|
||||
- Docker_2_12
|
||||
- Docker_2_13
|
||||
- Docker_2_14
|
||||
- Docker_2_15
|
||||
- Docker_community_devel
|
||||
# Right now all generic tests are disabled. Uncomment when at least one of them is re-enabled.
|
||||
# - Generic_devel
|
||||
# - Generic_2_12
|
||||
# - Generic_2_13
|
||||
# - Generic_2_14
|
||||
# - Generic_2_15
|
||||
|
||||
2
.github/BOTMETA.yml
vendored
2
.github/BOTMETA.yml
vendored
@@ -929,7 +929,7 @@ files:
|
||||
$modules/pamd.py:
|
||||
maintainers: kevensen
|
||||
$modules/parted.py:
|
||||
maintainers: ColOfAbRiX rosowiecki jake2184
|
||||
maintainers: ColOfAbRiX jake2184
|
||||
$modules/pear.py:
|
||||
ignore: jle64
|
||||
labels: pear
|
||||
|
||||
55
.github/workflows/ansible-test.yml
vendored
55
.github/workflows/ansible-test.yml
vendored
@@ -30,6 +30,7 @@ jobs:
|
||||
matrix:
|
||||
ansible:
|
||||
- '2.11'
|
||||
- '2.12'
|
||||
# Ansible-test on various stable branches does not yet work well with cgroups v2.
|
||||
# Since ubuntu-latest now uses Ubuntu 22.04, we need to fall back to the ubuntu-20.04
|
||||
# image for these stable branches. The list of branches where this is necessary will
|
||||
@@ -43,7 +44,7 @@ jobs:
|
||||
- name: Perform sanity testing
|
||||
uses: felixfontein/ansible-test-gh-action@main
|
||||
with:
|
||||
ansible-core-github-repository-slug: felixfontein/ansible
|
||||
ansible-core-github-repository-slug: ${{ contains(fromJson('["2.10", "2.11"]'), matrix.ansible) && 'felixfontein/ansible' || 'ansible/ansible' }}
|
||||
ansible-core-version: stable-${{ matrix.ansible }}
|
||||
coverage: ${{ github.event_name == 'schedule' && 'always' || 'never' }}
|
||||
pull-request-change-detection: 'true'
|
||||
@@ -75,6 +76,10 @@ jobs:
|
||||
python: '2.7'
|
||||
- ansible: '2.11'
|
||||
python: '3.5'
|
||||
- ansible: '2.12'
|
||||
python: '2.6'
|
||||
- ansible: '2.12'
|
||||
python: '3.8'
|
||||
|
||||
steps:
|
||||
- name: >-
|
||||
@@ -82,7 +87,7 @@ jobs:
|
||||
Ansible version ${{ matrix.ansible }}
|
||||
uses: felixfontein/ansible-test-gh-action@main
|
||||
with:
|
||||
ansible-core-github-repository-slug: felixfontein/ansible
|
||||
ansible-core-github-repository-slug: ${{ contains(fromJson('["2.10", "2.11"]'), matrix.ansible) && 'felixfontein/ansible' || 'ansible/ansible' }}
|
||||
ansible-core-version: stable-${{ matrix.ansible }}
|
||||
coverage: ${{ github.event_name == 'schedule' && 'always' || 'never' }}
|
||||
pre-test-cmd: >-
|
||||
@@ -163,7 +168,49 @@ jobs:
|
||||
# - ansible: '2.11'
|
||||
# docker: default
|
||||
# python: '3.5'
|
||||
# target: azp/generic/2/
|
||||
# target: azp/generic/1/
|
||||
# 2.12
|
||||
- ansible: '2.12'
|
||||
docker: centos6
|
||||
python: ''
|
||||
target: azp/posix/1/
|
||||
- ansible: '2.12'
|
||||
docker: centos6
|
||||
python: ''
|
||||
target: azp/posix/2/
|
||||
- ansible: '2.12'
|
||||
docker: centos6
|
||||
python: ''
|
||||
target: azp/posix/3/
|
||||
- ansible: '2.12'
|
||||
docker: fedora34
|
||||
python: ''
|
||||
target: azp/posix/1/
|
||||
- ansible: '2.12'
|
||||
docker: fedora34
|
||||
python: ''
|
||||
target: azp/posix/2/
|
||||
- ansible: '2.12'
|
||||
docker: fedora34
|
||||
python: ''
|
||||
target: azp/posix/3/
|
||||
- ansible: '2.12'
|
||||
docker: ubuntu1804
|
||||
python: ''
|
||||
target: azp/posix/1/
|
||||
- ansible: '2.12'
|
||||
docker: ubuntu1804
|
||||
python: ''
|
||||
target: azp/posix/2/
|
||||
- ansible: '2.12'
|
||||
docker: ubuntu1804
|
||||
python: ''
|
||||
target: azp/posix/3/
|
||||
# Right now all generic tests are disabled. Uncomment when at least one of them is re-enabled.
|
||||
# - ansible: '2.12'
|
||||
# docker: default
|
||||
# python: '3.8'
|
||||
# target: azp/generic/1/
|
||||
|
||||
steps:
|
||||
- name: >-
|
||||
@@ -172,7 +219,7 @@ jobs:
|
||||
under Python ${{ matrix.python }}
|
||||
uses: felixfontein/ansible-test-gh-action@main
|
||||
with:
|
||||
ansible-core-github-repository-slug: felixfontein/ansible
|
||||
ansible-core-github-repository-slug: ${{ contains(fromJson('["2.10", "2.11"]'), matrix.ansible) && 'felixfontein/ansible' || 'ansible/ansible' }}
|
||||
ansible-core-version: stable-${{ matrix.ansible }}
|
||||
coverage: ${{ github.event_name == 'schedule' && 'always' || 'never' }}
|
||||
docker-image: ${{ matrix.docker }}
|
||||
|
||||
@@ -6,6 +6,23 @@ Community General Release Notes
|
||||
|
||||
This changelog describes changes after version 5.0.0.
|
||||
|
||||
v6.6.2
|
||||
======
|
||||
|
||||
Release Summary
|
||||
---------------
|
||||
|
||||
Regular bugfix release.
|
||||
|
||||
Bugfixes
|
||||
--------
|
||||
|
||||
- csv module utils - detects and remove unicode BOM markers from incoming CSV content (https://github.com/ansible-collections/community.general/pull/6662).
|
||||
- gitlab_group - the module passed parameters to the API call even when not set. The module is now filtering out ``None`` values to remediate this (https://github.com/ansible-collections/community.general/pull/6712).
|
||||
- ini_file - fix a bug where the inactive options were not used when possible (https://github.com/ansible-collections/community.general/pull/6575).
|
||||
- keycloak module utils - fix ``is_struct_included`` handling of lists of lists/dictionaries (https://github.com/ansible-collections/community.general/pull/6688).
|
||||
- keycloak module utils - the function ``get_user_by_username`` now return the user representation or ``None`` as stated in the documentation (https://github.com/ansible-collections/community.general/pull/6758).
|
||||
|
||||
v6.6.1
|
||||
======
|
||||
|
||||
|
||||
@@ -1402,3 +1402,25 @@ releases:
|
||||
- deps.yml
|
||||
- passwordstore-lock.yml
|
||||
release_date: '2023-05-22'
|
||||
6.6.2:
|
||||
changes:
|
||||
bugfixes:
|
||||
- csv module utils - detects and remove unicode BOM markers from incoming CSV
|
||||
content (https://github.com/ansible-collections/community.general/pull/6662).
|
||||
- gitlab_group - the module passed parameters to the API call even when not
|
||||
set. The module is now filtering out ``None`` values to remediate this (https://github.com/ansible-collections/community.general/pull/6712).
|
||||
- ini_file - fix a bug where the inactive options were not used when possible
|
||||
(https://github.com/ansible-collections/community.general/pull/6575).
|
||||
- keycloak module utils - fix ``is_struct_included`` handling of lists of lists/dictionaries
|
||||
(https://github.com/ansible-collections/community.general/pull/6688).
|
||||
- keycloak module utils - the function ``get_user_by_username`` now return the
|
||||
user representation or ``None`` as stated in the documentation (https://github.com/ansible-collections/community.general/pull/6758).
|
||||
release_summary: Regular bugfix release.
|
||||
fragments:
|
||||
- 6.6.2.yml
|
||||
- 6568-fix-get-user-by-username-in-keycloak-module-utils.yml
|
||||
- 6662-csv-bom.yml
|
||||
- 6688-is-struct-included-bug-in-keycloak-py.yml
|
||||
- 6712-gitlab_group-filtered-for-none-values.yml
|
||||
- ini_file-use-inactive-options-when-possible.yml
|
||||
release_date: '2023-06-19'
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace: community
|
||||
name: general
|
||||
version: 6.6.1
|
||||
version: 6.6.2
|
||||
readme: README.md
|
||||
authors:
|
||||
- Ansible (https://github.com/ansible)
|
||||
|
||||
@@ -12,6 +12,8 @@ DOCUMENTATION = """
|
||||
requirements:
|
||||
- bw (command line utility)
|
||||
- be logged into bitwarden
|
||||
- bitwarden vault unlocked
|
||||
- C(BW_SESSION) environment variable set
|
||||
short_description: Retrieve secrets from Bitwarden
|
||||
version_added: 5.4.0
|
||||
description:
|
||||
|
||||
@@ -55,8 +55,10 @@ def initialize_dialect(dialect, **kwargs):
|
||||
|
||||
|
||||
def read_csv(data, dialect, fieldnames=None):
|
||||
|
||||
BOM = to_native(u'\ufeff')
|
||||
data = to_native(data, errors='surrogate_or_strict')
|
||||
if data.startswith(BOM):
|
||||
data = data[len(BOM):]
|
||||
|
||||
if PY3:
|
||||
fake_fh = StringIO(data)
|
||||
|
||||
@@ -207,24 +207,30 @@ def is_struct_included(struct1, struct2, exclude=None):
|
||||
Return True if all element of dict 1 are present in dict 2, return false otherwise.
|
||||
"""
|
||||
if isinstance(struct1, list) and isinstance(struct2, list):
|
||||
if not struct1 and not struct2:
|
||||
return True
|
||||
for item1 in struct1:
|
||||
if isinstance(item1, (list, dict)):
|
||||
for item2 in struct2:
|
||||
if not is_struct_included(item1, item2, exclude):
|
||||
return False
|
||||
if is_struct_included(item1, item2, exclude):
|
||||
break
|
||||
else:
|
||||
return False
|
||||
else:
|
||||
if item1 not in struct2:
|
||||
return False
|
||||
return True
|
||||
elif isinstance(struct1, dict) and isinstance(struct2, dict):
|
||||
if not struct1 and not struct2:
|
||||
return True
|
||||
try:
|
||||
for key in struct1:
|
||||
if not (exclude and key in exclude):
|
||||
if not is_struct_included(struct1[key], struct2[key], exclude):
|
||||
return False
|
||||
return True
|
||||
except KeyError:
|
||||
return False
|
||||
return True
|
||||
elif isinstance(struct1, bool) and isinstance(struct2, bool):
|
||||
return struct1 == struct2
|
||||
else:
|
||||
@@ -747,8 +753,15 @@ class KeycloakAPI(object):
|
||||
users_url = URL_USERS.format(url=self.baseurl, realm=realm)
|
||||
users_url += '?username=%s&exact=true' % username
|
||||
try:
|
||||
return json.loads(to_native(open_url(users_url, method='GET', headers=self.restheaders, timeout=self.connection_timeout,
|
||||
validate_certs=self.validate_certs).read()))
|
||||
userrep = None
|
||||
users = json.loads(to_native(open_url(users_url, method='GET', headers=self.restheaders, timeout=self.connection_timeout,
|
||||
validate_certs=self.validate_certs).read()))
|
||||
for user in users:
|
||||
if user['username'] == username:
|
||||
userrep = user
|
||||
break
|
||||
return userrep
|
||||
|
||||
except ValueError as e:
|
||||
self.module.fail_json(msg='API returned incorrect JSON when trying to obtain the user for realm %s and username %s: %s'
|
||||
% (realm, username, str(e)))
|
||||
|
||||
@@ -16,7 +16,7 @@ short_description: Manages Datadog downtimes
|
||||
version_added: 2.0.0
|
||||
description:
|
||||
- Manages downtimes within Datadog.
|
||||
- Options as described on U(https://docs.datadoghq.com/api/v1/downtimes/s).
|
||||
- Options as described on U(https://docs.datadoghq.com/api/v1/downtimes/).
|
||||
author:
|
||||
- Datadog (@Datadog)
|
||||
requirements:
|
||||
|
||||
@@ -255,7 +255,10 @@ class GitLabGroup(object):
|
||||
return True
|
||||
|
||||
try:
|
||||
group = self._gitlab.groups.create(arguments)
|
||||
# Filter out None values
|
||||
filtered = dict((arg_key, arg_value) for arg_key, arg_value in arguments.items() if arg_value is not None)
|
||||
|
||||
group = self._gitlab.groups.create(filtered)
|
||||
except (gitlab.exceptions.GitlabCreateError) as e:
|
||||
self._module.fail_json(msg="Failed to create group: %s " % to_native(e))
|
||||
|
||||
|
||||
@@ -316,14 +316,14 @@ def do_ini(module, filename, section=None, option=None, values=None,
|
||||
# override option with no value to option with value if not allow_no_value
|
||||
if len(values) > 0:
|
||||
for index, line in enumerate(section_lines):
|
||||
if not changed_lines[index] and match_active_opt(option, line):
|
||||
if not changed_lines[index] and match_opt(option, line):
|
||||
newline = assignment_format % (option, values.pop(0))
|
||||
(changed, msg) = update_section_line(changed, section_lines, index, changed_lines, newline, msg)
|
||||
if len(values) == 0:
|
||||
break
|
||||
# remove all remaining option occurrences from the rest of the section
|
||||
for index in range(len(section_lines) - 1, 0, -1):
|
||||
if not changed_lines[index] and match_active_opt(option, section_lines[index]):
|
||||
if not changed_lines[index] and match_opt(option, section_lines[index]):
|
||||
del section_lines[index]
|
||||
del changed_lines[index]
|
||||
changed = True
|
||||
|
||||
@@ -59,7 +59,7 @@ options:
|
||||
record_values:
|
||||
description:
|
||||
- Manage DNS record name with this value.
|
||||
- Mutually exclusive with I(record_values), and exactly one of I(record_value) and I(record_values) has to be specified.
|
||||
- Mutually exclusive with I(record_value), and exactly one of I(record_value) and I(record_values) has to be specified.
|
||||
- In the case of 'A' or 'AAAA' record types, this will be the IP address.
|
||||
- In the case of 'A6' record type, this will be the A6 Record data.
|
||||
- In the case of 'CNAME' record type, this will be the hostname.
|
||||
|
||||
@@ -453,7 +453,7 @@
|
||||
- content17 == expected17
|
||||
|
||||
|
||||
- name: "test-values 18 - Ensure 'beverage=coke' is 'abesent' in section '[drinks]'"
|
||||
- name: "test-values 18 - Ensure 'beverage=coke' is 'absent' in section '[drinks]'"
|
||||
ini_file:
|
||||
path: "{{ output_file }}"
|
||||
section: drinks
|
||||
@@ -483,7 +483,7 @@
|
||||
- content18 == expected18
|
||||
|
||||
|
||||
- name: "test-values 19 - Ensure non-existant 'beverage=coke' is 'abesent' in section '[drinks]'"
|
||||
- name: "test-values 19 - Ensure non-existent 'beverage=coke' is 'absent' in section '[drinks]'"
|
||||
ini_file:
|
||||
path: "{{ output_file }}"
|
||||
section: drinks
|
||||
@@ -579,8 +579,8 @@
|
||||
[section1]
|
||||
var1 = aaa
|
||||
# comment in section
|
||||
var2 = foo
|
||||
# var2 = bar
|
||||
# var2 = some value
|
||||
# comment after section
|
||||
|
||||
[section2]
|
||||
var3 = ccc
|
||||
@@ -613,8 +613,8 @@
|
||||
[section1]
|
||||
var1 = aaa
|
||||
# comment in section
|
||||
var2 = foo
|
||||
# var2 = bar
|
||||
# var2 = some value
|
||||
# comment after section
|
||||
|
||||
[section2]
|
||||
var3 = ccc
|
||||
@@ -629,14 +629,13 @@
|
||||
- content22 == expected22
|
||||
|
||||
|
||||
- name: "test-values 23 - Ensure 'var2=[foo, foobar]' is 'present' in section '[section1]'"
|
||||
- name: "test-values 23 - Ensure 'var2=foo' is 'present' in section '[section1]', replacing commented option 'var2=some value'"
|
||||
ini_file:
|
||||
path: "{{ output_file }}"
|
||||
section: section1
|
||||
option: var2
|
||||
values:
|
||||
- foo
|
||||
- foobar
|
||||
state: present
|
||||
register: result23
|
||||
|
||||
@@ -647,7 +646,6 @@
|
||||
|
||||
- name: test-values 23 - set expected content and get current ini file content
|
||||
set_fact:
|
||||
content23: "{{ output_content.content | b64decode }}"
|
||||
expected23: |
|
||||
|
||||
# Some comment to test
|
||||
@@ -659,28 +657,28 @@
|
||||
var1 = aaa
|
||||
# comment in section
|
||||
var2 = foo
|
||||
var2 = foobar
|
||||
# var2 = bar
|
||||
# comment after section
|
||||
|
||||
[section2]
|
||||
var3 = ccc
|
||||
# comment after section
|
||||
- name: test-values 23 - assert 'changed' and msg 'option added' and content is as expected
|
||||
content23: "{{ output_content.content | b64decode }}"
|
||||
|
||||
- name: test-values 23 - assert 'changed' and msg 'option changed' and content is as expected
|
||||
assert:
|
||||
that:
|
||||
- result23 is changed
|
||||
- result23.msg == 'option added'
|
||||
- result23.msg == 'option changed'
|
||||
- content23 == expected23
|
||||
|
||||
|
||||
- name: "test-values 24 - Ensure 'var2=[foo, foobar, bar]' is 'present' in section '[section1]' replacing commented option 'var2=bar'"
|
||||
- name: "test-values 24 - Ensure 'var2=[foo, foobar]' is 'present' in section '[section1]'"
|
||||
ini_file:
|
||||
path: "{{ output_file }}"
|
||||
section: section1
|
||||
option: var2
|
||||
values:
|
||||
values:
|
||||
- foo
|
||||
- bar
|
||||
- foobar
|
||||
state: present
|
||||
register: result24
|
||||
@@ -692,7 +690,6 @@
|
||||
|
||||
- name: test-values 24 - set expected content and get current ini file content
|
||||
set_fact:
|
||||
content24: "{{ output_content.content | b64decode }}"
|
||||
expected24: |
|
||||
|
||||
# Some comment to test
|
||||
@@ -705,16 +702,18 @@
|
||||
# comment in section
|
||||
var2 = foo
|
||||
var2 = foobar
|
||||
var2 = bar
|
||||
# comment after section
|
||||
|
||||
[section2]
|
||||
var3 = ccc
|
||||
# comment after section
|
||||
- name: test-values 24 - assert 'added' and msg 'option changed' and content is as expected
|
||||
content24: "{{ output_content.content | b64decode }}"
|
||||
|
||||
- name: test-values 24 - assert 'changed' and msg 'option added' and content is as expected
|
||||
assert:
|
||||
that:
|
||||
- result24 is changed
|
||||
- result24.msg == 'option changed'
|
||||
- result24.msg == 'option added'
|
||||
- content24 == expected24
|
||||
|
||||
|
||||
|
||||
7
tests/integration/targets/read_csv/meta/main.yml
Normal file
7
tests/integration/targets/read_csv/meta/main.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
dependencies:
|
||||
- setup_remote_tmp_dir
|
||||
@@ -11,16 +11,16 @@
|
||||
# Create basic CSV file
|
||||
- name: Create unique CSV file
|
||||
copy:
|
||||
content: |
|
||||
content: &users_content |
|
||||
name,uid,gid,gecos
|
||||
dag,500,500,Dag Wieërs
|
||||
jeroen,501,500,Jeroen Hoekx
|
||||
dest: users_unique.csv
|
||||
dest: "{{ remote_tmp_dir }}/users_unique.csv"
|
||||
|
||||
# Read a CSV file and access user 'dag'
|
||||
- name: Read users from CSV file and return a dictionary
|
||||
read_csv:
|
||||
path: users_unique.csv
|
||||
path: "{{ remote_tmp_dir }}/users_unique.csv"
|
||||
key: name
|
||||
register: users_unique
|
||||
|
||||
@@ -35,10 +35,10 @@
|
||||
- users_unique.dict.jeroen.uid == '501'
|
||||
- users_unique.dict.jeroen.gid == '500'
|
||||
|
||||
# Read a CSV file and access the first item
|
||||
# Read a CSV file and access the first item
|
||||
- name: Read users from CSV file and return a list
|
||||
read_csv:
|
||||
path: users_unique.csv
|
||||
path: "{{ remote_tmp_dir }}/users_unique.csv"
|
||||
register: users_unique
|
||||
|
||||
- assert:
|
||||
@@ -61,12 +61,12 @@
|
||||
dag;500;500;Dag Wieërs
|
||||
jeroen;501;500;Jeroen Hoekx
|
||||
dag;502;500;Dag Wieers
|
||||
dest: users_nonunique.csv
|
||||
dest: "{{ remote_tmp_dir }}/users_nonunique.csv"
|
||||
|
||||
# Read a CSV file and access user 'dag'
|
||||
- name: Read users from CSV file and return a dictionary
|
||||
read_csv:
|
||||
path: users_nonunique.csv
|
||||
path: "{{ remote_tmp_dir }}/users_nonunique.csv"
|
||||
key: name
|
||||
unique: false
|
||||
delimiter: ';'
|
||||
@@ -87,7 +87,7 @@
|
||||
# Read a CSV file using an non-existing dialect
|
||||
- name: Read users from CSV file and return a dictionary
|
||||
read_csv:
|
||||
path: users_nonunique.csv
|
||||
path: "{{ remote_tmp_dir }}/users_nonunique.csv"
|
||||
dialect: placebo
|
||||
register: users_placebo
|
||||
ignore_errors: true
|
||||
@@ -104,12 +104,12 @@
|
||||
content: |
|
||||
dag,500,500,Dag Wieërs
|
||||
jeroen,501,500,Jeroen Hoekx
|
||||
dest: users_noheader.csv
|
||||
dest: "{{ remote_tmp_dir }}/users_noheader.csv"
|
||||
|
||||
# Read a CSV file and access user 'dag'
|
||||
- name: Read users from CSV file and return a dictionary
|
||||
read_csv:
|
||||
path: users_noheader.csv
|
||||
path: "{{ remote_tmp_dir }}/users_noheader.csv"
|
||||
key: name
|
||||
fieldnames: name,uid,gid,gecos
|
||||
register: users_noheader
|
||||
@@ -133,12 +133,12 @@
|
||||
name,uid,gid,gecos
|
||||
dag,500,500,Dag Wieërs
|
||||
jeroen,501,500,"Jeroen"Hoekx"
|
||||
dest: users_broken.csv
|
||||
dest: "{{ remote_tmp_dir }}/users_broken.csv"
|
||||
|
||||
# Read a broken CSV file using strict
|
||||
- name: Read users from a broken CSV file
|
||||
read_csv:
|
||||
path: users_broken.csv
|
||||
path: "{{ remote_tmp_dir }}/users_broken.csv"
|
||||
key: name
|
||||
strict: true
|
||||
register: users_broken
|
||||
@@ -148,3 +148,29 @@
|
||||
that:
|
||||
- users_broken is failed
|
||||
- "'Unable to process file' in users_broken.msg"
|
||||
|
||||
# Create basic CSV file with BOM
|
||||
- name: Create unique CSV file with BOM
|
||||
copy:
|
||||
content: "{{ bom + content }}"
|
||||
dest: "{{ remote_tmp_dir }}/users_bom.csv"
|
||||
vars:
|
||||
content: *users_content
|
||||
bom: "{{ '\ufeff' }}"
|
||||
|
||||
# Read a CSV file and access the first item
|
||||
- name: Read users from CSV file and return a list
|
||||
read_csv:
|
||||
path: "{{ remote_tmp_dir }}/users_bom.csv"
|
||||
register: users_bom
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- users_bom.list.0.name == 'dag'
|
||||
- users_bom.list.0.gecos == 'Dag Wieërs'
|
||||
- users_bom.list.0.uid == '500'
|
||||
- users_bom.list.0.gid == '500'
|
||||
- users_bom.list.1.name == 'jeroen'
|
||||
- users_bom.list.1.gecos == 'Jeroen Hoekx'
|
||||
- users_bom.list.1.uid == '501'
|
||||
- users_bom.list.1.gid == '500'
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import unittest
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.identity.keycloak.keycloak import is_struct_included
|
||||
|
||||
|
||||
class KeycloakIsStructIncludedTestCase(unittest.TestCase):
|
||||
dict1 = dict(
|
||||
test1='test1',
|
||||
test2=dict(
|
||||
test1='test1',
|
||||
test2='test2'
|
||||
),
|
||||
test3=['test1', dict(test='test1', test2='test2')]
|
||||
)
|
||||
dict2 = dict(
|
||||
test1='test1',
|
||||
test2=dict(
|
||||
test1='test1',
|
||||
test2='test2',
|
||||
test3='test3'
|
||||
),
|
||||
test3=['test1', dict(test='test1', test2='test2'), 'test3'],
|
||||
test4='test4'
|
||||
)
|
||||
dict3 = dict(
|
||||
test1='test1',
|
||||
test2=dict(
|
||||
test1='test1',
|
||||
test2='test23',
|
||||
test3='test3'
|
||||
),
|
||||
test3=['test1', dict(test='test1', test2='test23'), 'test3'],
|
||||
test4='test4'
|
||||
)
|
||||
|
||||
dict5 = dict(
|
||||
test1='test1',
|
||||
test2=dict(
|
||||
test1=True,
|
||||
test2='test23',
|
||||
test3='test3'
|
||||
),
|
||||
test3=['test1', dict(test='test1', test2='test23'), 'test3'],
|
||||
test4='test4'
|
||||
)
|
||||
|
||||
dict6 = dict(
|
||||
test1='test1',
|
||||
test2=dict(
|
||||
test1='true',
|
||||
test2='test23',
|
||||
test3='test3'
|
||||
),
|
||||
test3=['test1', dict(test='test1', test2='test23'), 'test3'],
|
||||
test4='test4'
|
||||
)
|
||||
dict7 = [
|
||||
{
|
||||
'roles': ['view-clients', 'view-identity-providers', 'view-users', 'query-realms', 'manage-users'],
|
||||
'clientid': 'master-realm'
|
||||
},
|
||||
{
|
||||
'roles': ['manage-account', 'view-profile', 'manage-account-links'],
|
||||
'clientid': 'account'
|
||||
}
|
||||
]
|
||||
dict8 = [
|
||||
{
|
||||
'roles': ['view-clients', 'query-realms', 'view-users'],
|
||||
'clientid': 'master-realm'
|
||||
},
|
||||
{
|
||||
'roles': ['manage-account-links', 'view-profile', 'manage-account'],
|
||||
'clientid': 'account'
|
||||
}
|
||||
]
|
||||
|
||||
def test_trivial(self):
|
||||
self.assertTrue(is_struct_included(self.dict1, self.dict1))
|
||||
|
||||
def test_equals_with_dict2_bigger_than_dict1(self):
|
||||
self.assertTrue(is_struct_included(self.dict1, self.dict2))
|
||||
|
||||
def test_not_equals_with_dict2_bigger_than_dict1(self):
|
||||
self.assertFalse(is_struct_included(self.dict2, self.dict1))
|
||||
|
||||
def test_not_equals_with_dict1_different_than_dict3(self):
|
||||
self.assertFalse(is_struct_included(self.dict1, self.dict3))
|
||||
|
||||
def test_equals_with_dict5_contain_bool_and_dict6_contain_true_string(self):
|
||||
self.assertFalse(is_struct_included(self.dict5, self.dict6))
|
||||
self.assertFalse(is_struct_included(self.dict6, self.dict5))
|
||||
|
||||
def test_not_equals_dict7_dict8_compare_dict7_with_list_bigger_than_dict8_but_reverse_equals(self):
|
||||
self.assertFalse(is_struct_included(self.dict7, self.dict8))
|
||||
self.assertTrue(is_struct_included(self.dict8, self.dict7))
|
||||
@@ -21,6 +21,7 @@ pycrypto >= 2.6 # Need features found in 2.6 and greater
|
||||
ncclient >= 0.5.2 # Need features added in 0.5.2 and greater
|
||||
idna < 2.6, >= 2.5 # linode requires idna < 2.9, >= 2.5, requests requires idna < 2.6, but cryptography will cause the latest version to be installed instead
|
||||
paramiko < 2.4.0 ; python_version < '2.7' # paramiko 2.4.0 drops support for python 2.6
|
||||
python-nomad < 2.0.0 ; python_version <= '3.7' # python-nomad 2.0.0 needs Python 3.7+
|
||||
pytest < 3.3.0 ; python_version < '2.7' # pytest 3.3.0 drops support for python 2.6
|
||||
pytest < 5.0.0 ; python_version == '2.7' # pytest 5.0.0 and later will no longer support python 2.7
|
||||
pytest-forked < 1.0.2 ; python_version < '2.7' # pytest-forked 1.0.2 and later require python 2.7 or later
|
||||
|
||||
Reference in New Issue
Block a user