Permalink
Browse files

fix domain specification

-g is a shortcut for specifying NSGlobalDomain. As it was, it was
possible to specify a domain and mark the setting as global, which is
incorrect and would fail. This change makes anything marked as global go
into NSGlobalDomain.
  • Loading branch information...
1 parent 8ed19a3 commit 86b0f9ca93d98f2ba8f68641ff71d5f257ab1db8 @bleything bleything committed Dec 9, 2011
Showing with 8 additions and 2 deletions.
  1. +8 −2 providers/userdefaults.rb
View
@@ -37,8 +37,14 @@ def load_current_resource
action :write do
unless @userdefaults.is_set
- cmd = "#{'sudo' if new_resource.sudo} defaults write #{new_resource.domain} "
- cmd << "-g " if new_resource.global
+ cmd = "#{'sudo' if new_resource.sudo} defaults write "
+
+ if new_resource.global
+ cmd << "NSGlobalDomain "
+ else
+ cmd << new_resource.domain + ' '
+ end
+
cmd << "'#{new_resource.key}' " if new_resource.key
if new_resource.value.is_a?(TrueClass) or new_resource.value.is_a?(FalseClass)

0 comments on commit 86b0f9c

Please sign in to comment.