summaryrefslogtreecommitdiffstats
path: root/lib/puppet/provider
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/provider')
-rwxr-xr-xlib/puppet/provider/mount/parsed.rb20
-rw-r--r--lib/puppet/provider/naginator.rb10
-rw-r--r--lib/puppet/provider/nameservice/directoryservice.rb19
-rw-r--r--lib/puppet/provider/network_device.rb2
-rwxr-xr-xlib/puppet/provider/package/aptitude.rb1
-rw-r--r--lib/puppet/provider/ssh_authorized_key/parsed.rb6
6 files changed, 41 insertions, 17 deletions
diff --git a/lib/puppet/provider/mount/parsed.rb b/lib/puppet/provider/mount/parsed.rb
index 11c5e21a9..8d48dad57 100755
--- a/lib/puppet/provider/mount/parsed.rb
+++ b/lib/puppet/provider/mount/parsed.rb
@@ -18,7 +18,7 @@ Puppet::Type.type(:mount).provide(
commands :mountcmd => "mount", :umount => "umount"
- case Facter["operatingsystem"]
+ case Facter.value(:operatingsystem)
when "Solaris"
@fields = [:device, :blockdevice, :name, :fstype, :pass, :atboot, :options]
else
@@ -47,6 +47,24 @@ Puppet::Type.type(:mount).provide(
end
end
+ def self.instances
+ providers = super
+ mounts = mountinstances.dup
+
+ # Update fstab entries that are mounted
+ providers.each do |prov|
+ if mounts.delete({:name => prov.get(:name), :mounted => :yes}) then
+ prov.set(:ensure => :mounted)
+ end
+ end
+
+ # Add mounts that are not in fstab but mounted
+ mounts.each do |mount|
+ providers << new(:ensure => :ghost, :name => mount[:name])
+ end
+ providers
+ end
+
def self.prefetch(resources = nil)
# Get providers for all resources the user defined and that match
# a record in /etc/fstab.
diff --git a/lib/puppet/provider/naginator.rb b/lib/puppet/provider/naginator.rb
index 5c610fb31..17cc24086 100644
--- a/lib/puppet/provider/naginator.rb
+++ b/lib/puppet/provider/naginator.rb
@@ -30,7 +30,15 @@ class Puppet::Provider::Naginator < Puppet::Provider::ParsedFile
end
def self.to_file(records)
- header + records.collect { |record| record.to_s }.join("\n").gsub("_naginator_name", NAME_STRING)
+ header + records.collect { |record|
+ # Remap the TYPE_name or _naginator_name params to the
+ # name if the record is a template (register == 0)
+ if record.to_s =~ /register\s+0/
+ record.to_s.sub("_naginator_name", "name").sub(record.type.to_s + "_name", "name")
+ else
+ record.to_s.sub("_naginator_name", NAME_STRING)
+ end
+ }.join("\n")
end
def self.skip_record?(record)
diff --git a/lib/puppet/provider/nameservice/directoryservice.rb b/lib/puppet/provider/nameservice/directoryservice.rb
index c1139a679..35ac8d76a 100644
--- a/lib/puppet/provider/nameservice/directoryservice.rb
+++ b/lib/puppet/provider/nameservice/directoryservice.rb
@@ -221,11 +221,12 @@ class DirectoryService < Puppet::Provider::NameService
# have a lot of choice. Ultimately this should all be done using Ruby
# to access the DirectoryService APIs directly, but that's simply not
# feasible for a while yet.
- case self.get_macosx_version_major
- when "10.4"
- dscl_plist = self.parse_dscl_url_data(dscl_output)
- when "10.5", "10.6"
+ if self.get_macosx_version_major > "10.4"
dscl_plist = self.parse_dscl_plist_data(dscl_output)
+ elsif self.get_macosx_version_major == "10.4"
+ dscl_plist = self.parse_dscl_url_data(dscl_output)
+ else
+ fail("Puppet does not support OS X versions < 10.4")
end
self.generate_attribute_hash(dscl_plist, *type_properties)
@@ -243,12 +244,14 @@ class DirectoryService < Puppet::Provider::NameService
# different format for the -url output with objects with spaces in
# their values. *sigh*. Use -url for 10.4 in the hope this can be
# deprecated one day, and use -plist for 10.5 and higher.
- case self.get_macosx_version_major
- when "10.4"
- command_vector = [ command(:dscl), "-url", "." ]
- when "10.5", "10.6"
+ if self.get_macosx_version_major > "10.4"
command_vector = [ command(:dscl), "-plist", "." ]
+ elsif self.get_macosx_version_major == "10.4"
+ command_vector = [ command(:dscl), "-url", "." ]
+ else
+ fail("Puppet does not support OS X versions < 10.4")
end
+
# JJM: The actual action to perform. See "man dscl"
# Common actiosn: -create, -delete, -merge, -append, -passwd
command_vector << ds_action
diff --git a/lib/puppet/provider/network_device.rb b/lib/puppet/provider/network_device.rb
index b178df977..46be27968 100644
--- a/lib/puppet/provider/network_device.rb
+++ b/lib/puppet/provider/network_device.rb
@@ -65,4 +65,4 @@ class Puppet::Provider::NetworkDevice < Puppet::Provider
def properties
@property_hash.dup
end
-end \ No newline at end of file
+end
diff --git a/lib/puppet/provider/package/aptitude.rb b/lib/puppet/provider/package/aptitude.rb
index 8bdf984e6..2eafd3ef8 100755
--- a/lib/puppet/provider/package/aptitude.rb
+++ b/lib/puppet/provider/package/aptitude.rb
@@ -12,6 +12,7 @@ Puppet::Type.type(:package).provide :aptitude, :parent => :apt, :source => :dpkg
args.flatten!
# Apparently aptitude hasn't always supported a -q flag.
args.delete("-q") if args.include?("-q")
+ args.delete("--force-yes") if args.include?("--force-yes")
output = aptitude(*args)
# Yay, stupid aptitude doesn't throw an error when the package is missing.
diff --git a/lib/puppet/provider/ssh_authorized_key/parsed.rb b/lib/puppet/provider/ssh_authorized_key/parsed.rb
index 6a3855c0e..81b1fbcfa 100644
--- a/lib/puppet/provider/ssh_authorized_key/parsed.rb
+++ b/lib/puppet/provider/ssh_authorized_key/parsed.rb
@@ -42,12 +42,6 @@ require 'puppet/provider/parsedfile'
0600
end
- def target
- @resource.should(:target) || File.expand_path("~#{@resource.should(:user)}/.ssh/authorized_keys")
- rescue
- raise Puppet::Error, "Target not defined and/or specified user does not exist yet"
- end
-
def user
uid = File.stat(target).uid
Etc.getpwuid(uid).name