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

xfconf: "get": don't set changed flag, don't require value #48331

Closed
wants to merge 2 commits into from

Conversation

mattiklock
Copy link

@mattiklock mattiklock commented Nov 8, 2018

SUMMARY

This change removes the need to pass a value when state equals "get" (it can still be passed -- it'll just be ignored, same as before), and makes sure that "get" always leaves the changed flag at false.

Below is a short ansible playbook for an XFCE4 machine that demonstrates both these behaviors and runs cleanly with the updated xfconf.py.

(Also, thank you very much to jbenden for creating this module!)

---
- hosts: 127.0.0.1
  connection: local

  tasks:
    - name: Fetch the theme
      xfconf:
        channel: xfwm4
        property: "/general/theme"
        state: get
        value: ''
      register: theme

    - debug:
        msg: "The theme is {{ theme.ansible_facts.xfconf.new_value }}"
        
    - name: Fetch the theme in a way that will blow up
      xfconf:
        channel: xfwm4
        property: "/general/theme"
        state: get
ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

xfconf

ANSIBLE VERSION
devel

This change removes the need to pass a value when state equals "get" (it can still be passed -- it'll just be ignored, same as before), and makes sure that "get" always leaves the changed flag at false.

Below is a short ansible playbook for an XFCE4 machine that demonstrates both these behaviors and runs cleanly with the updated xfconf.py.

(Also, thank you very much to @jbenden for creating this module!)

---
- hosts: 127.0.0.1
  connection: local

  tasks:
    - name: Fetch the theme
      xfconf:
        channel: xfwm4
        property: "/general/theme"
        state: get
        value: ''
      register: theme

    - debug:
        msg: "The theme is {{ theme.ansible_facts.xfconf.new_value }}"
        
    - name: Fetch the theme in a way that will blow up
      xfconf:
        channel: xfwm4
        property: "/general/theme"
        state: get
@ansibot
Copy link
Contributor

ansibot commented Nov 8, 2018

Hi @mattiklock, thank you for submitting this pull-request!

click here for bot help

@ansibot
Copy link
Contributor

ansibot commented Nov 8, 2018

@mattiklock This PR contains @ mentions in at least one commit message. Those mentions can cause cascading notifications through GitHub and need to be removed. Please squash or amend your commits to remove the mentions.

click here for bot help

@ansibot ansibot added affects_2.8 This issue/PR affects Ansible v2.8 bug This issue/PR relates to a bug. module This issue/PR relates to a module. needs_maintainer Ansibot is unable to identify maintainers for this PR. (Check `author` in docs or BOTMETA.yml) needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. needs_triage Needs a first human triage before being processed. new_contributor This PR is the first contribution by a new community member. support:community This issue/PR relates to code supported by the Ansible community. labels Nov 8, 2018
@ansibot
Copy link
Contributor

ansibot commented Nov 8, 2018

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

lib/ansible/modules/system/xfconf.py:184:0: trailing-whitespace Trailing whitespace

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

lib/ansible/modules/system/xfconf.py:184:1: W293 blank line contains whitespace

click here for bot help

@ansibot ansibot added the ci_verified Changes made in this PR are causing tests to fail. label Nov 8, 2018
pylint caught whitespace on 184
@ansibot ansibot removed the ci_verified Changes made in this PR are causing tests to fail. label Nov 8, 2018
@jborean93 jborean93 removed the needs_triage Needs a first human triage before being processed. label Nov 8, 2018
@jborean93 jborean93 changed the title "get": don't set changed flag, don't require value xfconf: "get": don't set changed flag, don't require value Nov 8, 2018
@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. and removed needs_maintainer Ansibot is unable to identify maintainers for this PR. (Check `author` in docs or BOTMETA.yml) labels Nov 16, 2018
@ansibot ansibot removed the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Nov 24, 2018
@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Dec 4, 2018
@gundalow gundalow closed this Dec 12, 2018
@gundalow gundalow reopened this Dec 12, 2018
@ansibot ansibot removed the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Dec 12, 2018
if value.lower() == "true":
value = "true"
elif value.lower() == "false":
value = "false"
Copy link
Contributor

Choose a reason for hiding this comment

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

not a blocker, but a simpler check would be

if value.lower() in ('true', 'false'):
    value = value.lower()

@mattiklock
Copy link
Author

That's true.

I think @jbenden actually resolved this problem anyway as part of the changes for #46308 -- at least it passes my test playbook!

@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Dec 27, 2018
@ansibot ansibot added the system System category label Feb 21, 2019
@russoz
Copy link
Contributor

russoz commented Jul 31, 2019

Any chance this gets merged in the near future? It is quite a small change (one of the zillions you have, I know). Just a friendly check.

@russoz
Copy link
Contributor

russoz commented Oct 6, 2019

This PR will be superseded by #62578

@ansibot ansibot added the needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html label Mar 30, 2020
@ansibot ansibot added collection Related to Ansible Collections work collection:community.general needs_collection_redirect https://github.com/ansible/ansibullbot/blob/master/docs/collection_migration.md labels Apr 29, 2020
@ansibot
Copy link
Contributor

ansibot commented Aug 16, 2020

Thank you very much for your interest in Ansible. Ansible has migrated much of the content into separate repositories to allow for more rapid, independent development. We are closing this issue/PR because this content has been moved to one or more collection repositories.

For further information, please see:
https://github.com/ansible/ansibullbot/blob/master/docs/collection_migration.md

@ansibot ansibot closed this Aug 16, 2020
@ansible ansible locked and limited conversation to collaborators Sep 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.8 This issue/PR affects Ansible v2.8 bot_closed bug This issue/PR relates to a bug. collection:community.general collection Related to Ansible Collections work module This issue/PR relates to a module. needs_collection_redirect https://github.com/ansible/ansibullbot/blob/master/docs/collection_migration.md needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html 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. support:community This issue/PR relates to code supported by the Ansible community. system System category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants