mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Update xfconf.py: make locale-independent (#744)
* Update xfconf.py - ensure correct behaviour, even in desktop environments which don't use English as the default language - add double as content type * set environ_update for entire module * set envvar LANGUAGE instead of LANG because of priority order in evaluating them
This commit is contained in:
parent
0e8cc31799
commit
d13b026f47
2 changed files with 10 additions and 4 deletions
|
@ -0,0 +1,5 @@
|
|||
minor_changes:
|
||||
- xfconf - add support for ``double`` type (https://github.com/ansible-collections/community.general/pull/744).
|
||||
bugfixes:
|
||||
- xfconf - make it work in non-english locales (https://github.com/ansible-collections/community.general/pull/744).
|
||||
|
|
@ -44,7 +44,7 @@ options:
|
|||
For array mode, use a list of types.
|
||||
type: list
|
||||
elements: str
|
||||
choices: [ int, uint, bool, float, string ]
|
||||
choices: [ int, uint, bool, float, double, string ]
|
||||
state:
|
||||
description:
|
||||
- The action to take upon the property/value.
|
||||
|
@ -124,7 +124,7 @@ class XfConfProperty(object):
|
|||
GET = "get"
|
||||
RESET = "absent"
|
||||
VALID_STATES = (SET, GET, RESET)
|
||||
VALID_VALUE_TYPES = ('int', 'uint', 'bool', 'float', 'string')
|
||||
VALID_VALUE_TYPES = ('int', 'uint', 'bool', 'float', 'double', 'string')
|
||||
previous_value = None
|
||||
is_array = None
|
||||
|
||||
|
@ -144,8 +144,6 @@ class XfConfProperty(object):
|
|||
self.method_map = dict(zip((self.SET, self.GET, self.RESET),
|
||||
(self.set, self.get, self.reset)))
|
||||
|
||||
# @TODO This will not work with non-English translations, but xfconf-query does not return
|
||||
# distinct result codes for distinct outcomes.
|
||||
self.does_not = 'Property "{0}" does not exist on channel "{1}".'.format(self.property, self.channel)
|
||||
|
||||
def run(cmd):
|
||||
|
@ -264,6 +262,9 @@ def main():
|
|||
supports_check_mode=True
|
||||
)
|
||||
|
||||
# Force language to 'C' to ensure return values are always formatted in english, even in non-english environments
|
||||
module.run_command_environ_update = dict(LANGUAGE='C')
|
||||
|
||||
state = module.params['state']
|
||||
|
||||
try:
|
||||
|
|
Loading…
Reference in a new issue