diff options
-rw-r--r-- | README | 13 | ||||
-rw-r--r-- | lib/puppet/provider/sudoers/parsed.rb | 10 | ||||
-rw-r--r-- | lib/puppet/type/sudoers.rb | 1 |
3 files changed, 14 insertions, 10 deletions
@@ -2,14 +2,17 @@ This is a type and a provider for managing sudoers file. It still has a lot of issues open, but it should be in a consumable state. +lots of examples of usage can be found in the tests directory. The type also has rdocs. + TODO(stuff that I will fix before 0.1 release) - 1. A userspec record that starts with Defaults will be parsed as a default. (this may not be possible) - 2. I still need to verify combinations of properties that work together and throw exceptions for mismatches. - 3. I can probably set up autorequires on aliases in User Spec line, but this order would only be followed if both records were created. - 4. If an alias is created with the same name as a previously defined user spec, it does not create it, or throw any errors. - 5 Should not print out flush or to_line because of performance issue. + 1. A userspec record that starts with Defaults will be parsed as a default. (this may not be resonable to fix) + 2. I can probably set up autorequires on aliases in User Spec line, but this order would only be followed if both records were created. + 3. A namevar cannot switch between types + this wound up being too hard to implement. + - only uses properties from the parsedrecord + 4 Can't log flush or to_line events because they occur too often (working on this per issue with parsedfile). LIMITATIONS (things I will not fix soon): diff --git a/lib/puppet/provider/sudoers/parsed.rb b/lib/puppet/provider/sudoers/parsed.rb index e18b220..85e9fe1 100644 --- a/lib/puppet/provider/sudoers/parsed.rb +++ b/lib/puppet/provider/sudoers/parsed.rb @@ -141,16 +141,16 @@ Puppet::Type.type(:sudoers).provide( # overriding how lines are written to the file def self.to_line(hash) - puts "\nEntering self.to_line for #{hash[:name]}" - puts "\n#{hash.to_yaml}\n" + #puts "\nEntering self.to_line for #{hash[:name]}" + #puts "\n#{hash.to_yaml}\n" # # dynamically call a function based on the value of hash[:type] if(hash[:record_type] == :blank || hash[:record_type] == :comment) hash[:line] - elsif(hash[:sudo_alias]) + elsif(hash[:type] == 'alias') self.alias_to_line(hash) - elsif(hash[:commands]) + elsif(hash[:type] == 'user_spec') self.spec_to_line(hash) - elsif(hash[:parameters]) + elsif(hash[:type] == 'default') self.default_to_line(hash) else raise Puppet::Error, "dont understand how to write out record \n|#{hash.to_yaml}\n|" diff --git a/lib/puppet/type/sudoers.rb b/lib/puppet/type/sudoers.rb index 64d66e0..dcb4cfe 100644 --- a/lib/puppet/type/sudoers.rb +++ b/lib/puppet/type/sudoers.rb @@ -140,6 +140,7 @@ Defaults@host x=y,one=1,two=2 self[:type] = 'alias' checkprops(SUDOERS_DEFAULT, SUDOERS_SPEC) elsif self[:parameters] + self[:type] = 'default' checkprops(SUDOERS_ALIAS, SUDOERS_SPEC) elsif self[:users] self[:type] = 'user_spec' |