dayglojesus / managedmac

Comprehensive Puppet module for OS X.
http://dayglojesus.github.io/managedmac/
Apache License 2.0
62 stars 21 forks source link

Is it possible to have nested values with the mobileconfig provider? #28

Closed groob closed 10 years ago

groob commented 10 years ago

Here's what I'm trying to accomplish:

managedmac::mobileconfigs::defaults:
  description:  'Installed by Puppet.'
  organization: 'Whitby School'
managedmac::mobileconfigs::payloads:
  'com.apple.Safari':
    content:
      HomePage: 'http://www.google.com/'
      NewWindowBehavior: '0'
      DomainsToNeverSetUp:
        - google.com
      ManagedPlugInPolicies:
        'com.BoxEditLib.Box Edit':
          PlugInFirstVisitPolicy: 'PlugInPolicyAsk'
      PayloadType: 'com.apple.Safari'
    displayname: 'Managed Mac: Safari Settings'

Both the DomainsToNeverSetUp and ManagedPlugInPolicies keys result in an error:

Error: Could not convert change 'content' to string: undefined method `pretty_inspect' for #<Array:0x007fb4db08e200>
Error: Could not convert change 'content' to string: undefined method `pretty_inspect' for #<Array:0x007fb4db08e200>
Error: /Stage[main]/Managedmac::Mobileconfigs/Mobileconfig[com.apple.Safari]: Could not evaluate: Puppet::Util::Log requires a message
dayglojesus commented 10 years ago

That YAML is valid and should compile. I tested it both on 10.9 and 10.10.

Have you updated to managedmac 0.5.1?

groob commented 10 years ago

I narrowed it down. Turns out, the profile gets installed without errors the first time, however, if I modify a value, the error comes up during the next puppet run.

I changed

PlugInFirstVisitPolicy: 'PlugInPolicyAsk'

to

PlugInFirstVisitPolicy: 'PlugInPolicyAllowNoSecurityRestrictions'
dayglojesus commented 10 years ago

Ugh. That's a bug. Sorry, I see the trouble now, I left more debugging statements in the type...

https://github.com/dayglojesus/managedmac/blob/master/lib/puppet/type/mobileconfig.rb#L80-L88

dayglojesus commented 10 years ago

@groob can you try branch 0.5.2 and let me know if this addresses it?

groob commented 10 years ago

Looks like it's fixed now :+1:

Notice: /Stage[main]/Managedmac::Mobileconfigs/Mobileconfig[com.apple.Safari]/content: content changed '-781926075691113702' to '4539757020169085239'

dayglojesus commented 10 years ago

Thanks for testing. I will close this. :)

Fixed in 0.5.2.