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:
Rick Elrod 2020-06-23 10:55:01 -05:00 committed by GitHub
parent 9cfc76a221
commit c9edb35652
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 19 deletions

View file

@ -0,0 +1,2 @@
removed_features:
- The "user" parameter was previously deprecated and is now removed in favor of "scope"

View file

@ -54,13 +54,6 @@ options:
default: no
aliases: [ daemon-reexec ]
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:
description:
- 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'),
daemon_reload=dict(type='bool', default=False, aliases=['daemon-reload']),
daemon_reexec=dict(type='bool', default=False, aliases=['daemon-reexec']),
user=dict(type='bool'),
scope=dict(type='str', default='system', choices=['system', 'user', 'global']),
no_block=dict(type='bool', default=False),
),
@ -340,7 +332,6 @@ def main():
enabled=('name', ),
masked=('name', ),
),
mutually_exclusive=[['scope', 'user']],
)
unit = module.params['name']
@ -355,14 +346,6 @@ def main():
os.environ['XDG_RUNTIME_DIR'] = '/run/user/%s' % os.geteuid()
''' 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.
# The other choices match the corresponding switch
if module.params['scope'] != 'system':
@ -486,7 +469,6 @@ def main():
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 module.params['scope'] == 'system' and \
not module.params['user'] and \
is_initd and \
not out.strip().endswith('disabled') and \
sysv_is_enabled(unit):

View file

@ -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:parameter-list-no-elements
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-type-not-in-doc
lib/ansible/modules/systemd.py validate-modules:return-syntax-error