Update to load_current_resource replacing 'truthy' with 'truefalse'. #8

Merged
merged 2 commits into from Apr 15, 2012

Projects

None yet

2 participants

Contributor
agh commented Mar 4, 2012

Right now we only convert 'TRUE' or 'true' which leads to a situation whereby chef-client reapplies settings (defaults write -bool 'false') upon each run because the recipe value may validly be 'false'.

defaults --help
  <value> is one of:
    -bool[ean] (true | false | yes | no)

Example recipe snippet which triggers this situation -

mac_os_x_userdefaults "dont show quarantine warnings on downloaded files" do
  domain "com.apple.LaunchServices"
  key "LSQuarantine"
  value "false"
  type "bool"
  notifies :run, 'execute[killall Finder]'
  only_if { node[:platform_version].to_f >= 10.5 }
end

I've also taken the opportunity to extend things so that "YES" and "yes" are considered to be true values, because they would be accepted on the command-line by /usr/bin/defaults as valid input.

agh added some commits Mar 4, 2012
@agh agh Update to load_current_resource replacing 'truthy' with 'truefalse'.
    defaults --help
    <value> is one of:
      -bool[ean] (true | false | yes | no)

Right now we only convert 'TRUE' or 'true' which leads to a situation whereby chef-client reapplies settings (defaults write <DOMAIN> <KEY> -bool 'false') upon each run because the recipe value may validly be 'false'.

Example recipe snippet which triggers this situation -

  mac_os_x_userdefaults "dont show quarantine warnings on downloaded files" do
    domain "com.apple.LaunchServices"
    key "LSQuarantine"
    value "false"
    type "bool"
    notifies :run, 'execute[killall Finder]'
    only_if { node[:platform_version].to_f >= 10.5 }
  end

I've also taken the opportunity to extend things so that "YES" and "yes" are considered to be true values, because they would be accepted on the command-line by /usr/bin/defaults as valid input.
4f07be3
@agh agh A minor update to documentation to reference false values now being h…
…andled by the Provider.
e785985
@jtimberman jtimberman merged commit 5ed2619 into chef-osx:master Apr 15, 2012
Owner

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment