gconftool2/gconftool2_info: add return value version (#9064)

* add return value version

* add changelog frag
This commit is contained in:
Alexei Znamensky 2024-10-27 21:36:52 +13:00 committed by GitHub
parent 107df41d9c
commit ce1b9887b1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 64 additions and 2 deletions

View file

@ -96,6 +96,12 @@ previous_value:
returned: success
type: str
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
@ -129,6 +135,10 @@ class GConftool(StateModuleHelper):
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"')
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('value_type', self.vars.value_type)
self.vars.set('_value', self.vars.previous_value, output=False, change=True)