Skip to content

Commit

Permalink
osx_defaults: add expand_user_and_vars flag to write (#5243) (#5260)
Browse files Browse the repository at this point in the history
* 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>
(cherry picked from commit f929422)

Co-authored-by: Pavel Zwerschke <pavelzw@gmail.com>
  • Loading branch information
patchback[bot] and pavelzw committed Sep 10, 2022
1 parent 21ad7c8 commit bc32914
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions changelogs/fragments/5243-osx-defaults-expand-user-flags.yml
Original file line number Diff line number Diff line change
@@ -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).
3 changes: 2 additions & 1 deletion plugins/modules/system/osx_defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,8 @@ def write(self):
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)
Expand Down

0 comments on commit bc32914

Please sign in to comment.