Nuke systemd module user option, 2.11 deprecation (#70211)
Change: Remove all references to the 'user' param in systemd module. Test Plan: CI and grep. Signed-off-by: Rick Elrod <rick@elrod.me>
This commit is contained in:
parent
9cfc76a221
commit
c9edb35652
3 changed files with 2 additions and 19 deletions
2
changelogs/fragments/deprecation-systemd-user.yml
Normal file
2
changelogs/fragments/deprecation-systemd-user.yml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
removed_features:
|
||||||
|
- The "user" parameter was previously deprecated and is now removed in favor of "scope"
|
|
@ -54,13 +54,6 @@ options:
|
||||||
default: no
|
default: no
|
||||||
aliases: [ daemon-reexec ]
|
aliases: [ daemon-reexec ]
|
||||||
version_added: "2.8"
|
version_added: "2.8"
|
||||||
user:
|
|
||||||
description:
|
|
||||||
- (deprecated) run ``systemctl`` talking to the service manager of the calling user, rather than the service manager
|
|
||||||
of the system.
|
|
||||||
- This option is deprecated and will eventually be removed in 2.11. The ``scope`` option should be used instead.
|
|
||||||
type: bool
|
|
||||||
default: no
|
|
||||||
scope:
|
scope:
|
||||||
description:
|
description:
|
||||||
- run systemctl within a given service manager scope, either as the default system scope (system),
|
- run systemctl within a given service manager scope, either as the default system scope (system),
|
||||||
|
@ -329,7 +322,6 @@ def main():
|
||||||
masked=dict(type='bool'),
|
masked=dict(type='bool'),
|
||||||
daemon_reload=dict(type='bool', default=False, aliases=['daemon-reload']),
|
daemon_reload=dict(type='bool', default=False, aliases=['daemon-reload']),
|
||||||
daemon_reexec=dict(type='bool', default=False, aliases=['daemon-reexec']),
|
daemon_reexec=dict(type='bool', default=False, aliases=['daemon-reexec']),
|
||||||
user=dict(type='bool'),
|
|
||||||
scope=dict(type='str', default='system', choices=['system', 'user', 'global']),
|
scope=dict(type='str', default='system', choices=['system', 'user', 'global']),
|
||||||
no_block=dict(type='bool', default=False),
|
no_block=dict(type='bool', default=False),
|
||||||
),
|
),
|
||||||
|
@ -340,7 +332,6 @@ def main():
|
||||||
enabled=('name', ),
|
enabled=('name', ),
|
||||||
masked=('name', ),
|
masked=('name', ),
|
||||||
),
|
),
|
||||||
mutually_exclusive=[['scope', 'user']],
|
|
||||||
)
|
)
|
||||||
|
|
||||||
unit = module.params['name']
|
unit = module.params['name']
|
||||||
|
@ -355,14 +346,6 @@ def main():
|
||||||
os.environ['XDG_RUNTIME_DIR'] = '/run/user/%s' % os.geteuid()
|
os.environ['XDG_RUNTIME_DIR'] = '/run/user/%s' % os.geteuid()
|
||||||
|
|
||||||
''' Set CLI options depending on params '''
|
''' Set CLI options depending on params '''
|
||||||
if module.params['user'] is not None:
|
|
||||||
# handle user deprecation, mutually exclusive with scope
|
|
||||||
module.deprecate("The 'user' option is being replaced by 'scope'", version='2.11', collection_name='ansible.builtin')
|
|
||||||
if module.params['user']:
|
|
||||||
module.params['scope'] = 'user'
|
|
||||||
else:
|
|
||||||
module.params['scope'] = 'system'
|
|
||||||
|
|
||||||
# if scope is 'system' or None, we can ignore as there is no extra switch.
|
# if scope is 'system' or None, we can ignore as there is no extra switch.
|
||||||
# The other choices match the corresponding switch
|
# The other choices match the corresponding switch
|
||||||
if module.params['scope'] != 'system':
|
if module.params['scope'] != 'system':
|
||||||
|
@ -486,7 +469,6 @@ def main():
|
||||||
elif rc == 1:
|
elif rc == 1:
|
||||||
# if not a user or global user service and both init script and unit file exist stdout should have enabled/disabled, otherwise use rc entries
|
# if not a user or global user service and both init script and unit file exist stdout should have enabled/disabled, otherwise use rc entries
|
||||||
if module.params['scope'] == 'system' and \
|
if module.params['scope'] == 'system' and \
|
||||||
not module.params['user'] and \
|
|
||||||
is_initd and \
|
is_initd and \
|
||||||
not out.strip().endswith('disabled') and \
|
not out.strip().endswith('disabled') and \
|
||||||
sysv_is_enabled(unit):
|
sysv_is_enabled(unit):
|
||||||
|
|
|
@ -159,7 +159,6 @@ lib/ansible/modules/service.py validate-modules:use-run-command-not-popen
|
||||||
lib/ansible/modules/setup.py validate-modules:doc-missing-type
|
lib/ansible/modules/setup.py validate-modules:doc-missing-type
|
||||||
lib/ansible/modules/setup.py validate-modules:parameter-list-no-elements
|
lib/ansible/modules/setup.py validate-modules:parameter-list-no-elements
|
||||||
lib/ansible/modules/setup.py validate-modules:parameter-type-not-in-doc
|
lib/ansible/modules/setup.py validate-modules:parameter-type-not-in-doc
|
||||||
lib/ansible/modules/systemd.py pylint:ansible-deprecated-version
|
|
||||||
lib/ansible/modules/systemd.py validate-modules:parameter-invalid
|
lib/ansible/modules/systemd.py validate-modules:parameter-invalid
|
||||||
lib/ansible/modules/systemd.py validate-modules:parameter-type-not-in-doc
|
lib/ansible/modules/systemd.py validate-modules:parameter-type-not-in-doc
|
||||||
lib/ansible/modules/systemd.py validate-modules:return-syntax-error
|
lib/ansible/modules/systemd.py validate-modules:return-syntax-error
|
||||||
|
|
Loading…
Reference in a new issue