Issue #9974 has been updated by Gary Larizza.

Status changed from Accepted to Duplicate
Branch set to https://github.com/puppetlabs/puppet/pull/1309

This should be related to #17624, which I've fixed with 
<https://github.com/puppetlabs/puppet/pull/1309>, please give it a spin and see 
if it works for you!
----------------------------------------
Bug #9974: launchd (or any other provider) shouldn't fail with malformed or 
oddball plists
https://projects.puppetlabs.com/issues/9974#change-78031

Author: Clay Caviness
Status: Duplicate
Priority: Normal
Assignee: 
Category: 
Target version: 
Affected Puppet version: 2.7.5
Keywords: 
Branch: https://github.com/puppetlabs/puppet/pull/1309


While debugging https://projects.puppetlabs.com/issues/9192 I found the larger 
issue to be that provider.rb was the failure point.

`puppet resource service` was failing on a 10.5 machine with `Could not run: No 
resource and no name in property hash in launchd instance`

I tweaked provider.rb to print the whole property hash:
    260   def name
    261     require 'pp'
    262     PP::pp(@property_hash)
    263     if n = @property_hash[:name]
    264       return n
    265     elsif self.resource
    266       resource.name
    267     else
    268       raise Puppet::DevError, "No resource and no name in property hash 
in #{self.clas    s.name} instance"
    269     end
    270   end

… and noticed:

    {:provider=>:launchd,
    :path=>"/System/Library/LaunchDaemons/com.apple.xprotectupdater.plist",
    :status=>:stopped,
    :name=>nil}

Note the `nil` `:name`.

Examining the launchd plist, it’s malformed (well, incomplete):

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" 
"http://www.apple.com/DTDs/PropertyLi
    st-1.0.dtd">
    <plist version="1.0">
    <dict>
        <key>StartInterval</key>
        <integer>3600</integer>
    </dict>
    </plist>

This plist was created when we were tweaking the StartInterval for xprotect, 
but forgot to restrict the setting to 10.6 and later, so some 10.5 machines got 
this.

I think provider.rb should probably just skip malformed/oddball launchd plists 
like this rather than completely bailing out.


-- 
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.

Reply via email to