mirror of
https://github.com/ansible-collections/ansible.posix.git
synced 2026-01-11 15:15:26 +01:00
Compare commits
3 commits
f3ae8921f3
...
08eda6a8d9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
08eda6a8d9 | ||
|
|
5f44339fa5 | ||
|
|
7d5aef07e2 |
5 changed files with 100 additions and 23 deletions
|
|
@ -57,6 +57,21 @@ stages:
|
||||||
test: units
|
test: units
|
||||||
- name: Lint
|
- name: Lint
|
||||||
test: lint
|
test: lint
|
||||||
|
- stage: Sanity_2_20
|
||||||
|
displayName: Ansible 2.20 Sanity & Units & Lint
|
||||||
|
dependsOn: []
|
||||||
|
jobs:
|
||||||
|
- template: templates/matrix.yml
|
||||||
|
parameters:
|
||||||
|
nameFormat: "{0}"
|
||||||
|
testFormat: 2.20/{0}
|
||||||
|
targets:
|
||||||
|
- name: Sanity
|
||||||
|
test: sanity
|
||||||
|
- name: Units
|
||||||
|
test: units
|
||||||
|
- name: Lint
|
||||||
|
test: lint
|
||||||
- stage: Sanity_2_19
|
- stage: Sanity_2_19
|
||||||
displayName: Ansible 2.19 Sanity & Units & Lint
|
displayName: Ansible 2.19 Sanity & Units & Lint
|
||||||
dependsOn: []
|
dependsOn: []
|
||||||
|
|
@ -132,6 +147,20 @@ stages:
|
||||||
test: ubuntu2204
|
test: ubuntu2204
|
||||||
- name: Ubuntu 24.04
|
- name: Ubuntu 24.04
|
||||||
test: ubuntu2404
|
test: ubuntu2404
|
||||||
|
- stage: Docker_2_20
|
||||||
|
displayName: Docker 2.20
|
||||||
|
dependsOn: []
|
||||||
|
jobs:
|
||||||
|
- template: templates/matrix.yml
|
||||||
|
parameters:
|
||||||
|
testFormat: 2.20/linux/{0}/1
|
||||||
|
targets:
|
||||||
|
- name: Fedora 42
|
||||||
|
test: fedora42
|
||||||
|
- name: Ubuntu 22.04
|
||||||
|
test: ubuntu2204
|
||||||
|
- name: Ubuntu 24.04
|
||||||
|
test: ubuntu2404
|
||||||
- stage: Docker_2_19
|
- stage: Docker_2_19
|
||||||
displayName: Docker 2.19
|
displayName: Docker 2.19
|
||||||
dependsOn: []
|
dependsOn: []
|
||||||
|
|
@ -204,6 +233,22 @@ stages:
|
||||||
test: freebsd/14.3
|
test: freebsd/14.3
|
||||||
- name: FreeBSD 13.5
|
- name: FreeBSD 13.5
|
||||||
test: freebsd/13.5
|
test: freebsd/13.5
|
||||||
|
- stage: Remote_2_20
|
||||||
|
displayName: Remote 2.20
|
||||||
|
dependsOn: []
|
||||||
|
jobs:
|
||||||
|
- template: templates/matrix.yml
|
||||||
|
parameters:
|
||||||
|
testFormat: 2.20/{0}/1
|
||||||
|
targets:
|
||||||
|
- name: RHEL 10.0
|
||||||
|
test: rhel/10.0
|
||||||
|
- name: RHEL 9.6
|
||||||
|
test: rhel/9.6
|
||||||
|
- name: FreeBSD 14.3
|
||||||
|
test: freebsd/14.3
|
||||||
|
- name: FreeBSD 13.5
|
||||||
|
test: freebsd/13.5
|
||||||
- stage: Remote_2_19
|
- stage: Remote_2_19
|
||||||
displayName: Remote 2.19
|
displayName: Remote 2.19
|
||||||
dependsOn: []
|
dependsOn: []
|
||||||
|
|
@ -228,6 +273,8 @@ stages:
|
||||||
parameters:
|
parameters:
|
||||||
testFormat: 2.18/{0}/1
|
testFormat: 2.18/{0}/1
|
||||||
targets:
|
targets:
|
||||||
|
- name: RHEL 10.0
|
||||||
|
test: rhel/10.0
|
||||||
- name: RHEL 9.4
|
- name: RHEL 9.4
|
||||||
test: rhel/9.4
|
test: rhel/9.4
|
||||||
- name: FreeBSD 13.5
|
- name: FreeBSD 13.5
|
||||||
|
|
@ -240,8 +287,9 @@ stages:
|
||||||
parameters:
|
parameters:
|
||||||
testFormat: 2.17/{0}/1
|
testFormat: 2.17/{0}/1
|
||||||
targets:
|
targets:
|
||||||
- name: RHEL 9.3
|
# 2.17 remote target doesn't have RHEL 9 image
|
||||||
test: rhel/9.3
|
- name: RHEL 10.0
|
||||||
|
test: rhel/10.0
|
||||||
- name: FreeBSD 13.5
|
- name: FreeBSD 13.5
|
||||||
test: freebsd/13.5
|
test: freebsd/13.5
|
||||||
- stage: Remote_2_16
|
- stage: Remote_2_16
|
||||||
|
|
@ -252,10 +300,9 @@ stages:
|
||||||
parameters:
|
parameters:
|
||||||
testFormat: 2.16/{0}/1
|
testFormat: 2.16/{0}/1
|
||||||
targets:
|
targets:
|
||||||
- name: RHEL 8.8
|
# 2.16 remote target only has RHEL 9.6 image
|
||||||
test: rhel/8.8
|
- name: RHEL 9.6
|
||||||
- name: RHEL 9.2
|
test: rhel/9.6
|
||||||
test: rhel/9.2
|
|
||||||
|
|
||||||
## Finally
|
## Finally
|
||||||
|
|
||||||
|
|
@ -274,6 +321,9 @@ stages:
|
||||||
- Sanity_2_19
|
- Sanity_2_19
|
||||||
- Remote_2_19
|
- Remote_2_19
|
||||||
- Docker_2_19
|
- Docker_2_19
|
||||||
|
- Sanity_2_20
|
||||||
|
- Remote_2_20
|
||||||
|
- Docker_2_20
|
||||||
- Sanity_devel
|
- Sanity_devel
|
||||||
- Remote_devel
|
- Remote_devel
|
||||||
- Docker_devel
|
- Docker_devel
|
||||||
|
|
|
||||||
5
changelogs/fragments/693_azp_update_20251205.yml
Normal file
5
changelogs/fragments/693_azp_update_20251205.yml
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
trivial:
|
||||||
|
- AZP - Update AZP matrix to follow ansible-test changes.
|
||||||
|
- Add ignore file for Ansible Core 2.21.
|
||||||
|
- Remove ignore lines for ansible-bad-import-from in 2.20 sanity tests.
|
||||||
|
|
@ -56,6 +56,12 @@ options:
|
||||||
- Verify token value with the sysctl command and set with C(-w) if necessary.
|
- Verify token value with the sysctl command and set with C(-w) if necessary.
|
||||||
type: bool
|
type: bool
|
||||||
default: false
|
default: false
|
||||||
|
allow_duplicate:
|
||||||
|
description:
|
||||||
|
- If C(true), allows duplicate entries in the sysctl file.
|
||||||
|
If C(false), it behaves the same as in versions prior to 2.1.0.
|
||||||
|
type: bool
|
||||||
|
default: false
|
||||||
author:
|
author:
|
||||||
- David CHANIAL (@davixx)
|
- David CHANIAL (@davixx)
|
||||||
'''
|
'''
|
||||||
|
|
@ -165,7 +171,11 @@ class SysctlModule(object):
|
||||||
self.fix_lines()
|
self.fix_lines()
|
||||||
|
|
||||||
# what do we need to do now?
|
# what do we need to do now?
|
||||||
if self.file_values[thisname] is None and self.args['state'] == "present":
|
if self.args['allow_duplicate'] and self.args['state'] == "present":
|
||||||
|
# with allow_duplicate we always add the new value
|
||||||
|
self.changed = True
|
||||||
|
self.write_file = True
|
||||||
|
elif self.file_values[thisname] is None and self.args['state'] == "present":
|
||||||
self.changed = True
|
self.changed = True
|
||||||
self.write_file = True
|
self.write_file = True
|
||||||
elif self.file_values[thisname] is None and self.args['state'] == "absent":
|
elif self.file_values[thisname] is None and self.args['state'] == "absent":
|
||||||
|
|
@ -348,6 +358,7 @@ class SysctlModule(object):
|
||||||
def fix_lines(self):
|
def fix_lines(self):
|
||||||
checked = []
|
checked = []
|
||||||
self.fixed_lines = []
|
self.fixed_lines = []
|
||||||
|
|
||||||
for line in self.file_lines:
|
for line in self.file_lines:
|
||||||
if not line.strip() or line.strip().startswith(("#", ";")) or "=" not in line:
|
if not line.strip() or line.strip().startswith(("#", ";")) or "=" not in line:
|
||||||
self.fixed_lines.append(line)
|
self.fixed_lines.append(line)
|
||||||
|
|
@ -356,6 +367,13 @@ class SysctlModule(object):
|
||||||
k, v = tmpline.split('=', 1)
|
k, v = tmpline.split('=', 1)
|
||||||
k = k.strip()
|
k = k.strip()
|
||||||
v = v.strip()
|
v = v.strip()
|
||||||
|
|
||||||
|
if self.args['allow_duplicate'] and self.args['state'] == "present":
|
||||||
|
new_line = "%s=%s\n" % (k, v)
|
||||||
|
self.fixed_lines.append(new_line)
|
||||||
|
if k == self.args['name'] and v == self.args['value']:
|
||||||
|
checked.append(k)
|
||||||
|
else:
|
||||||
if k not in checked:
|
if k not in checked:
|
||||||
checked.append(k)
|
checked.append(k)
|
||||||
if k == self.args['name']:
|
if k == self.args['name']:
|
||||||
|
|
@ -365,7 +383,9 @@ class SysctlModule(object):
|
||||||
else:
|
else:
|
||||||
new_line = "%s=%s\n" % (k, v)
|
new_line = "%s=%s\n" % (k, v)
|
||||||
self.fixed_lines.append(new_line)
|
self.fixed_lines.append(new_line)
|
||||||
|
else:
|
||||||
|
new_line = "%s=%s\n" % (k, v)
|
||||||
|
self.fixed_lines.append(new_line)
|
||||||
if self.args['name'] not in checked and self.args['state'] == "present":
|
if self.args['name'] not in checked and self.args['state'] == "present":
|
||||||
new_line = "%s=%s\n" % (self.args['name'], self.args['value'])
|
new_line = "%s=%s\n" % (self.args['name'], self.args['value'])
|
||||||
self.fixed_lines.append(new_line)
|
self.fixed_lines.append(new_line)
|
||||||
|
|
@ -401,7 +421,8 @@ def main():
|
||||||
reload=dict(default=True, type='bool'),
|
reload=dict(default=True, type='bool'),
|
||||||
sysctl_set=dict(default=False, type='bool'),
|
sysctl_set=dict(default=False, type='bool'),
|
||||||
ignoreerrors=dict(default=False, type='bool'),
|
ignoreerrors=dict(default=False, type='bool'),
|
||||||
sysctl_file=dict(default='/etc/sysctl.conf', type='path')
|
sysctl_file=dict(default='/etc/sysctl.conf', type='path'),
|
||||||
|
allow_duplicate=dict(default=False, type='bool',)
|
||||||
),
|
),
|
||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
required_if=[('state', 'present', ['value'])],
|
required_if=[('state', 'present', ['value'])],
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1 @@
|
||||||
tests/utils/shippable/timing.py shebang
|
tests/utils/shippable/timing.py shebang
|
||||||
plugins/action/synchronize.py pylint:ansible-bad-import-from
|
|
||||||
plugins/callback/cgroup_perf_recap.py pylint:ansible-bad-import-from
|
|
||||||
plugins/modules/mount.py pylint:ansible-bad-import-from
|
|
||||||
plugins/modules/sysctl.py pylint:ansible-bad-import-from
|
|
||||||
plugins/shell/csh.py pylint:ansible-bad-import-from
|
|
||||||
plugins/shell/fish.py pylint:ansible-bad-import-from
|
|
||||||
tests/unit/mock/procenv.py pylint:ansible-bad-import-from
|
|
||||||
tests/unit/mock/yaml_helper.py pylint:ansible-bad-import-from
|
|
||||||
tests/unit/modules/conftest.py pylint:ansible-bad-import-from
|
|
||||||
|
|
|
||||||
10
tests/sanity/ignore-2.21.txt
Normal file
10
tests/sanity/ignore-2.21.txt
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
tests/utils/shippable/timing.py shebang
|
||||||
|
plugins/action/synchronize.py pylint:ansible-bad-import-from
|
||||||
|
plugins/callback/cgroup_perf_recap.py pylint:ansible-bad-import-from
|
||||||
|
plugins/modules/mount.py pylint:ansible-bad-import-from
|
||||||
|
plugins/modules/sysctl.py pylint:ansible-bad-import-from
|
||||||
|
plugins/shell/csh.py pylint:ansible-bad-import-from
|
||||||
|
plugins/shell/fish.py pylint:ansible-bad-import-from
|
||||||
|
tests/unit/mock/procenv.py pylint:ansible-bad-import-from
|
||||||
|
tests/unit/mock/yaml_helper.py pylint:ansible-bad-import-from
|
||||||
|
tests/unit/modules/conftest.py pylint:ansible-bad-import-from
|
||||||
Loading…
Reference in a new issue