1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-02-04 07:51:50 +00:00

xfconf: fix existing empty array case (#11026) (#11027)

* xfconf: fix existing empty array case

* fix xfconf_info as well

* add changelog frag

(cherry picked from commit b28ac655fc)
This commit is contained in:
Alexei Znamensky 2025-11-03 10:07:52 +13:00 committed by GitHub
parent cd4a02605e
commit 40eec12c2c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 64 additions and 6 deletions

View file

@ -206,10 +206,13 @@ 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')
result.pop(0)
result.pop(0)
if "Value is an array with" in result:
result = result.split("\n")
if len(result) > 1:
result.pop(0)
result.pop(0)
else:
return []
return result

View file

@ -153,9 +153,12 @@ class XFConfInfo(ModuleHelper):
result = out.rstrip()
if "Value is an array with" in result:
result = result.split("\n")
result.pop(0)
result.pop(0)
self.vars.is_array = True
if len(result) > 1:
result.pop(0)
result.pop(0)
else:
return []
return result