summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet')
-rw-r--r--lib/puppet/provider/nameservice/directoryservice.rb16
-rw-r--r--lib/puppet/type/computer.rb8
-rwxr-xr-xlib/puppet/type/group.rb21
3 files changed, 23 insertions, 22 deletions
diff --git a/lib/puppet/provider/nameservice/directoryservice.rb b/lib/puppet/provider/nameservice/directoryservice.rb
index 0e8002c31..308f5192e 100644
--- a/lib/puppet/provider/nameservice/directoryservice.rb
+++ b/lib/puppet/provider/nameservice/directoryservice.rb
@@ -147,8 +147,20 @@ class DirectoryService < Puppet::Provider::NameService
ds_attribute = key.sub("dsAttrTypeStandard:", "")
next unless (@@ds_to_ns_attribute_map.keys.include?(ds_attribute) and type_properties.include? @@ds_to_ns_attribute_map[ds_attribute])
ds_value = dscl_plist[key]
- if not @@ds_to_ns_attribute_map[ds_attribute] == :members # only members uses arrays so far
- ds_value = ds_value[0]
+ case @@ds_to_ns_attribute_map[ds_attribute]
+ when :members:
+ ds_value = ds_value # only members uses arrays so far
+ when :gid, :uid:
+ # OS X stores objects like uid/gid as strings.
+ # Try casting to an integer for these cases to be
+ # consistent with the other providers and the group type
+ # validation
+ begin
+ ds_value = Integer(ds_value[0])
+ rescue ArgumentError
+ ds_value = ds_value[0]
+ end
+ else ds_value = ds_value[0]
end
attribute_hash[@@ds_to_ns_attribute_map[ds_attribute]] = ds_value
end
diff --git a/lib/puppet/type/computer.rb b/lib/puppet/type/computer.rb
index 0c0a70900..ccbcadf72 100644
--- a/lib/puppet/type/computer.rb
+++ b/lib/puppet/type/computer.rb
@@ -29,23 +29,25 @@ Puppet::Type.newtype(:computer) do
end
newproperty(:ensure, :parent => Puppet::Property::Ensure) do
+ desc "Control the existences of this computer record. Set this attribute to
+ ``present`` to ensure the computer record exists. Set it to ``absent``
+ to delete any computer records with this name"
newvalue(:present) do
provider.create
end
newvalue(:absent) do
- Puppet.notice "prop ensure = absent"
provider.delete
end
end
newparam(:name) do
- desc "The "
+ desc "The authoritative 'short' name of the computer record."
isnamevar
end
newparam(:realname) do
- desc "realname"
+ desc "The 'long' name of the computer record."
end
newproperty(:en_address) do
diff --git a/lib/puppet/type/group.rb b/lib/puppet/type/group.rb
index 1167962fe..e3507ad5c 100755
--- a/lib/puppet/type/group.rb
+++ b/lib/puppet/type/group.rb
@@ -1,10 +1,3 @@
-# Manage Unix groups. This class is annoyingly complicated; There
-# is some variety in whether systems use 'groupadd' or 'addgroup', but OS X
-# significantly complicates the picture by using NetInfo. Eventually we
-# will also need to deal with systems that have their groups hosted elsewhere
-# (e.g., in LDAP). That will likely only be a problem for OS X, since it
-# currently does not use the POSIX interfaces, since lookupd's cache screws
-# things up.
require 'etc'
require 'facter'
@@ -14,16 +7,10 @@ module Puppet
@doc = "Manage groups. On most platforms this can only create groups.
Group membership must be managed on individual users.
- On OS X, group membership is managed as an attribute of the group.
- This resource type uses the prescribed native tools for creating
- groups and generally uses POSIX APIs for retrieving information
- about them. It does not directly modify ``/etc/group`` or anything.
-
- For most platforms, the tools used are ``groupadd`` and its ilk;
- for Mac OS X, dscl/dseditgroup are used.
-
- This is currently unconfigurable, but if you desperately need it
- to be so, please contact us."
+ On some platforms such as OS X, group membership is managed as an
+ attribute of the group, not the user record. Providers must have
+ the feature 'manages_members' to manage the 'members' property of
+ a group record."
feature :manages_members,
"For directories where membership is an attribute of groups not users."