1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

osx_defaults: add expand_user_and_vars flag to write (#5243)

* Add expand_user_and_vars flag to write

Closes #5234

* Add changelog

* Update changelogs/fragments/5243-osx-defaults-expand-user-flags.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
Pavel Zwerschke 2022-09-10 10:52:14 +02:00 committed by GitHub
parent 775be1d3f3
commit f929422dac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- osx_defaults - no longer expand ``~`` in ``value`` to the user's home directory, or expand environment variables (https://github.com/ansible-collections/community.general/issues/5234, https://github.com/ansible-collections/community.general/pull/5243).

View file

@ -304,7 +304,8 @@ class OSXDefaults(object):
if not isinstance(value, list):
value = [value]
rc, out, err = self.module.run_command(self._base_command() + ['write', self.domain, self.key, '-' + self.type] + value)
rc, out, err = self.module.run_command(self._base_command() + ['write', self.domain, self.key, '-' + self.type] + value,
expand_user_and_vars=False)
if rc != 0:
raise OSXDefaultsException('An error occurred while writing value to defaults: %s' % out)