summaryrefslogtreecommitdiffstats
path: root/lib/puppet/provider/group/ldap.rb
diff options
context:
space:
mode:
authorMarkus Roberts <Markus@reality.com>2010-07-09 18:12:17 -0700
committerMarkus Roberts <Markus@reality.com>2010-07-09 18:12:17 -0700
commit3180b9d9b2c844dade1d361326600f7001ec66dd (patch)
tree98fe7c5ac7eb942aac9c39f019a17b0b3f5a57f4 /lib/puppet/provider/group/ldap.rb
parent543225970225de5697734bfaf0a6eee996802c04 (diff)
downloadpuppet-3180b9d9b2c844dade1d361326600f7001ec66dd.tar.gz
puppet-3180b9d9b2c844dade1d361326600f7001ec66dd.tar.xz
puppet-3180b9d9b2c844dade1d361326600f7001ec66dd.zip
Code smell: Two space indentation
Replaced 106806 occurances of ^( +)(.*$) with The ruby community almost universally (i.e. everyone but Luke, Markus, and the other eleven people who learned ruby in the 1900s) uses two-space indentation. 3 Examples: The code: end # Tell getopt which arguments are valid def test_get_getopt_args element = Setting.new :name => "foo", :desc => "anything", :settings => Puppet::Util::Settings.new assert_equal([["--foo", GetoptLong::REQUIRED_ARGUMENT]], element.getopt_args, "Did not produce appropriate getopt args") becomes: end # Tell getopt which arguments are valid def test_get_getopt_args element = Setting.new :name => "foo", :desc => "anything", :settings => Puppet::Util::Settings.new assert_equal([["--foo", GetoptLong::REQUIRED_ARGUMENT]], element.getopt_args, "Did not produce appropriate getopt args") The code: assert_equal(str, val) assert_instance_of(Float, result) end # Now test it with a passed object becomes: assert_equal(str, val) assert_instance_of(Float, result) end # Now test it with a passed object The code: end assert_nothing_raised do klass[:Yay] = "boo" klass["Cool"] = :yayness end becomes: end assert_nothing_raised do klass[:Yay] = "boo" klass["Cool"] = :yayness end
Diffstat (limited to 'lib/puppet/provider/group/ldap.rb')
-rw-r--r--lib/puppet/provider/group/ldap.rb80
1 files changed, 40 insertions, 40 deletions
diff --git a/lib/puppet/provider/group/ldap.rb b/lib/puppet/provider/group/ldap.rb
index d0eca0d50..2737feea6 100644
--- a/lib/puppet/provider/group/ldap.rb
+++ b/lib/puppet/provider/group/ldap.rb
@@ -1,47 +1,47 @@
require 'puppet/provider/ldap'
Puppet::Type.type(:group).provide :ldap, :parent => Puppet::Provider::Ldap do
- desc "Group management via ``ldap``.
-
- This provider requires that you have valid values for all of the
- ldap-related settings, including ``ldapbase``. You will also almost
- definitely need settings for ``ldapuser`` and ``ldappassword``, so that
- your clients can write to ldap.
-
- Note that this provider will automatically generate a GID for you if you do
- not specify one, but it is a potentially expensive operation, as it
- iterates across all existing groups to pick the appropriate next one.
-
- "
-
- confine :true => Puppet.features.ldap?, :false => (Puppet[:ldapuser] == "")
-
- # We're mapping 'members' here because we want to make it
- # easy for the ldap user provider to manage groups. This
- # way it can just use the 'update' method in the group manager,
- # whereas otherwise it would need to replicate that code.
- manages(:posixGroup).at("ou=Groups").and.maps :name => :cn, :gid => :gidNumber, :members => :memberUid
-
- # Find the next gid after the current largest gid.
- provider = self
- manager.generates(:gidNumber).with do
- largest = 500
- if existing = provider.manager.search
- existing.each do |hash|
- next unless value = hash[:gid]
- num = value[0].to_i
- largest = num if num > largest
- end
- end
- largest + 1
+ desc "Group management via ``ldap``.
+
+ This provider requires that you have valid values for all of the
+ ldap-related settings, including ``ldapbase``. You will also almost
+ definitely need settings for ``ldapuser`` and ``ldappassword``, so that
+ your clients can write to ldap.
+
+ Note that this provider will automatically generate a GID for you if you do
+ not specify one, but it is a potentially expensive operation, as it
+ iterates across all existing groups to pick the appropriate next one.
+
+ "
+
+ confine :true => Puppet.features.ldap?, :false => (Puppet[:ldapuser] == "")
+
+ # We're mapping 'members' here because we want to make it
+ # easy for the ldap user provider to manage groups. This
+ # way it can just use the 'update' method in the group manager,
+ # whereas otherwise it would need to replicate that code.
+ manages(:posixGroup).at("ou=Groups").and.maps :name => :cn, :gid => :gidNumber, :members => :memberUid
+
+ # Find the next gid after the current largest gid.
+ provider = self
+ manager.generates(:gidNumber).with do
+ largest = 500
+ if existing = provider.manager.search
+ existing.each do |hash|
+ next unless value = hash[:gid]
+ num = value[0].to_i
+ largest = num if num > largest
+ end
end
+ largest + 1
+ end
- # Convert a group name to an id.
- def self.name2id(group)
- return nil unless result = manager.search("cn=#{group}") and result.length > 0
+ # Convert a group name to an id.
+ def self.name2id(group)
+ return nil unless result = manager.search("cn=#{group}") and result.length > 0
- # Only use the first result.
- group = result[0]
- gid = group[:gid][0]
- end
+ # Only use the first result.
+ group = result[0]
+ gid = group[:gid][0]
+ end
end