Issue #4025 has been updated by Clay Caviness.
Diff below. Is there a better method to get this patched?
<pre>
diff --git a/lib/puppet/provider/service/launchd.rb
b/lib/puppet/provider/service/launchd.
index 9703595..716afa3 100644
--- a/lib/puppet/provider/service/launchd.rb
+++ b/lib/puppet/provider/service/launchd.rb
@@ -1,4 +1,4 @@
-require 'facter/util/plist'
+require 'osx/cocoa'
Puppet::Type.type(:service).provide :launchd, :parent => :base do
desc "launchd service management framework.
@@ -62,7 +62,7 @@ Puppet::Type.type(:service).provide :launchd, :parent =>
:base do
next if f =~ /^\..*$/
next if FileTest.directory?(f)
fullpath = File.join(path, f)
- job = Plist::parse_xml(fullpath)
+ job =
OSX::NSDictionary.dictionaryWithContentsOfFile(fullpath).to_ruby
if job and job.has_key?("Label")
if job["Label"] == label
return { label => fullpath }
@@ -118,7 +118,7 @@ Puppet::Type.type(:service).provide :launchd, :parent =>
:base do
def plist_from_label(label)
job = self.class.jobsearch(label)
job_path = job[label]
- job_plist = Plist::parse_xml(job_path)
+ job_plist = OSX::NSDictionary.dictionaryWithContentsOfFile(job_path)
raise Puppet::Error.new("Unable to parse launchd plist at path:
#{job_path}") if not
[job_path, job_plist]
end
@@ -200,7 +200,7 @@ Puppet::Type.type(:service).provide :launchd, :parent =>
:base do
job_plist_disabled = job_plist["Disabled"] if
job_plist.has_key?("Disabled")
if self.class.get_macosx_version_major == "10.6":
- overrides = Plist::parse_xml(Launchd_Overrides)
+ overrides =
OSX::NSDictionary.dictionaryWithContentsOfFile(Launchd_Overrides).to_ru
unless overrides.nil?
if overrides.has_key?(resource[:name])
@@ -227,14 +227,14 @@ Puppet::Type.type(:service).provide :launchd, :parent =>
:base do
# versions this is stored in the job plist itself.
def enable
if self.class.get_macosx_version_major == "10.6"
- overrides = Plist::parse_xml(Launchd_Overrides)
+ overrides =
OSX::NSMutableDictionary.dictionaryWithContentsOfFile(Launchd_Overrides
overrides[resource[:name]] = { "Disabled" => false }
- Plist::Emit.save_plist(overrides, Launchd_Overrides)
+ overrides.writeToFile_atomically_(Launchd_Overrides, true)
else
job_path, job_plist = plist_from_label(resource[:name])
if self.enabled? == :false
job_plist.delete("Disabled")
- Plist::Emit.save_plist(job_plist, job_path)
+ job_plist.writeToFile_atomically_(job_path, true)
end
end
end
@@ -242,13 +242,13 @@ Puppet::Type.type(:service).provide :launchd, :parent =>
:base do
def disable
if self.class.get_macosx_version_major == "10.6"
- overrides = Plist::parse_xml(Launchd_Overrides)
+ overrides =
OSX::NSMutableDictionary.dictionaryWithContentsOfFile(Launchd_Overrides
overrides[resource[:name]] = { "Disabled" => true }
- Plist::Emit.save_plist(overrides, Launchd_Overrides)
+ overrides.writeToFile_atomically_(Launchd_Overrides, true)
else
job_path, job_plist = plist_from_label(resource[:name])
job_plist["Disabled"] = true
- Plist::Emit.save_plist(job_plist, job_path)
+ job_plist.writeToFile_atomically_(job_path, true)
end
end
</pre>
----------------------------------------
Bug #4025: "ralsh service" fails with "Unimplemented element" when using
launchd provider if certain plists are binary
http://projects.puppetlabs.com/issues/4025
Author: Clay Caviness
Status: Investigating
Priority: Normal
Assignee:
Category: OSX
Target version:
Affected version: 0.25.5
Keywords:
Branch:
On 10.6.3, all system-level LaunchDaemons are shipped as text files (xml1
format). However, as they are updated, they may be converted to binary (binary1
format).
I suspect this is because ralsh is using Plist::parse_xml, which can't handle
binary plists.
:) fox:~ crc$ file {/System,}/Library/Launch{Daemons,Agents}/*.plist | grep
binary
/System/Library/LaunchDaemons/com.apple.syslogd.plist:
Apple binary property list
:( fox:~ crc$ sudo ralsh --debug --trace service com.openssh.sshd
debug: Puppet::Type::Service::ProviderDebian: file /usr/sbin/update-rc.d does
not exist
debug: Puppet::Type::Service::ProviderRunit: file /usr/bin/sv does not exist
debug: Puppet::Type::Service::ProviderGentoo: file /sbin/rc-update does not
exist
debug: Puppet::Type::Service::ProviderDaemontools: file /usr/bin/svc does not
exist
debug: Puppet::Type::Service::ProviderRedhat: file /sbin/chkconfig does not
exist
debug: Puppet::Type::Service::ProviderDebian: file /usr/sbin/update-rc.d does
not exist
debug: Puppet::Type::Service::ProviderRunit: file /usr/bin/sv does not exist
debug: Puppet::Type::Service::ProviderGentoo: file /sbin/rc-update does not
exist
debug: Puppet::Type::Service::ProviderDaemontools: file /usr/bin/svc does not
exist
debug: Puppet::Type::Service::ProviderRedhat: file /sbin/chkconfig does not
exist
/Library/Ruby/Site/1.8/facter/util/plist/parser.rb:104:in `parse'
/Library/Ruby/Site/1.8/facter/util/plist/parser.rb:28:in `parse_xml'
/Library/Ruby/Site/1.8/puppet/provider/service/launchd.rb:65:in `jobsearch'
/Library/Ruby/Site/1.8/puppet/provider/service/launchd.rb:61:in `each'
/Library/Ruby/Site/1.8/puppet/provider/service/launchd.rb:61:in `jobsearch'
/Library/Ruby/Site/1.8/puppet/provider/service/launchd.rb:59:in `each'
/Library/Ruby/Site/1.8/puppet/provider/service/launchd.rb:59:in `jobsearch'
/Library/Ruby/Site/1.8/puppet/provider/service/launchd.rb:87:in `instances'
/Library/Ruby/Site/1.8/puppet/type.rb:1006:in `instances'
/Library/Ruby/Site/1.8/puppet/type.rb:1005:in `collect'
/Library/Ruby/Site/1.8/puppet/type.rb:1005:in `instances'
/Library/Ruby/Site/1.8/puppet/application/ralsh.rb:93:in `main'
/Library/Ruby/Site/1.8/puppet/application.rb:226:in `send'
/Library/Ruby/Site/1.8/puppet/application.rb:226:in `run_command'
/Library/Ruby/Site/1.8/puppet/application.rb:217:in `run'
/Library/Ruby/Site/1.8/puppet/application.rb:306:in `exit_on_fail'
/Library/Ruby/Site/1.8/puppet/application.rb:217:in `run'
/usr/bin/ralsh:89
Could not run: Unimplemented element
:( fox:~ crc$ sudo plutil -convert xml1
/System/Library/LaunchDaemons/com.apple.syslogd.plist
:) fox:~ crc$ sudo ralsh -d service com.openssh.sshd
debug: Puppet::Type::Service::ProviderDebian: file /usr/sbin/update-rc.d does
not exist
debug: Puppet::Type::Service::ProviderRunit: file /usr/bin/sv does not exist
debug: Puppet::Type::Service::ProviderGentoo: file /sbin/rc-update does not
exist
debug: Puppet::Type::Service::ProviderDaemontools: file /usr/bin/svc does not
exist
debug: Puppet::Type::Service::ProviderRedhat: file /sbin/chkconfig does not
exist
debug: Puppet::Type::Service::ProviderDebian: file /usr/sbin/update-rc.d does
not exist
debug: Puppet::Type::Service::ProviderRunit: file /usr/bin/sv does not exist
debug: Puppet::Type::Service::ProviderGentoo: file /sbin/rc-update does not
exist
debug: Puppet::Type::Service::ProviderDaemontools: file /usr/bin/svc does not
exist
debug: Puppet::Type::Service::ProviderRedhat: file /sbin/chkconfig does not
exist
debug: Service path /etc/init.d does not exist
debug: Puppet::Type::Service::ProviderLaunchd: Executing '/bin/launchctl list'
debug: Puppet::Type::Service::ProviderLaunchd: Executing '/bin/launchctl list'
service { 'com.openssh.sshd':
enable => 'true',
ensure => 'running'
}
--
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.