From bcace3cfc4ec86aeeb0eb398b2a902143bc039bc Mon Sep 17 00:00:00 2001 From: Ken Evensen Date: Tue, 20 Dec 2016 06:53:49 -0500 Subject: [PATCH] Gconf2 module (#19540) * Pull #19267 broke sysctl module. Minor corrections * Correct description. Functional updates --- lib/ansible/modules/system/gconftool2.py | 27 ++++++++++++++++-------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/lib/ansible/modules/system/gconftool2.py b/lib/ansible/modules/system/gconftool2.py index 2e356d50e14..3bdd65d51ce 100644 --- a/lib/ansible/modules/system/gconftool2.py +++ b/lib/ansible/modules/system/gconftool2.py @@ -26,9 +26,8 @@ author: - "Kenneth D. Evensen (@kevensen)" short_description: Edit GNOME Configurations description: - - Edit PAM service's type, control, module path and module arguments. - In order for a PAM rule to be modified, the type, control and - module_path must match an existing rule. See man(5) pam.d for details. + - This module allows for the manipulation of GNOME 2 Configuration via + gconftool-2. Please see the gconftool-2(1) man pages for more details. version_added: "2.3" options: key: @@ -55,8 +54,8 @@ options: required: true choices: - get - - set - - unset + - present + - absent description: - The action to take upon the key/value. config_source: @@ -175,7 +174,7 @@ def main(): value=dict(required=False, default=None, type='str'), state=dict(required=True, default=None, - choices=['set', 'get', 'unset'], + choices=['present', 'get', 'absent'], type='str'), direct=dict(required=False, default=False, type='bool'), @@ -185,12 +184,20 @@ def main(): supports_check_mode=True ) + state_values = {"present": "set", "absent": "unset", "get": "get"} + direct = False # Assign module values to dictionary values key = module.params['key'] value_type = module.params['value_type'] - value = module.params['value'] - state = module.params['state'] + if module.params['value'].lower() == "true": + value = "true" + elif module.params['value'] == "false": + value = "false" + else: + value = module.params['value'] + + state = state_values[module.params['state']] if module.params['direct'] in BOOLEANS_TRUE: direct = True config_source = module.params['config_source'] @@ -239,7 +246,9 @@ def main(): facts = {} facts['gconftool2'] = {'changed': change, 'key': key, - 'value_type': value_type, 'value': new_value} + 'value_type': value_type, 'new_value': new_value, + 'previous_value': current_value, + 'playbook_value': module.params['value']} module.exit_json(changed=change, ansible_facts=facts)