diff options
| author | Matt Robinson <matt@puppetlabs.com> | 2011-05-19 21:18:55 -0700 |
|---|---|---|
| committer | Matt Robinson <matt@puppetlabs.com> | 2011-05-19 21:18:55 -0700 |
| commit | eeeab02fd97a625ec0e21ecd5d0ed7f0067027ef (patch) | |
| tree | 704477b4d8c2b255707e65135b3bb0d10253e06c /lib/puppet/provider | |
| parent | be2f20899d76621db4cf574d074f0ae89777272e (diff) | |
| parent | 99bf07e76bab47760b9eb3dc42f08582c568388f (diff) | |
Merge branch '2.7.next' into 2.7.x
* 2.7.next: (42 commits)
(#6395) Add extpuppet help, eval, and interfaces
Adding a sleep state post starting master
maint: fix spec_helper inclusions again.
(#7523) Refactor the grammar to reduce duplication
(#7114) Fix specs for ssh authorized key parsed provider
(#7114) Target returns correct value
(#7114) Add integration tests for authorized_key
(#7114) Improve unit tests for ssh_authorized_key
(#7114) Improve value validation for authorized_key
(#7300) Fix instances method of mount provider
(#7259) Remove ActiveRecord requirement from indirector face spec
(#7259) Do not try to load all Terminus classes when configuring the Indirector
(#3836) External nodes should only capture stdout
Revert "(#7220) Add the ability to "inherit" options."
maint: sync 'authconfig' to 'rest_authconfig' setting
adding test for ticket 7139
(#7139) Accept '/' as a valid path in filesets
(#7300) Add specs for the mount provider
case seems needless here as there is only two opts, also the rest of the file seems to use if so this should make things more consistant
(#6845) Mount writes incorrect vfstab entries
...
Diffstat (limited to 'lib/puppet/provider')
| -rwxr-xr-x | lib/puppet/provider/mount/parsed.rb | 20 | ||||
| -rw-r--r-- | lib/puppet/provider/naginator.rb | 10 | ||||
| -rw-r--r-- | lib/puppet/provider/nameservice/directoryservice.rb | 19 | ||||
| -rw-r--r-- | lib/puppet/provider/network_device.rb | 2 | ||||
| -rwxr-xr-x | lib/puppet/provider/package/aptitude.rb | 1 | ||||
| -rw-r--r-- | lib/puppet/provider/ssh_authorized_key/parsed.rb | 6 |
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 |
