Issue #6017 has been updated by Clay Caviness.
I haven't tested, just glanced at the code, but I wonder if doing a `dscl 'localhost', '-mcxdelete', ds_path` just before [line 118 in mcxcontent.rb](https://github.com/puppetlabs/puppet/blob/master/lib/puppet/provider/mcx/mcxcontent.rb#L118) would solve this. ---------------------------------------- Bug #6017: MCX provider doesn't overwrite existing MCX data https://projects.puppetlabs.com/issues/6017#change-60098 Author: Clay Caviness Status: Accepted Priority: Normal Assignee: Category: OSX Target version: Telly Affected Puppet version: Keywords: Branch: If a directory service resource has pre-existing MCX data, the mcx provider will not remove it - it will only append. This means that all subsequent puppet runs will see the existing MCX data and re-apply the mcx resource ... which of course won't overwrite the existing MCX data, etc. In this case, I think an "mcxdelete" on the existing directory service resource will remove *all* mcx, at which point the "mcximport" will work and the resource will have only the correct MCX. Example: Assume an existing group, testgroup. Add some MCX data to it: <pre># dscl . -mcxset /Groups/testgroup existing_domain existing_key always 1 Password: $ dscl . -mcxread /Groups/testgroup App domain: existing_domain Key: existing_key State: always Value: 1 </pre> Apply puppet manifest with different MCX data: <pre>mcx_group.pp: mcx { "/Groups/testgroup": ensure => present, content => '<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>some.domain</key> <dict> <key>some.key</key> <dict> <key>state</key> <string>always</string> <key>value</key> <string>1</string> </dict> </dict> </dict> </plist> ', }</pre> <pre>[...] notice: /Stage[main]//Mcx[/Groups/testgroup]/content: content changed '<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>existing_domain</key> <dict> <key>existing_key</key> <dict> <key>state</key> <string>always</string> <key>value</key> <string>1</string> </dict> </dict> </dict> </plist> ' to '<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>some.domain</key> <dict> <key>some.key</key> <dict> <key>state</key> <string>always</string> <key>value</key> <string>1</string> </dict> </dict> </dict> </plist> ' [...]</pre> Note that the pre-existing MCX data is still in the record: <pre>$ dscl . -mcxread /Groups/testgroup App domain: existing_domain Key: existing_key State: always Value: 1 App domain: some.domain Key: some.key State: always Value: 1 </pre> -- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://projects.puppetlabs.com/my/account -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-bugs?hl=en.
