diff --git a/changelogs/fragments/deprecation-systemd-user.yml b/changelogs/fragments/deprecation-systemd-user.yml new file mode 100644 index 00000000000..5b8da8d7c52 --- /dev/null +++ b/changelogs/fragments/deprecation-systemd-user.yml @@ -0,0 +1,2 @@ +removed_features: + - The "user" parameter was previously deprecated and is now removed in favor of "scope" diff --git a/lib/ansible/modules/systemd.py b/lib/ansible/modules/systemd.py index b1eefae1037..29b35f83a8f 100644 --- a/lib/ansible/modules/systemd.py +++ b/lib/ansible/modules/systemd.py @@ -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): diff --git a/test/sanity/ignore.txt b/test/sanity/ignore.txt index 417dd93e3c8..8defe87bd88 100644 --- a/test/sanity/ignore.txt +++ b/test/sanity/ignore.txt @@ -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