Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add scope parameter to systemd #40179

Merged
merged 5 commits into from
Aug 2, 2018
Merged

Add scope parameter to systemd #40179

merged 5 commits into from
Aug 2, 2018

Conversation

hi117
Copy link
Contributor

@hi117 hi117 commented May 15, 2018

SUMMARY

This change changes the user: paramater into a state: paramater with the following choices:

  • system
  • user
  • global

with system being the default. The system scope is the default scope. The user scope matches with the old user: paramater. The global scope applies to all users.

An example use case would be masking a unit. In the system scope it would create the mask via symlink from /etc/systemd/system/. In the user scope it would mask via symlink from ~/.config/systemd/user/. In the global scope it would mask via symlink from /etc/systemd/user/.

Previously a global: paramater was tested but since global is a keyword in python, it caused errors during testing. Since this patch removes the old user: paramater, it is a backwards incompatible change.

Fixes #38828

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

systemd

ANSIBLE VERSION
ansible 2.5.0
  config file = /home/hi117/.ansible.cfg
  configured module search path = [u'/home/hi117/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.15 (default, May  1 2018, 20:16:04) [GCC 7.3.1 20180406]
ADDITIONAL INFORMATION

Output of make tests-nonet, snipped to only the relavent tests.

test/units/modules/system/test_systemd.py::ParseSystemctlShowTestCase::test_multiline_exec PASSED
test/units/modules/system/test_systemd.py::ParseSystemctlShowTestCase::test_simple PASSED
test/units/modules/system/test_systemd.py::ParseSystemctlShowTestCase::test_single_line_with_brace PASSED 

@ansibot ansibot added core_review In order to be merged, this PR must follow the core review workflow. feature This issue/PR relates to a feature request. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. new_contributor This PR is the first contribution by a new community member. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels May 15, 2018
@ansibot
Copy link
Contributor

ansibot commented May 15, 2018

The test ansible-test sanity --test validate-modules [explain] failed with 1 error:

lib/ansible/modules/system/systemd.py:0:0: E309 version_added for new option (scope) should be 2.6. Currently 0.0

click here for bot help

@ansibot ansibot added ci_verified Changes made in this PR are causing tests to fail. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. and removed core_review In order to be merged, this PR must follow the core review workflow. labels May 15, 2018
@ansibot ansibot added core_review In order to be merged, this PR must follow the core review workflow. and removed ci_verified Changes made in this PR are causing tests to fail. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels May 15, 2018
@maxamillion maxamillion requested a review from bcoca May 15, 2018 22:17
@maxamillion maxamillion removed the needs_triage Needs a first human triage before being processed. label May 15, 2018
@ansibot ansibot added affects_2.6 This issue/PR affects Ansible v2.6 stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. labels May 23, 2018
@maxamillion
Copy link
Contributor

Hello and thank you for the pull request!

I'm a little concerned that this breaks backwards compatibility and it could have unexpected implications for users. Is there any approach to this that you can think of which would keep backwards compatibility and offer the fix?

@bcoca bcoca changed the title Fixes #38828 Add scope parameter to systemd May 25, 2018
@@ -48,12 +48,13 @@
type: bool
default: 'no'
aliases: [ daemon-reload ]
user:
scope:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with adding scope, but user should be deprecated, not removed and the interaction between both handled, with scope having precedence when set.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't see in the documentation, but is there a standard way of makring something as deprecated?

Copy link
Member

@bcoca bcoca May 30, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just add a note about deprecation in the description (and point to scope) and call module.deprecate() if it is set, our normal deprecation cycle is 4 versions, so if this goes in now (2.7) it should be removed in (2.11 or equivalent)

@ansibot ansibot added needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. and removed core_review In order to be merged, this PR must follow the core review workflow. labels May 25, 2018
@opoplawski
Copy link
Contributor

@hi117 just ran into this need. Any progress here?

@ansibot
Copy link
Contributor

ansibot commented Jul 14, 2018

The test ansible-test sanity --test validate-modules [explain] failed with 1 error:

lib/ansible/modules/system/systemd.py:0:0: E309 version_added for new option (scope) should be 2.7. Currently 2.6

click here for bot help

@ansibot ansibot added ci_verified Changes made in this PR are causing tests to fail. and removed stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. ci_verified Changes made in this PR are causing tests to fail. labels Jul 14, 2018
@hi117
Copy link
Contributor Author

hi117 commented Jul 14, 2018

I made the changes you suggested @bcoca, let me know if any other changes are needed.

@ansibot ansibot added stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. stale_review Updates were made after the last review and the last review is more than 7 days old. labels Jul 22, 2018
@bcoca bcoca merged commit 7ea9094 into ansible:devel Aug 2, 2018
@ansible ansible locked and limited conversation to collaborators Jul 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.6 This issue/PR affects Ansible v2.6 feature This issue/PR relates to a feature request. module This issue/PR relates to a module. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. new_contributor This PR is the first contribution by a new community member. stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. stale_review Updates were made after the last review and the last review is more than 7 days old. support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add global parameter to the systemd module
5 participants