gconftool2/gconftool2_info: add return value version (#9064)
* add return value version * add changelog fragpull/9067/head
parent
107df41d9c
commit
ce1b9887b1
|
@ -0,0 +1,4 @@
|
||||||
|
minor_changes:
|
||||||
|
- gcontool2 module utils - add argument formatter ``version`` (https://github.com/ansible-collections/community.general/pull/9064).
|
||||||
|
- gcontool2 - add return value ``version`` (https://github.com/ansible-collections/community.general/pull/9064).
|
||||||
|
- gcontool2_info - add return value ``version`` (https://github.com/ansible-collections/community.general/pull/9064).
|
|
@ -27,6 +27,7 @@ def gconftool2_runner(module, **kwargs):
|
||||||
value=cmd_runner_fmt.as_list(),
|
value=cmd_runner_fmt.as_list(),
|
||||||
direct=cmd_runner_fmt.as_bool("--direct"),
|
direct=cmd_runner_fmt.as_bool("--direct"),
|
||||||
config_source=cmd_runner_fmt.as_opt_val("--config-source"),
|
config_source=cmd_runner_fmt.as_opt_val("--config-source"),
|
||||||
|
version=cmd_runner_fmt.as_fixed("--version"),
|
||||||
),
|
),
|
||||||
**kwargs
|
**kwargs
|
||||||
)
|
)
|
||||||
|
|
|
@ -96,6 +96,12 @@ previous_value:
|
||||||
returned: success
|
returned: success
|
||||||
type: str
|
type: str
|
||||||
sample: "Serif 12"
|
sample: "Serif 12"
|
||||||
|
version:
|
||||||
|
description: Version of gconftool-2.
|
||||||
|
type: str
|
||||||
|
returned: always
|
||||||
|
sample: "3.2.6"
|
||||||
|
version_added: 10.0.0
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.module_helper import StateModuleHelper
|
from ansible_collections.community.general.plugins.module_utils.module_helper import StateModuleHelper
|
||||||
|
@ -129,6 +135,10 @@ class GConftool(StateModuleHelper):
|
||||||
if not self.vars.direct and self.vars.config_source is not None:
|
if not self.vars.direct and self.vars.config_source is not None:
|
||||||
self.do_raise('If the "config_source" is specified then "direct" must be "true"')
|
self.do_raise('If the "config_source" is specified then "direct" must be "true"')
|
||||||
|
|
||||||
|
with self.runner("version") as ctx:
|
||||||
|
rc, out, err = ctx.run()
|
||||||
|
self.vars.version = out.strip()
|
||||||
|
|
||||||
self.vars.set('previous_value', self._get(), fact=True)
|
self.vars.set('previous_value', self._get(), fact=True)
|
||||||
self.vars.set('value_type', self.vars.value_type)
|
self.vars.set('value_type', self.vars.value_type)
|
||||||
self.vars.set('_value', self.vars.previous_value, output=False, change=True)
|
self.vars.set('_value', self.vars.previous_value, output=False, change=True)
|
||||||
|
|
|
@ -50,6 +50,12 @@ value:
|
||||||
returned: success
|
returned: success
|
||||||
type: str
|
type: str
|
||||||
sample: Monospace 10
|
sample: Monospace 10
|
||||||
|
version:
|
||||||
|
description: Version of gconftool-2.
|
||||||
|
type: str
|
||||||
|
returned: always
|
||||||
|
sample: "3.2.6"
|
||||||
|
version_added: 10.0.0
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from ansible_collections.community.general.plugins.module_utils.module_helper import ModuleHelper
|
from ansible_collections.community.general.plugins.module_utils.module_helper import ModuleHelper
|
||||||
|
@ -68,6 +74,9 @@ class GConftoolInfo(ModuleHelper):
|
||||||
|
|
||||||
def __init_module__(self):
|
def __init_module__(self):
|
||||||
self.runner = gconftool2_runner(self.module, check_rc=True)
|
self.runner = gconftool2_runner(self.module, check_rc=True)
|
||||||
|
with self.runner("version") as ctx:
|
||||||
|
rc, out, err = ctx.run()
|
||||||
|
self.vars.version = out.strip()
|
||||||
|
|
||||||
def __run__(self):
|
def __run__(self):
|
||||||
with self.runner.context(args_order=["state", "key"]) as ctx:
|
with self.runner.context(args_order=["state", "key"]) as ctx:
|
||||||
|
|
|
@ -13,11 +13,17 @@
|
||||||
output:
|
output:
|
||||||
new_value: '200'
|
new_value: '200'
|
||||||
changed: true
|
changed: true
|
||||||
|
version: "3.2.6"
|
||||||
mocks:
|
mocks:
|
||||||
run_command:
|
run_command:
|
||||||
- command: [/testbin/gconftool-2, --get, /desktop/gnome/background/picture_filename]
|
- command: [/testbin/gconftool-2, --version]
|
||||||
environ: &env-def {environ_update: {LANGUAGE: C, LC_ALL: C}, check_rc: true}
|
environ: &env-def {environ_update: {LANGUAGE: C, LC_ALL: C}, check_rc: true}
|
||||||
rc: 0
|
rc: 0
|
||||||
|
out: "3.2.6\n"
|
||||||
|
err: ""
|
||||||
|
- command: [/testbin/gconftool-2, --get, /desktop/gnome/background/picture_filename]
|
||||||
|
environ: *env-def
|
||||||
|
rc: 0
|
||||||
out: "100\n"
|
out: "100\n"
|
||||||
err: ""
|
err: ""
|
||||||
- command: [/testbin/gconftool-2, --type, int, --set, /desktop/gnome/background/picture_filename, "200"]
|
- command: [/testbin/gconftool-2, --type, int, --set, /desktop/gnome/background/picture_filename, "200"]
|
||||||
|
@ -39,8 +45,14 @@
|
||||||
output:
|
output:
|
||||||
new_value: '200'
|
new_value: '200'
|
||||||
changed: false
|
changed: false
|
||||||
|
version: "3.2.5"
|
||||||
mocks:
|
mocks:
|
||||||
run_command:
|
run_command:
|
||||||
|
- command: [/testbin/gconftool-2, --version]
|
||||||
|
environ: *env-def
|
||||||
|
rc: 0
|
||||||
|
out: "3.2.5\n"
|
||||||
|
err: ""
|
||||||
- command: [/testbin/gconftool-2, --get, /desktop/gnome/background/picture_filename]
|
- command: [/testbin/gconftool-2, --get, /desktop/gnome/background/picture_filename]
|
||||||
environ: *env-def
|
environ: *env-def
|
||||||
rc: 0
|
rc: 0
|
||||||
|
@ -65,8 +77,14 @@
|
||||||
output:
|
output:
|
||||||
new_value: 'false'
|
new_value: 'false'
|
||||||
changed: false
|
changed: false
|
||||||
|
version: "3.2.4"
|
||||||
mocks:
|
mocks:
|
||||||
run_command:
|
run_command:
|
||||||
|
- command: [/testbin/gconftool-2, --version]
|
||||||
|
environ: *env-def
|
||||||
|
rc: 0
|
||||||
|
out: "3.2.4\n"
|
||||||
|
err: ""
|
||||||
- command: [/testbin/gconftool-2, --get, /apps/gnome_settings_daemon/screensaver/start_screensaver]
|
- command: [/testbin/gconftool-2, --get, /apps/gnome_settings_daemon/screensaver/start_screensaver]
|
||||||
environ: *env-def
|
environ: *env-def
|
||||||
rc: 0
|
rc: 0
|
||||||
|
@ -91,6 +109,11 @@
|
||||||
changed: true
|
changed: true
|
||||||
mocks:
|
mocks:
|
||||||
run_command:
|
run_command:
|
||||||
|
- command: [/testbin/gconftool-2, --version]
|
||||||
|
environ: *env-def
|
||||||
|
rc: 0
|
||||||
|
out: "3.2.4\n"
|
||||||
|
err: ""
|
||||||
- command: [/testbin/gconftool-2, --get, /desktop/gnome/background/picture_filename]
|
- command: [/testbin/gconftool-2, --get, /desktop/gnome/background/picture_filename]
|
||||||
environ: *env-def
|
environ: *env-def
|
||||||
rc: 0
|
rc: 0
|
||||||
|
@ -110,6 +133,11 @@
|
||||||
changed: false
|
changed: false
|
||||||
mocks:
|
mocks:
|
||||||
run_command:
|
run_command:
|
||||||
|
- command: [/testbin/gconftool-2, --version]
|
||||||
|
environ: *env-def
|
||||||
|
rc: 0
|
||||||
|
out: "3.2.4\n"
|
||||||
|
err: ""
|
||||||
- command: [/testbin/gconftool-2, --get, /apps/gnome_settings_daemon/screensaver/start_screensaver]
|
- command: [/testbin/gconftool-2, --get, /apps/gnome_settings_daemon/screensaver/start_screensaver]
|
||||||
environ: *env-def
|
environ: *env-def
|
||||||
rc: 0
|
rc: 0
|
||||||
|
|
|
@ -11,9 +11,14 @@
|
||||||
value: '100'
|
value: '100'
|
||||||
mocks:
|
mocks:
|
||||||
run_command:
|
run_command:
|
||||||
- command: [/testbin/gconftool-2, --get, /desktop/gnome/background/picture_filename]
|
- command: [/testbin/gconftool-2, --version]
|
||||||
environ: &env-def {environ_update: {LANGUAGE: C, LC_ALL: C}, check_rc: true}
|
environ: &env-def {environ_update: {LANGUAGE: C, LC_ALL: C}, check_rc: true}
|
||||||
rc: 0
|
rc: 0
|
||||||
|
out: "3.2.6\n"
|
||||||
|
err: ""
|
||||||
|
- command: [/testbin/gconftool-2, --get, /desktop/gnome/background/picture_filename]
|
||||||
|
environ: *env-def
|
||||||
|
rc: 0
|
||||||
out: "100\n"
|
out: "100\n"
|
||||||
err: ""
|
err: ""
|
||||||
- id: test_simple_element_get_not_found
|
- id: test_simple_element_get_not_found
|
||||||
|
@ -23,6 +28,11 @@
|
||||||
value:
|
value:
|
||||||
mocks:
|
mocks:
|
||||||
run_command:
|
run_command:
|
||||||
|
- command: [/testbin/gconftool-2, --version]
|
||||||
|
environ: *env-def
|
||||||
|
rc: 0
|
||||||
|
out: "3.2.6\n"
|
||||||
|
err: ""
|
||||||
- command: [/testbin/gconftool-2, --get, /desktop/gnome/background/picture_filename]
|
- command: [/testbin/gconftool-2, --get, /desktop/gnome/background/picture_filename]
|
||||||
environ: *env-def
|
environ: *env-def
|
||||||
rc: 0
|
rc: 0
|
||||||
|
|
Loading…
Reference in New Issue