Skip to content

Commit

Permalink
osx_defaults: add expand_user_and_vars flag to write (ansible-collect…
Browse files Browse the repository at this point in the history
…ions#5243)

* Add expand_user_and_vars flag to write

Closes ansible-collections#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>
  • Loading branch information
2 people authored and Dušan Markovič committed Nov 7, 2022
1 parent c068f83 commit 370a18b
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 370a18b

Please sign in to comment.