Skip to content

Commit fede6ce

Browse files
dsiherCopilotjazaval
authored
Sets HOME in defaults to fix broken behavior (#293)
* Sets HOME to the user directory otherwise defaults read/write has strange behavior --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Jacob Zaval <jazava@microsoft.com>
1 parent 9405201 commit fede6ce

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

metadata.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
license 'MIT'
55
description 'Resources for configuring and provisioning macOS'
66
chef_version '>= 16.0'
7-
version '6.0.7'
7+
version '6.0.8'
88

99
source_url 'https://github.com/Microsoft/macos-cookbook'
1010
issues_url 'https://github.com/Microsoft/macos-cookbook/issues'

resources/defaults.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
property :read_only, [true, false], default: false
88
property :settings, Hash
99
property :system, [true, false]
10-
property :user, String
10+
property :user, String, required: true
1111

1212
action_class do
1313
def convert_to_string_from_data_type(value)
@@ -41,6 +41,7 @@ def convert_to_string_from_data_type(value)
4141
execute "#{setting} to #{value}" do
4242
command "/usr/bin/defaults #{new_resource.option} #{Shellwords.shellescape(new_resource.domain)} #{Shellwords.shellescape(setting)} #{value}"
4343
user new_resource.user
44+
environment({ 'HOME' => MacOS::UserPath.home(new_resource.user) })
4445
end
4546
end
4647
end

0 commit comments

Comments
 (0)