mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-25 06:10:22 -07:00
xfconf: small refactor (#10311)
Some checks are pending
EOL CI / EOL Sanity (Ⓐ2.16) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.16+py2.7) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.16+py3.11) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.16+py3.6) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+alpine3+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+alpine3+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+alpine3+py:azp/posix/3/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+fedora38+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+fedora38+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+fedora38+py:azp/posix/3/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+opensuse15+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+opensuse15+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+opensuse15+py:azp/posix/3/) (push) Waiting to run
nox / Run extra sanity tests (push) Waiting to run
Some checks are pending
EOL CI / EOL Sanity (Ⓐ2.16) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.16+py2.7) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.16+py3.11) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.16+py3.6) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+alpine3+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+alpine3+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+alpine3+py:azp/posix/3/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+fedora38+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+fedora38+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+fedora38+py:azp/posix/3/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+opensuse15+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+opensuse15+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.16+opensuse15+py:azp/posix/3/) (push) Waiting to run
nox / Run extra sanity tests (push) Waiting to run
* xfconf: small refactor * add changelog frag * Update changelogs/fragments/10311-xfconf-refactor.yml Co-authored-by: Felix Fontein <felix@fontein.de> --------- Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
7d06be1c20
commit
5462b1cff8
2 changed files with 7 additions and 7 deletions
|
@ -178,7 +178,7 @@ class XFConfProperty(StateModuleHelper):
|
|||
output_params = ('property', 'channel', 'value')
|
||||
module = dict(
|
||||
argument_spec=dict(
|
||||
state=dict(type='str', choices=("present", "absent"), default="present"),
|
||||
state=dict(type='str', choices=('present', 'absent'), default='present'),
|
||||
channel=dict(type='str', required=True),
|
||||
property=dict(type='str', required=True),
|
||||
value_type=dict(type='list', elements='str',
|
||||
|
@ -191,8 +191,6 @@ class XFConfProperty(StateModuleHelper):
|
|||
supports_check_mode=True,
|
||||
)
|
||||
|
||||
default_state = 'present'
|
||||
|
||||
def __init_module__(self):
|
||||
self.runner = xfconf_runner(self.module)
|
||||
self.vars.version = get_xfconf_version(self.runner)
|
||||
|
@ -208,8 +206,8 @@ class XFConfProperty(StateModuleHelper):
|
|||
self.do_raise('xfconf-query failed with error (rc={0}): {1}'.format(rc, err))
|
||||
|
||||
result = out.rstrip()
|
||||
if "Value is an array with" in result:
|
||||
result = result.split("\n")
|
||||
if 'Value is an array with' in result:
|
||||
result = result.split('\n')
|
||||
result.pop(0)
|
||||
result.pop(0)
|
||||
|
||||
|
@ -225,7 +223,7 @@ class XFConfProperty(StateModuleHelper):
|
|||
self.vars.stdout = ctx.results_out
|
||||
self.vars.stderr = ctx.results_err
|
||||
self.vars.cmd = ctx.cmd
|
||||
self.vars.set("run_info", ctx.run_info, verbosity=4)
|
||||
self.vars.set('run_info', ctx.run_info, verbosity=4)
|
||||
self.vars.value = None
|
||||
|
||||
def state_present(self):
|
||||
|
@ -255,7 +253,7 @@ class XFConfProperty(StateModuleHelper):
|
|||
self.vars.stdout = ctx.results_out
|
||||
self.vars.stderr = ctx.results_err
|
||||
self.vars.cmd = ctx.cmd
|
||||
self.vars.set("run_info", ctx.run_info, verbosity=4)
|
||||
self.vars.set('run_info', ctx.run_info, verbosity=4)
|
||||
|
||||
if not self.vars.is_array:
|
||||
self.vars.value = self.vars.value[0]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue