Luke Kanies | 1 Oct 05:37 2008

[PATCH 4/9] The Netinfo and DirectoryService providers can now create user and group simultaneously.


This required selectively using property#sync if a 'should' value
is present, so that the user's gid property can do the conversion
if necessary.

Signed-off-by: Luke Kanies <luke <at> madstop.com>
---
 .../provider/nameservice/directoryservice.rb       |   15 ++++++++++++---
 lib/puppet/provider/nameservice/netinfo.rb         |   14 ++++++++++++--
 2 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/lib/puppet/provider/nameservice/directoryservice.rb b/lib/puppet/provider/nameservice/directoryservice.rb
index e2e68b2..fcc44f9 100644
--- a/lib/puppet/provider/nameservice/directoryservice.rb
+++ b/lib/puppet/provider/nameservice/directoryservice.rb
 <at>  <at>  -206,9 +206,18  <at>  <at>  class DirectoryService < Puppet::Provider::NameService
         if ensure_value == :present
              <at> resource.class.validproperties.each do |name|
                 next if name == :ensure
-                next unless val =  <at> resource.should(name) || autogen(name)
-                # JJM: This calls the method.
-                self.send(name.to_s + "=", val)
+
+                # LAK: We use property.sync here rather than directly calling
+                # the settor method because the properties might do some kind
+                # of conversion.  In particular, the user gid property might
+                # have a string and need to convert it to a number
+                if  <at> resource.should(name)
+                     <at> resource.property(name).sync
+                elsif value = autogen(name)
(Continue reading)

Luke Kanies | 1 Oct 05:37 2008

[PATCH 5/9] Removing commented code from the user type from about 2005


Signed-off-by: Luke Kanies <luke <at> madstop.com>
---
 lib/puppet/type/user.rb |   23 -----------------------
 1 files changed, 0 insertions(+), 23 deletions(-)

diff --git a/lib/puppet/type/user.rb b/lib/puppet/type/user.rb
index 79cd5ff..571781d 100755
--- a/lib/puppet/type/user.rb
+++ b/lib/puppet/type/user.rb
 <at>  <at>  -191,29 +191,6  <at>  <at>  module Puppet
             end
         end

-        # these three properties are all implemented differently on each platform,
-        # so i'm disabling them for now
-
-        # FIXME Puppet::Property::UserLocked is currently non-functional
-        #newproperty(:locked) do
-        #    desc "The expected return code.  An error will be returned if the
-        #        executed command returns something else."
-        #end
-
-        # FIXME Puppet::Property::UserExpire is currently non-functional
-        #newproperty(:expire) do
-        #    desc "The expected return code.  An error will be returned if the
-        #        executed command returns something else."
-        #     <at> objectaddflag = "-e"
-        #end
-
(Continue reading)

Luke Kanies | 1 Oct 05:37 2008

[PATCH 2/9] Aliasing the rspec 'should' method to 'must'


Signed-off-by: Luke Kanies <luke <at> madstop.com>
---
 spec/monkey_patches/alias_should_to_must.rb |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
 create mode 100644 spec/monkey_patches/alias_should_to_must.rb

diff --git a/spec/monkey_patches/alias_should_to_must.rb b/spec/monkey_patches/alias_should_to_must.rb
new file mode 100644
index 0000000..35d3342
--- /dev/null
+++ b/spec/monkey_patches/alias_should_to_must.rb
 <at>  <at>  -0,0 +1,5  <at>  <at> 
+class Object
+    # This is necessary because the RAL has a 'should'
+    # method.
+    alias :must :should
+end
--

-- 
1.5.3.7

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to puppet-dev <at> googlegroups.com
To unsubscribe from this group, send email to puppet-dev+unsubscribe <at> googlegroups.com
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Luke Kanies | 1 Oct 05:37 2008

[PATCH 7/9] Updating changelog for #1622


Signed-off-by: Luke Kanies <luke <at> madstop.com>
---
 CHANGELOG |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index c54aa62..1db11c5 100644
--- a/CHANGELOG
+++ b/CHANGELOG
 <at>  <at>  -1,4 +1,6  <at>  <at> 
 0.24.x
+    Fixed #1622 - Users and their groups should again add in one transaction
+
     Fixed #1610 - Raise "Filebucketed" messages to Notice priority

     Added a number of confines to package providers
--

-- 
1.5.3.7

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to puppet-dev <at> googlegroups.com
To unsubscribe from this group, send email to puppet-dev+unsubscribe <at> googlegroups.com
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Luke Kanies | 1 Oct 05:37 2008

[PATCH 9/9] Modified the group and zone resource types to no longer call


Signed-off-by: Luke Kanies <luke <at> madstop.com>
---
 CHANGELOG                |    4 ++++
 lib/puppet/type.rb       |   16 +++++++++-------
 lib/puppet/type/group.rb |    8 --------
 lib/puppet/type/zone.rb  |    6 +++++-
 spec/unit/type.rb        |    1 +
 5 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index b1d67a0..bc0bcbc 100644
--- a/CHANGELOG
+++ b/CHANGELOG
 <at>  <at>  -1,4 +1,8  <at>  <at> 
 0.24.x
+    Modified the group and zone resource types to no longer call
+    'currentpropvalues' as a means of setting all values to absent.
+    There should be no behaviour change from this change.
+
     Modified the behaviour of resource-level 'retrieve' -- it only
     calls 'retrieve' on each property if the resource exists.

diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb
index 1989fc0..e377a35 100644
--- a/lib/puppet/type.rb
+++ b/lib/puppet/type.rb
 <at>  <at>  -901,17 +901,19  <at>  <at>  class Type

     # retrieve the current value of all contained properties
(Continue reading)

Luke Kanies | 1 Oct 05:37 2008

[PATCH 8/9] Modified the behaviour of resource-level 'retrieve' -- it only


Signed-off-by: Luke Kanies <luke <at> madstop.com>
---
 CHANGELOG          |    3 ++
 lib/puppet/type.rb |   24 ++++++++++++-----
 spec/unit/type.rb  |   72 ++++++++++++++++++++++++++++++++++++++-------------
 3 files changed, 73 insertions(+), 26 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 1db11c5..b1d67a0 100644
--- a/CHANGELOG
+++ b/CHANGELOG
 <at>  <at>  -1,4 +1,7  <at>  <at> 
 0.24.x
+    Modified the behaviour of resource-level 'retrieve' -- it only
+    calls 'retrieve' on each property if the resource exists.
+
     Fixed #1622 - Users and their groups should again add in one transaction

     Fixed #1610 - Raise "Filebucketed" messages to Notice priority
diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb
index c7a866e..1989fc0 100644
--- a/lib/puppet/type.rb
+++ b/lib/puppet/type.rb
 <at>  <at>  -906,14 +906,24  <at>  <at>  class Type

     # get a hash of the current properties.  
     def currentpropvalues(override_value = nil)
-        # it's important to use the method here, as it follows the order
-        # in which they're defined in the object
(Continue reading)

Luke Kanies | 1 Oct 05:37 2008

[PATCH 3/9] Fixing #1622 - The user type only looks up groups when necessary.


Also added a bunch of tests to the user type, and refactored
as necessary for this to work.

Signed-off-by: Luke Kanies <luke <at> madstop.com>
---
 lib/puppet/type/user.rb |   71 +++++-------------------
 spec/unit/type/user.rb  |  141 ++++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 154 insertions(+), 58 deletions(-)

diff --git a/lib/puppet/type/user.rb b/lib/puppet/type/user.rb
index 039bcb7..79cd5ff 100755
--- a/lib/puppet/type/user.rb
+++ b/lib/puppet/type/user.rb
 <at>  <at>  -49,25 +49,6  <at>  <at>  module Puppet
                     return :absent
                 end
             end
-
-            # The default 'sync' method only selects among a list of registered
-            # values.
-            def sync
-#                if self.insync?
-#                    self.info "already in sync"
-#                    return nil
-                #else
-                    #self.info "%s vs %s" % [self.is.inspect, self.should.inspect]
-#               end
-                unless self.class.values
-                    self.devfail "No values defined for %s" %
(Continue reading)

Luke Kanies | 1 Oct 05:37 2008

Fixing #1622 and cleaning resource retrieval


This is a series of patches originally focused on fixing #1622,
which was a problem with the User's gid property, but it led
to cleaning up a lot of other code.

None of these patches beyond the User class should actually involve
a behaviour change, but the code is much cleaner now.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to puppet-dev <at> googlegroups.com
To unsubscribe from this group, send email to puppet-dev+unsubscribe <at> googlegroups.com
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Luke Kanies | 1 Oct 07:09 2008

Creating and using user/group in one run


This series of commits hopefully finally quashes this bug.

It ended up being a relatively minor bug, caused by recent refactoring
in the gid and uid methods -- they didn't correctly handle
the group/user actually missing.

The commit series also includes refactoring of the file's Group property,
since it was u-g-l-y.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to puppet-dev <at> googlegroups.com
To unsubscribe from this group, send email to puppet-dev+unsubscribe <at> googlegroups.com
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Luke Kanies | 1 Oct 07:09 2008

[PATCH 1/2] Refactoring and adding tests to the file group property.


Drastically simplified the class, removing a lot of obsolete
code and adding tests for nearly the whole class.

Signed-off-by: Luke Kanies <luke <at> madstop.com>
---
 lib/puppet/type/file/group.rb |   64 ++++++++---------------------
 spec/unit/type/file/group.rb  |   87 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 105 insertions(+), 46 deletions(-)
 create mode 100755 spec/unit/type/file/group.rb

diff --git a/lib/puppet/type/file/group.rb b/lib/puppet/type/file/group.rb
index cc482ff..75beb53 100755
--- a/lib/puppet/type/file/group.rb
+++ b/lib/puppet/type/file/group.rb
 <at>  <at>  -1,6 +1,10  <at>  <at> 
+require 'puppet/util/posix'
+
 # Manage file group ownership.
 module Puppet
     Puppet.type(:file).newproperty(:group) do
+        include Puppet::Util::POSIX
+
         require 'etc'
         desc "Which group should own the file.  Argument can be either group
             name or group ID."
 <at>  <at>  -43,31 +47,7  <at>  <at>  module Puppet
         end

         def retrieve
(Continue reading)


Gmane