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
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 9 additions & 6 deletions lib/ansible/modules/system/xfconf.py
Expand Up @@ -153,12 +153,7 @@ def main():
channel = module.params['channel']
property = module.params['property']
value_type = module.params['value_type']
if module.params['value'].lower() == "true":
value = "true"
elif module.params['value'] == "false":
value = "false"
else:
value = module.params['value']
value = module.params['value']

state = state_values[module.params['state']]

Expand All @@ -173,6 +168,10 @@ def main():
elif value_type is None or value_type == "":
module.fail_json(msg='State %s requires "value_type" to be set'
% str(state))
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()


# Create a Xfconf preference
xfconf = XfconfPreference(module,
Expand All @@ -183,6 +182,10 @@ def main():
# Now we get the current value, if not found don't fail
dummy, current_value = xfconf.call("get", fail_onerr=False)

# For state "get", fill in "value" with what we already know
if state == "get":
value = current_value

# Check if the current value equals the value we want to set. If not, make
# a change
if current_value != value:
Expand Down