puppet 0.24.6 → 0.24.7
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puppet might be problematic. Click here for more details.
- data/CHANGELOG +115 -0
- data/Rakefile +43 -14
- data/bin/puppetca +6 -5
- data/bin/puppetdoc +109 -15
- data/bin/ralsh +3 -1
- data/conf/redhat/puppet.spec +74 -48
- data/examples/mcx_dock_absent.pp +4 -0
- data/examples/mcx_dock_default.pp +118 -0
- data/examples/mcx_dock_full.pp +125 -0
- data/examples/mcx_dock_invalid.pp +9 -0
- data/examples/mcx_nogroup.pp +118 -0
- data/examples/mcx_notexists_absent.pp +4 -0
- data/ext/emacs/puppet-mode.el +1 -1
- data/lib/puppet.rb +1 -1
- data/lib/puppet/external/nagios/base.rb +114 -71
- data/lib/puppet/feature/base.rb +6 -0
- data/lib/puppet/indirector/yaml.rb +12 -3
- data/lib/puppet/module.rb +1 -1
- data/lib/puppet/network/client/master.rb +1 -1
- data/lib/puppet/network/xmlrpc/client.rb +3 -1
- data/lib/puppet/parameter.rb +1 -1
- data/lib/puppet/parser/ast.rb +15 -0
- data/lib/puppet/parser/ast/astarray.rb +1 -2
- data/lib/puppet/parser/ast/casestatement.rb +2 -0
- data/lib/puppet/parser/ast/collection.rb +2 -0
- data/lib/puppet/parser/ast/comparison_operator.rb +4 -0
- data/lib/puppet/parser/ast/definition.rb +2 -0
- data/lib/puppet/parser/ast/else.rb +3 -0
- data/lib/puppet/parser/ast/function.rb +19 -12
- data/lib/puppet/parser/ast/hostclass.rb +9 -1
- data/lib/puppet/parser/ast/ifstatement.rb +3 -0
- data/lib/puppet/parser/ast/node.rb +3 -0
- data/lib/puppet/parser/ast/resource.rb +3 -0
- data/lib/puppet/parser/ast/resource_defaults.rb +2 -0
- data/lib/puppet/parser/ast/resource_override.rb +3 -0
- data/lib/puppet/parser/ast/vardef.rb +3 -0
- data/lib/puppet/parser/functions.rb +14 -0
- data/lib/puppet/parser/functions/inline_template.rb +21 -0
- data/lib/puppet/parser/functions/template.rb +3 -2
- data/lib/puppet/parser/lexer.rb +56 -7
- data/lib/puppet/parser/parser.rb +114 -98
- data/lib/puppet/parser/parser_support.rb +24 -4
- data/lib/puppet/parser/resource/reference.rb +4 -3
- data/lib/puppet/parser/templatewrapper.rb +30 -22
- data/lib/puppet/property.rb +1 -1
- data/lib/puppet/property/list.rb +7 -2
- data/lib/puppet/property/ordered_list.rb +22 -0
- data/lib/puppet/provider/augeas/augeas.rb +189 -0
- data/lib/puppet/provider/computer/computer.rb +22 -0
- data/lib/puppet/provider/confine.rb +4 -1
- data/lib/puppet/provider/confine/variable.rb +13 -2
- data/lib/puppet/provider/confine_collection.rb +4 -1
- data/lib/puppet/provider/confiner.rb +1 -1
- data/lib/puppet/provider/group/directoryservice.rb +6 -3
- data/lib/puppet/provider/group/groupadd.rb +5 -2
- data/lib/puppet/provider/group/ldap.rb +11 -9
- data/lib/puppet/provider/group/netinfo.rb +8 -4
- data/lib/puppet/provider/group/pw.rb +5 -1
- data/lib/puppet/provider/host/netinfo.rb +5 -2
- data/lib/puppet/provider/macauthorization/macauthorization.rb +315 -0
- data/lib/puppet/provider/mcx/mcxcontent.rb +201 -0
- data/lib/puppet/provider/nameservice/directoryservice.rb +210 -107
- data/lib/puppet/provider/nameservice/netinfo.rb +7 -2
- data/lib/puppet/provider/package/appdmg.rb +0 -3
- data/lib/puppet/provider/package/apt.rb +6 -0
- data/lib/puppet/provider/package/rpm.rb +2 -0
- data/lib/puppet/provider/package/yum.rb +5 -1
- data/lib/puppet/provider/package/yumhelper.py +9 -0
- data/lib/puppet/provider/service/base.rb +9 -6
- data/lib/puppet/provider/service/daemontools.rb +25 -15
- data/lib/puppet/provider/service/debian.rb +6 -2
- data/lib/puppet/provider/service/freebsd.rb +5 -2
- data/lib/puppet/provider/service/gentoo.rb +6 -3
- data/lib/puppet/provider/service/init.rb +31 -21
- data/lib/puppet/provider/service/launchd.rb +195 -0
- data/lib/puppet/provider/service/redhat.rb +5 -2
- data/lib/puppet/provider/service/runit.rb +30 -20
- data/lib/puppet/provider/service/smf.rb +7 -4
- data/lib/puppet/provider/ssh_authorized_key/parsed.rb +21 -1
- data/lib/puppet/provider/user/directoryservice.rb +1 -0
- data/lib/puppet/provider/user/netinfo.rb +9 -3
- data/lib/puppet/provider/user/user_role_add.rb +43 -6
- data/lib/puppet/provider/zfs/solaris.rb +45 -0
- data/lib/puppet/provider/zone/solaris.rb +8 -4
- data/lib/puppet/provider/zpool/solaris.rb +116 -0
- data/lib/puppet/rails/database/003_add_environment_to_host.rb +9 -0
- data/lib/puppet/rails/database/schema.rb +1 -0
- data/lib/puppet/rails/host.rb +4 -0
- data/lib/puppet/reference/configuration.rb +1 -1
- data/lib/puppet/reports/tagmail.rb +15 -6
- data/lib/puppet/transaction/change.rb +3 -5
- data/lib/puppet/transportable.rb +1 -0
- data/lib/puppet/type/augeas.rb +155 -0
- data/lib/puppet/type/computer.rb +62 -0
- data/lib/puppet/type/exec.rb +2 -1
- data/lib/puppet/type/file.rb +1 -1
- data/lib/puppet/type/file/ensure.rb +8 -5
- data/lib/puppet/type/file/mode.rb +0 -14
- data/lib/puppet/type/file/owner.rb +32 -64
- data/lib/puppet/type/file/selcontext.rb +3 -8
- data/lib/puppet/type/group.rb +27 -45
- data/lib/puppet/type/k5login.rb +1 -1
- data/lib/puppet/type/macauthorization.rb +141 -0
- data/lib/puppet/type/mcx.rb +115 -0
- data/lib/puppet/type/mount.rb +1 -1
- data/lib/puppet/type/nagios_hostdependency.rb +3 -0
- data/lib/puppet/type/ssh_authorized_key.rb +16 -0
- data/lib/puppet/type/tidy.rb +43 -14
- data/lib/puppet/type/user.rb +25 -1
- data/lib/puppet/type/zfs.rb +51 -0
- data/lib/puppet/type/zone.rb +8 -0
- data/lib/puppet/type/zpool.rb +93 -0
- data/lib/puppet/util.rb +17 -38
- data/lib/puppet/util/file_locking.rb +44 -0
- data/lib/puppet/util/filetype.rb +3 -3
- data/lib/puppet/util/log.rb +1 -16
- data/lib/puppet/util/metric.rb +0 -5
- data/lib/puppet/util/rdoc.rb +85 -0
- data/lib/puppet/util/rdoc/code_objects.rb +219 -0
- data/lib/puppet/util/rdoc/generators/puppet_generator.rb +829 -0
- data/lib/puppet/util/rdoc/generators/template/puppet/puppet.rb +1051 -0
- data/lib/puppet/util/rdoc/parser.rb +437 -0
- data/lib/puppet/util/selinux.rb +135 -63
- data/lib/puppet/util/settings.rb +136 -126
- data/lib/puppet/util/storage.rb +4 -2
- data/spec/Rakefile +91 -0
- data/spec/integration/checksum.rb +47 -0
- data/spec/integration/defaults.rb +47 -0
- data/spec/integration/file_serving/configuration.rb +43 -0
- data/spec/integration/file_serving/content.rb +18 -0
- data/spec/integration/file_serving/metadata.rb +18 -0
- data/spec/integration/indirector/direct_file_server.rb +80 -0
- data/spec/integration/indirector/file_content/file_server.rb +18 -0
- data/spec/integration/indirector/file_metadata/file_server.rb +18 -0
- data/spec/integration/indirector/module_files.rb +57 -0
- data/spec/integration/indirector/node/ldap.rb +15 -0
- data/spec/integration/indirector/rest.rb +464 -0
- data/spec/integration/network/server/mongrel.rb +48 -0
- data/spec/integration/network/server/webrick.rb +48 -0
- data/spec/integration/node.rb +93 -0
- data/spec/integration/node/catalog.rb +54 -0
- data/spec/integration/node/facts.rb +45 -0
- data/spec/integration/provider/package.rb +26 -0
- data/spec/integration/provider/service/init.rb +32 -0
- data/spec/integration/reference/providers.rb +17 -0
- data/spec/integration/reports.rb +14 -0
- data/spec/integration/transaction/report.rb +26 -0
- data/spec/integration/type/package.rb +22 -0
- data/spec/integration/util/file_locking.rb +36 -0
- data/spec/monkey_patches/add_confine_and_runnable_to_rspec_dsl.rb +46 -0
- data/spec/monkey_patches/alias_should_to_must.rb +5 -0
- data/spec/shared_behaviours/file_server_terminus.rb +42 -0
- data/spec/shared_behaviours/file_serving.rb +64 -0
- data/spec/shared_behaviours/memory_terminus.rb +32 -0
- data/spec/spec.opts +5 -0
- data/spec/spec_helper.rb +36 -0
- data/spec/unit/executables/client/certhandler.rb +122 -0
- data/spec/unit/file_serving/configuration.rb +224 -0
- data/spec/unit/file_serving/configuration/parser.rb +135 -0
- data/spec/unit/file_serving/content.rb +71 -0
- data/spec/unit/file_serving/file_base.rb +124 -0
- data/spec/unit/file_serving/fileset.rb +239 -0
- data/spec/unit/file_serving/indirection_hooks.rb +124 -0
- data/spec/unit/file_serving/metadata.rb +187 -0
- data/spec/unit/file_serving/mount.rb +143 -0
- data/spec/unit/file_serving/terminus_helper.rb +76 -0
- data/spec/unit/indirector.rb +152 -0
- data/spec/unit/indirector/catalog/compiler.rb +156 -0
- data/spec/unit/indirector/catalog/yaml.rb +25 -0
- data/spec/unit/indirector/checksum/file.rb +139 -0
- data/spec/unit/indirector/code.rb +33 -0
- data/spec/unit/indirector/direct_file_server.rb +89 -0
- data/spec/unit/indirector/envelope.rb +47 -0
- data/spec/unit/indirector/exec.rb +51 -0
- data/spec/unit/indirector/facts/facter.rb +76 -0
- data/spec/unit/indirector/facts/yaml.rb +26 -0
- data/spec/unit/indirector/file.rb +154 -0
- data/spec/unit/indirector/file_content/file.rb +18 -0
- data/spec/unit/indirector/file_content/file_server.rb +18 -0
- data/spec/unit/indirector/file_content/modules.rb +18 -0
- data/spec/unit/indirector/file_content/rest.rb +11 -0
- data/spec/unit/indirector/file_metadata/file.rb +52 -0
- data/spec/unit/indirector/file_metadata/file_server.rb +18 -0
- data/spec/unit/indirector/file_metadata/modules.rb +42 -0
- data/spec/unit/indirector/file_metadata/rest.rb +9 -0
- data/spec/unit/indirector/file_server.rb +184 -0
- data/spec/unit/indirector/indirection.rb +731 -0
- data/spec/unit/indirector/ldap.rb +143 -0
- data/spec/unit/indirector/memory.rb +29 -0
- data/spec/unit/indirector/module_files.rb +259 -0
- data/spec/unit/indirector/node/exec.rb +69 -0
- data/spec/unit/indirector/node/ldap.rb +424 -0
- data/spec/unit/indirector/node/memory.rb +19 -0
- data/spec/unit/indirector/node/plain.rb +19 -0
- data/spec/unit/indirector/node/rest.rb +13 -0
- data/spec/unit/indirector/node/yaml.rb +25 -0
- data/spec/unit/indirector/plain.rb +29 -0
- data/spec/unit/indirector/report/processor.rb +81 -0
- data/spec/unit/indirector/request.rb +87 -0
- data/spec/unit/indirector/rest.rb +372 -0
- data/spec/unit/indirector/ssl_rsa/file.rb +116 -0
- data/spec/unit/indirector/terminus.rb +245 -0
- data/spec/unit/indirector/yaml.rb +145 -0
- data/spec/unit/module.rb +247 -0
- data/spec/unit/network/client.rb +45 -0
- data/spec/unit/network/client/master.rb +442 -0
- data/spec/unit/network/handler/fileserver.rb +179 -0
- data/spec/unit/network/http.rb +35 -0
- data/spec/unit/network/http/mongrel.rb +117 -0
- data/spec/unit/network/http/mongrel/rest.rb +377 -0
- data/spec/unit/network/http/mongrel/xmlrpc.rb +0 -0
- data/spec/unit/network/http/webrick.rb +127 -0
- data/spec/unit/network/http/webrick/rest.rb +323 -0
- data/spec/unit/network/http/webrick/xmlrpc.rb +0 -0
- data/spec/unit/network/http_pool.rb +238 -0
- data/spec/unit/network/server.rb +316 -0
- data/spec/unit/network/xmlrpc/client.rb +13 -0
- data/spec/unit/node.rb +167 -0
- data/spec/unit/node/catalog.rb +864 -0
- data/spec/unit/node/environment.rb +37 -0
- data/spec/unit/node/facts.rb +44 -0
- data/spec/unit/other/checksum.rb +92 -0
- data/spec/unit/other/pgraph.rb +210 -0
- data/spec/unit/other/transaction.rb +33 -0
- data/spec/unit/other/transbucket.rb +172 -0
- data/spec/unit/other/transobject.rb +92 -0
- data/spec/unit/parameter.rb +24 -0
- data/spec/unit/parser/ast.rb +37 -0
- data/spec/unit/parser/ast/arithmetic_operator.rb +73 -0
- data/spec/unit/parser/ast/astarray.rb +66 -0
- data/spec/unit/parser/ast/boolean_operator.rb +53 -0
- data/spec/unit/parser/ast/collexpr.rb +92 -0
- data/spec/unit/parser/ast/comparison_operator.rb +92 -0
- data/spec/unit/parser/ast/definition.rb +195 -0
- data/spec/unit/parser/ast/function.rb +77 -0
- data/spec/unit/parser/ast/hostclass.rb +148 -0
- data/spec/unit/parser/ast/minus.rb +36 -0
- data/spec/unit/parser/ast/node.rb +125 -0
- data/spec/unit/parser/ast/nop.rb +20 -0
- data/spec/unit/parser/ast/not.rb +30 -0
- data/spec/unit/parser/ast/resource_override.rb +51 -0
- data/spec/unit/parser/ast/resource_reference.rb +63 -0
- data/spec/unit/parser/ast/vardef.rb +47 -0
- data/spec/unit/parser/collector.rb +426 -0
- data/spec/unit/parser/compiler.rb +561 -0
- data/spec/unit/parser/functions.rb +83 -0
- data/spec/unit/parser/functions/inline_template.rb +59 -0
- data/spec/unit/parser/functions/template.rb +62 -0
- data/spec/unit/parser/interpreter.rb +138 -0
- data/spec/unit/parser/lexer.rb +646 -0
- data/spec/unit/parser/parser.rb +228 -0
- data/spec/unit/parser/resource.rb +336 -0
- data/spec/unit/parser/resource/reference.rb +95 -0
- data/spec/unit/parser/scope.rb +87 -0
- data/spec/unit/parser/templatewrapper.rb +129 -0
- data/spec/unit/property.rb +35 -0
- data/spec/unit/property/keyvalue.rb +168 -0
- data/spec/unit/property/list.rb +156 -0
- data/spec/unit/property/ordered_list.rb +64 -0
- data/spec/unit/provider/augeas/augeas.rb +238 -0
- data/spec/unit/provider/confine.rb +78 -0
- data/spec/unit/provider/confine/exists.rb +81 -0
- data/spec/unit/provider/confine/false.rb +53 -0
- data/spec/unit/provider/confine/feature.rb +60 -0
- data/spec/unit/provider/confine/true.rb +53 -0
- data/spec/unit/provider/confine/variable.rb +107 -0
- data/spec/unit/provider/confine_collection.rb +134 -0
- data/spec/unit/provider/confiner.rb +63 -0
- data/spec/unit/provider/group/groupadd.rb +31 -0
- data/spec/unit/provider/group/ldap.rb +105 -0
- data/spec/unit/provider/ldap.rb +248 -0
- data/spec/unit/provider/macauthorization.rb +147 -0
- data/spec/unit/provider/mcx/mcxcontent.rb +175 -0
- data/spec/unit/provider/mount.rb +130 -0
- data/spec/unit/provider/mount/parsed.rb +185 -0
- data/spec/unit/provider/package/apt.rb +138 -0
- data/spec/unit/provider/package/dpkg.rb +163 -0
- data/spec/unit/provider/package/gem.rb +87 -0
- data/spec/unit/provider/package/hpux.rb +52 -0
- data/spec/unit/provider/selboolean.rb +37 -0
- data/spec/unit/provider/selmodule-example.pp +0 -0
- data/spec/unit/provider/selmodule.rb +66 -0
- data/spec/unit/provider/service/daemontools.rb +124 -0
- data/spec/unit/provider/service/launchd.rb +134 -0
- data/spec/unit/provider/service/runit.rb +117 -0
- data/spec/unit/provider/ssh_authorized_key/parsed.rb +102 -0
- data/spec/unit/provider/user/hpux.rb +25 -0
- data/spec/unit/provider/user/ldap.rb +279 -0
- data/spec/unit/provider/user/user_role_add.rb +249 -0
- data/spec/unit/provider/user/useradd.rb +115 -0
- data/spec/unit/provider/zfs/solaris.rb +87 -0
- data/spec/unit/provider/zone/solaris.rb +42 -0
- data/spec/unit/provider/zpool/solaris.rb +179 -0
- data/spec/unit/rails.rb +125 -0
- data/spec/unit/relationship.rb +149 -0
- data/spec/unit/reports.rb +61 -0
- data/spec/unit/resource_reference.rb +73 -0
- data/spec/unit/simple_graph.rb +280 -0
- data/spec/unit/transaction/change.rb +187 -0
- data/spec/unit/transaction/event.rb +25 -0
- data/spec/unit/transaction/report.rb +40 -0
- data/spec/unit/type.rb +64 -0
- data/spec/unit/type/augeas.rb +113 -0
- data/spec/unit/type/computer.rb +82 -0
- data/spec/unit/type/exec.rb +91 -0
- data/spec/unit/type/file.rb +155 -0
- data/spec/unit/type/file/ensure.rb +21 -0
- data/spec/unit/type/file/group.rb +118 -0
- data/spec/unit/type/file/owner.rb +132 -0
- data/spec/unit/type/file/selinux.rb +82 -0
- data/spec/unit/type/group.rb +40 -0
- data/spec/unit/type/macauthorization.rb +78 -0
- data/spec/unit/type/mcx.rb +108 -0
- data/spec/unit/type/mount.rb +219 -0
- data/spec/unit/type/nagios.rb +63 -0
- data/spec/unit/type/noop_metaparam.rb +38 -0
- data/spec/unit/type/package.rb +246 -0
- data/spec/unit/type/resources.rb +27 -0
- data/spec/unit/type/schedule.rb +339 -0
- data/spec/unit/type/selboolean.rb +47 -0
- data/spec/unit/type/selmodule.rb +18 -0
- data/spec/unit/type/service.rb +254 -0
- data/spec/unit/type/ssh_authorized_key.rb +106 -0
- data/spec/unit/type/tidy.rb +68 -0
- data/spec/unit/type/user.rb +260 -0
- data/spec/unit/type/zfs.rb +45 -0
- data/spec/unit/type/zone.rb +20 -0
- data/spec/unit/type/zpool.rb +110 -0
- data/spec/unit/util/checksums.rb +99 -0
- data/spec/unit/util/constant_inflector.rb +70 -0
- data/spec/unit/util/file_locking.rb +115 -0
- data/spec/unit/util/ldap/connection.rb +169 -0
- data/spec/unit/util/ldap/generator.rb +54 -0
- data/spec/unit/util/ldap/manager.rb +654 -0
- data/spec/unit/util/loadedfile.rb +65 -0
- data/spec/unit/util/log.rb +107 -0
- data/spec/unit/util/metric.rb +95 -0
- data/spec/unit/util/nagios_maker.rb +128 -0
- data/spec/unit/util/posix.rb +256 -0
- data/spec/unit/util/resource_template.rb +58 -0
- data/spec/unit/util/selinux.rb +219 -0
- data/spec/unit/util/settings.rb +847 -0
- data/spec/unit/util/storage.rb +248 -0
- data/spec/unit/util/tagging.rb +92 -0
- data/spec/unit/util/uri_helper.rb +41 -0
- data/spec/unit/util/user_attr.rb +47 -0
- data/spec/unit/util/warnings.rb +35 -0
- data/test/certmgr/support.rb +0 -6
- data/test/data/providers/ssh_authorized_key/parsed/authorized_keys +1 -0
- data/test/data/snippets/multilinecomments.pp +6 -0
- data/test/data/snippets/multipleclass.pp +9 -0
- data/test/language/functions.rb +11 -1
- data/test/language/snippets.rb +16 -0
- data/test/lib/puppettest/runnable_test.rb +1 -1
- data/test/network/handler/fileserver.rb +5 -0
- data/test/other/report.rb +0 -4
- data/test/ral/type/resources.rb +2 -19
- data/test/util/settings.rb +4 -4
- data/test/util/storage.rb +0 -24
- data/test/util/utiltest.rb +0 -33
- metadata +319 -26
- data/conf/debian/README.source +0 -2
- data/conf/debian/TODO.Debian +0 -1
- data/conf/debian/changelog +0 -257
- data/conf/debian/compat +0 -1
- data/conf/debian/control +0 -45
- data/conf/debian/copyright +0 -17
- data/conf/debian/docs +0 -1
- data/conf/debian/fileserver.conf +0 -12
- data/conf/debian/puppet.NEWS +0 -63
- data/conf/debian/puppet.conf +0 -8
- data/conf/debian/puppet.dirs +0 -7
- data/conf/debian/puppet.files +0 -6
- data/conf/debian/puppet.init +0 -64
- data/conf/debian/puppet.logrotate +0 -11
- data/conf/debian/puppet.postinst +0 -9
- data/conf/debian/puppet.postrm +0 -21
- data/conf/debian/puppet.preinst +0 -25
- data/conf/debian/puppetmaster.files +0 -4
- data/conf/debian/puppetmaster.init +0 -58
- data/conf/debian/rules +0 -115
- data/conf/debian/watch +0 -2
- data/lib/puppet/type/nagios_hostgroupescalation.rb +0 -3
@@ -0,0 +1,201 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (C) 2008 Jeffrey J McCune.
|
3
|
+
|
4
|
+
# This program and entire repository is free software; you can
|
5
|
+
# redistribute it and/or modify it under the terms of the GNU
|
6
|
+
# General Public License as published by the Free Software
|
7
|
+
# Foundation; either version 2 of the License, or any later version.
|
8
|
+
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU General Public License for more details.
|
13
|
+
|
14
|
+
# You should have received a copy of the GNU General Public License
|
15
|
+
# along with this program; if not, write to the Free Software
|
16
|
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
17
|
+
|
18
|
+
# Author: Jeff McCune <mccune.jeff@gmail.com>
|
19
|
+
|
20
|
+
require 'tempfile'
|
21
|
+
|
22
|
+
Puppet::Type.type(:mcx).provide :mcxcontent, :parent => Puppet::Provider do
|
23
|
+
|
24
|
+
desc "MCX Settings management using DirectoryService on OS X.
|
25
|
+
|
26
|
+
This provider manages the entire MCXSettings attribute available
|
27
|
+
to some directory services nodes. This management is 'all or nothing'
|
28
|
+
in that discrete application domain key value pairs are not managed
|
29
|
+
by this provider.
|
30
|
+
|
31
|
+
It is recommended to use WorkGroup Manager to configure Users, Groups,
|
32
|
+
Computers, or ComputerLists, then use 'ralsh mcx' to generate a puppet
|
33
|
+
manifest from the resulting configuration.
|
34
|
+
|
35
|
+
Original Author: Jeff McCune (mccune.jeff@gmail.com)
|
36
|
+
|
37
|
+
"
|
38
|
+
|
39
|
+
# This provides a mapping of puppet types to DirectoryService
|
40
|
+
# type strings.
|
41
|
+
TypeMap = {
|
42
|
+
:user => "Users",
|
43
|
+
:group => "Groups",
|
44
|
+
:computer => "Computers",
|
45
|
+
:computerlist => "ComputerLists",
|
46
|
+
}
|
47
|
+
|
48
|
+
class MCXContentProviderException < Exception
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
commands :dscl => "/usr/bin/dscl"
|
53
|
+
confine :operatingsystem => :darwin
|
54
|
+
defaultfor :operatingsystem => :darwin
|
55
|
+
|
56
|
+
# self.instances is all important.
|
57
|
+
# This is the only class method, it returns
|
58
|
+
# an array of instances of this class.
|
59
|
+
def self.instances
|
60
|
+
mcx_list = []
|
61
|
+
for ds_type in TypeMap.keys
|
62
|
+
ds_path = "/Local/Default/#{TypeMap[ds_type]}"
|
63
|
+
output = dscl 'localhost', '-list', ds_path
|
64
|
+
member_list = output.split
|
65
|
+
for ds_name in member_list
|
66
|
+
content = mcxexport(ds_type, ds_name)
|
67
|
+
if content.empty?
|
68
|
+
Puppet.debug "/#{TypeMap[ds_type]}/#{ds_name} has no MCX data."
|
69
|
+
else
|
70
|
+
# This node has MCX data.
|
71
|
+
rsrc = self.new(:name => "/#{TypeMap[ds_type]}/#{ds_name}",
|
72
|
+
:ds_type => ds_type,
|
73
|
+
:ds_name => ds_name,
|
74
|
+
:content => content)
|
75
|
+
mcx_list << rsrc
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
return mcx_list
|
80
|
+
end
|
81
|
+
|
82
|
+
private
|
83
|
+
|
84
|
+
# mcxexport is used by instances, and therefore
|
85
|
+
# a class method.
|
86
|
+
def self.mcxexport(ds_type, ds_name)
|
87
|
+
ds_t = TypeMap[ds_type]
|
88
|
+
ds_n = ds_name.to_s
|
89
|
+
ds_path = "/Local/Default/#{ds_t}/#{ds_n}"
|
90
|
+
dscl 'localhost', '-mcxexport', ds_path
|
91
|
+
end
|
92
|
+
|
93
|
+
def mcximport(ds_type, ds_name, val)
|
94
|
+
ds_t = TypeMap[ds_type]
|
95
|
+
ds_n = ds_name.to_s
|
96
|
+
ds_path = "/Local/Default/#{ds_t}/#{ds_name}"
|
97
|
+
|
98
|
+
tmp = Tempfile.new('puppet_mcx')
|
99
|
+
begin
|
100
|
+
tmp << val
|
101
|
+
tmp.flush
|
102
|
+
dscl 'localhost', '-mcximport', ds_path, tmp.path
|
103
|
+
ensure
|
104
|
+
tmp.close
|
105
|
+
tmp.unlink
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
# Given the resource name string, parse ds_type out.
|
110
|
+
def parse_type(name)
|
111
|
+
tmp = name.split('/')[1]
|
112
|
+
if ! tmp.is_a? String
|
113
|
+
raise MCXContentProviderException,
|
114
|
+
"Coult not parse ds_type from resource name '#{name}'. Specify with ds_type parameter."
|
115
|
+
end
|
116
|
+
# De-pluralize and downcase.
|
117
|
+
tmp = tmp.chop.downcase.to_sym
|
118
|
+
if not TypeMap.keys.member? tmp
|
119
|
+
raise MCXContentProviderException,
|
120
|
+
"Coult not parse ds_type from resource name '#{name}'. Specify with ds_type parameter."
|
121
|
+
end
|
122
|
+
return tmp
|
123
|
+
end
|
124
|
+
|
125
|
+
# Given the resource name string, parse ds_name out.
|
126
|
+
def parse_name(name)
|
127
|
+
ds_name = name.split('/')[2]
|
128
|
+
if ! ds_name.is_a? String
|
129
|
+
raise MCXContentProviderException,
|
130
|
+
"Could not parse ds_name from resource name '#{name}'. Specify with ds_name parameter."
|
131
|
+
end
|
132
|
+
return ds_name
|
133
|
+
end
|
134
|
+
|
135
|
+
# Gather ds_type and ds_name from resource or
|
136
|
+
# parse it out of the name.
|
137
|
+
# This is a private instance method, not a class method.
|
138
|
+
def get_dsparams
|
139
|
+
ds_type = resource[:ds_type]
|
140
|
+
if ds_type.nil?
|
141
|
+
ds_type = parse_type(resource[:name])
|
142
|
+
end
|
143
|
+
raise MCXContentProviderException unless TypeMap.keys.include? ds_type.to_sym
|
144
|
+
|
145
|
+
ds_name = resource[:ds_name]
|
146
|
+
if ds_name.nil?
|
147
|
+
ds_name = parse_name(resource[:name])
|
148
|
+
end
|
149
|
+
|
150
|
+
rval = {
|
151
|
+
:ds_type => ds_type.to_sym,
|
152
|
+
:ds_name => ds_name,
|
153
|
+
}
|
154
|
+
|
155
|
+
return rval
|
156
|
+
|
157
|
+
end
|
158
|
+
|
159
|
+
public
|
160
|
+
|
161
|
+
def create
|
162
|
+
self.content=(resource[:content])
|
163
|
+
end
|
164
|
+
|
165
|
+
def destroy
|
166
|
+
ds_parms = get_dsparams
|
167
|
+
ds_t = TypeMap[ds_parms[:ds_type]]
|
168
|
+
ds_n = ds_parms[:ds_name].to_s
|
169
|
+
ds_path = "/Local/Default/#{ds_t}/#{ds_n}"
|
170
|
+
|
171
|
+
dscl 'localhost', '-mcxdelete', ds_path
|
172
|
+
end
|
173
|
+
|
174
|
+
def exists?
|
175
|
+
# JJM Just re-use the content method and see if it's empty.
|
176
|
+
begin
|
177
|
+
mcx = content
|
178
|
+
rescue Puppet::ExecutionFailure => e
|
179
|
+
return false
|
180
|
+
end
|
181
|
+
has_mcx = ! mcx.empty?
|
182
|
+
return has_mcx
|
183
|
+
end
|
184
|
+
|
185
|
+
def content
|
186
|
+
ds_parms = get_dsparams
|
187
|
+
mcx = self.class.mcxexport(ds_parms[:ds_type],
|
188
|
+
ds_parms[:ds_name])
|
189
|
+
return mcx
|
190
|
+
end
|
191
|
+
|
192
|
+
def content=(value)
|
193
|
+
# dscl localhost -mcximport
|
194
|
+
ds_parms = get_dsparams
|
195
|
+
mcx = mcximport(ds_parms[:ds_type],
|
196
|
+
ds_parms[:ds_name],
|
197
|
+
resource[:content])
|
198
|
+
return mcx
|
199
|
+
end
|
200
|
+
|
201
|
+
end
|
@@ -14,6 +14,8 @@
|
|
14
14
|
|
15
15
|
require 'puppet'
|
16
16
|
require 'puppet/provider/nameservice'
|
17
|
+
require 'facter/util/plist'
|
18
|
+
|
17
19
|
|
18
20
|
class Puppet::Provider::NameService
|
19
21
|
class DirectoryService < Puppet::Provider::NameService
|
@@ -26,6 +28,7 @@ class DirectoryService < Puppet::Provider::NameService
|
|
26
28
|
attr_writer :ds_path
|
27
29
|
end
|
28
30
|
|
31
|
+
|
29
32
|
# JJM 2007-07-24: Not yet sure what initvars() does. I saw it in netinfo.rb
|
30
33
|
# I do know, however, that it makes methods "work" =)
|
31
34
|
# e.g. addcmd isn't available if this method call isn't present.
|
@@ -36,9 +39,9 @@ class DirectoryService < Puppet::Provider::NameService
|
|
36
39
|
initvars()
|
37
40
|
|
38
41
|
commands :dscl => "/usr/bin/dscl"
|
42
|
+
commands :dseditgroup => "/usr/sbin/dseditgroup"
|
39
43
|
confine :operatingsystem => :darwin
|
40
|
-
|
41
|
-
# defaultfor :operatingsystem => :darwin
|
44
|
+
defaultfor :operatingsystem => :darwin
|
42
45
|
|
43
46
|
|
44
47
|
# JJM 2007-07-25: This map is used to map NameService attributes to their
|
@@ -55,6 +58,10 @@ class DirectoryService < Puppet::Provider::NameService
|
|
55
58
|
'UniqueID' => :uid,
|
56
59
|
'RealName' => :comment,
|
57
60
|
'Password' => :password,
|
61
|
+
'GeneratedUID' => :guid,
|
62
|
+
'IPAddress' => :ip_address,
|
63
|
+
'ENetAddress' => :en_address,
|
64
|
+
'GroupMembership' => :members,
|
58
65
|
}
|
59
66
|
# JJM The same table as above, inverted.
|
60
67
|
@@ns_to_ds_attribute_map = {
|
@@ -65,16 +72,19 @@ class DirectoryService < Puppet::Provider::NameService
|
|
65
72
|
:uid => 'UniqueID',
|
66
73
|
:comment => 'RealName',
|
67
74
|
:password => 'Password',
|
75
|
+
:guid => 'GeneratedUID',
|
76
|
+
:en_address => 'ENetAddress',
|
77
|
+
:ip_address => 'IPAddress',
|
78
|
+
:members => 'GroupMembership',
|
68
79
|
}
|
69
80
|
|
81
|
+
@@password_hash_dir = "/var/db/shadow/hash"
|
82
|
+
|
70
83
|
def self.instances
|
71
84
|
# JJM Class method that provides an array of instance objects of this
|
72
85
|
# type.
|
73
|
-
|
74
86
|
# JJM: Properties are dependent on the Puppet::Type we're managine.
|
75
87
|
type_property_array = [:name] + @resource_type.validproperties
|
76
|
-
# JJM: No sense reporting the password. It's hashed.
|
77
|
-
type_property_array.delete(:password) if type_property_array.include? :password
|
78
88
|
|
79
89
|
# Create a new instance of this Puppet::Type for each object present
|
80
90
|
# on the system.
|
@@ -119,7 +129,7 @@ class DirectoryService < Puppet::Provider::NameService
|
|
119
129
|
|
120
130
|
all_present_str_array = list_all_present()
|
121
131
|
|
122
|
-
#
|
132
|
+
# NBK: shortcut the process if the resource is missing
|
123
133
|
return nil unless all_present_str_array.include? resource_name
|
124
134
|
|
125
135
|
dscl_vector = get_exec_preamble("-read", resource_name)
|
@@ -132,44 +142,37 @@ class DirectoryService < Puppet::Provider::NameService
|
|
132
142
|
# JJM: We need a new hash to return back to our caller.
|
133
143
|
attribute_hash = Hash.new
|
134
144
|
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
# ruby-debug, and stepping through it.
|
139
|
-
dscl_output.split("\n").each do |line|
|
140
|
-
# JJM: Split the attribute name and the list of values.
|
141
|
-
ds_attribute, ds_values_string = line.split(':')
|
142
|
-
|
143
|
-
# Split sets the values to nil if there's nothing after the :
|
144
|
-
ds_values_string ||= ""
|
145
|
-
|
146
|
-
# JJM: skip this attribute line if the Puppet::Type doesn't care about it.
|
145
|
+
dscl_plist = Plist.parse_xml(dscl_output)
|
146
|
+
dscl_plist.keys().each do |key|
|
147
|
+
ds_attribute = key.sub("dsAttrTypeStandard:", "")
|
147
148
|
next unless (@@ds_to_ns_attribute_map.keys.include?(ds_attribute) and type_properties.include? @@ds_to_ns_attribute_map[ds_attribute])
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
149
|
+
ds_value = dscl_plist[key]
|
150
|
+
case @@ds_to_ns_attribute_map[ds_attribute]
|
151
|
+
when :members:
|
152
|
+
ds_value = ds_value # only members uses arrays so far
|
153
|
+
when :gid, :uid:
|
154
|
+
# OS X stores objects like uid/gid as strings.
|
155
|
+
# Try casting to an integer for these cases to be
|
156
|
+
# consistent with the other providers and the group type
|
157
|
+
# validation
|
158
|
+
begin
|
159
|
+
ds_value = Integer(ds_value[0])
|
160
|
+
rescue ArgumentError
|
161
|
+
ds_value = ds_value[0]
|
162
|
+
end
|
163
|
+
else ds_value = ds_value[0]
|
159
164
|
end
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
# THERE MAY BE AN ORDERING ISSUE HERE, but I think it's ok...
|
170
|
-
attribute_hash[@@ds_to_ns_attribute_map[ds_attribute]] = ds_value_array[0]
|
165
|
+
attribute_hash[@@ds_to_ns_attribute_map[ds_attribute]] = ds_value
|
166
|
+
end
|
167
|
+
|
168
|
+
# NBK: need to read the existing password here as it's not actually
|
169
|
+
# stored in the user record. It is stored at a path that involves the
|
170
|
+
# UUID of the user record for non-Mobile local acccounts.
|
171
|
+
# Mobile Accounts are out of scope for this provider for now
|
172
|
+
if @resource_type.validproperties.include?(:password)
|
173
|
+
attribute_hash[:password] = self.get_password(attribute_hash[:guid])
|
171
174
|
end
|
172
|
-
return attribute_hash
|
175
|
+
return attribute_hash
|
173
176
|
end
|
174
177
|
|
175
178
|
def self.get_exec_preamble(ds_action, resource_name = nil)
|
@@ -181,7 +184,7 @@ class DirectoryService < Puppet::Provider::NameService
|
|
181
184
|
# We EXPECT name to be @resource[:name] when called from an instance object.
|
182
185
|
|
183
186
|
# There are two ways to specify paths in 10.5. See man dscl.
|
184
|
-
command_vector = [ command(:dscl), "-
|
187
|
+
command_vector = [ command(:dscl), "-plist", "." ]
|
185
188
|
# JJM: The actual action to perform. See "man dscl"
|
186
189
|
# Common actiosn: -create, -delete, -merge, -append, -passwd
|
187
190
|
command_vector << ds_action
|
@@ -196,6 +199,52 @@ class DirectoryService < Puppet::Provider::NameService
|
|
196
199
|
# e.g. 'dscl / -create /Users/mccune'
|
197
200
|
return command_vector
|
198
201
|
end
|
202
|
+
|
203
|
+
def self.set_password(resource_name, guid, password_hash)
|
204
|
+
password_hash_file = "#{@@password_hash_dir}/#{guid}"
|
205
|
+
begin
|
206
|
+
File.open(password_hash_file, 'w') { |f| f.write(password_hash)}
|
207
|
+
rescue Errno::EACCES => detail
|
208
|
+
raise Puppet::Error, "Could not write to password hash file: #{detail}"
|
209
|
+
end
|
210
|
+
|
211
|
+
# NBK: For shadow hashes, the user AuthenticationAuthority must contain a value of
|
212
|
+
# ";ShadowHash;". The LKDC in 10.5 makes this more interesting though as it
|
213
|
+
# will dynamically generate ;Kerberosv5;;username@LKDC:SHA1 attributes if
|
214
|
+
# missing. Thus we make sure we only set ;ShadowHash; if it is missing, and
|
215
|
+
# we can do this with the merge command. This allows people to continue to
|
216
|
+
# use other custom AuthenticationAuthority attributes without stomping on them.
|
217
|
+
#
|
218
|
+
# There is a potential problem here in that we're only doing this when setting
|
219
|
+
# the password, and the attribute could get modified at other times while the
|
220
|
+
# hash doesn't change and so this doesn't get called at all... but
|
221
|
+
# without switching all the other attributes to merge instead of create I can't
|
222
|
+
# see a simple enough solution for this that doesn't modify the user record
|
223
|
+
# every single time. This should be a rather rare edge case. (famous last words)
|
224
|
+
|
225
|
+
dscl_vector = self.get_exec_preamble("-merge", resource_name)
|
226
|
+
dscl_vector << "AuthenticationAuthority" << ";ShadowHash;"
|
227
|
+
begin
|
228
|
+
dscl_output = execute(dscl_vector)
|
229
|
+
rescue Puppet::ExecutionFailure => detail
|
230
|
+
raise Puppet::Error, "Could not set AuthenticationAuthority."
|
231
|
+
end
|
232
|
+
end
|
233
|
+
|
234
|
+
def self.get_password(guid)
|
235
|
+
password_hash = nil
|
236
|
+
password_hash_file = "#{@@password_hash_dir}/#{guid}"
|
237
|
+
# TODO: sort out error conditions?
|
238
|
+
if File.exists?(password_hash_file)
|
239
|
+
if not File.readable?(password_hash_file)
|
240
|
+
raise Puppet::Error("Could not read password hash file at #{password_hash_file} for #{@resource[:name]}")
|
241
|
+
end
|
242
|
+
f = File.new(password_hash_file)
|
243
|
+
password_hash = f.read
|
244
|
+
f.close
|
245
|
+
end
|
246
|
+
password_hash
|
247
|
+
end
|
199
248
|
|
200
249
|
def ensure=(ensure_value)
|
201
250
|
super
|
@@ -206,7 +255,6 @@ class DirectoryService < Puppet::Provider::NameService
|
|
206
255
|
if ensure_value == :present
|
207
256
|
@resource.class.validproperties.each do |name|
|
208
257
|
next if name == :ensure
|
209
|
-
|
210
258
|
# LAK: We use property.sync here rather than directly calling
|
211
259
|
# the settor method because the properties might do some kind
|
212
260
|
# of conversion. In particular, the user gid property might
|
@@ -223,79 +271,130 @@ class DirectoryService < Puppet::Provider::NameService
|
|
223
271
|
end
|
224
272
|
|
225
273
|
def password=(passphrase)
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
# JJM: Second, we need to actually set the password. dscl does
|
240
|
-
# some magic, creating the proper hash for us based on the
|
241
|
-
# AuthenticationAuthority attribute, set above.
|
242
|
-
dscl_vector = self.class.get_exec_preamble("-passwd", @resource[:name])
|
243
|
-
dscl_vector << passphrase
|
244
|
-
# JJM: Should we not log the password string? This may be a security
|
245
|
-
# risk...
|
246
|
-
begin
|
247
|
-
dscl_output = execute(dscl_vector)
|
248
|
-
rescue Puppet::ExecutionFailure => detail
|
249
|
-
raise Puppet::Error, "Could not set password using command vector: %{dscl_vector.inspect}"
|
250
|
-
end
|
274
|
+
exec_arg_vector = self.class.get_exec_preamble("-read", @resource.name)
|
275
|
+
exec_arg_vector << @@ns_to_ds_attribute_map[:guid]
|
276
|
+
begin
|
277
|
+
guid_output = execute(exec_arg_vector)
|
278
|
+
guid_plist = Plist.parse_xml(guid_output)
|
279
|
+
# Although GeneratedUID like all DirectoryService values can be multi-valued
|
280
|
+
# according to the schema, in practice user accounts cannot have multiple UUIDs
|
281
|
+
# otherwise Bad Things Happen, so we just deal with the first value.
|
282
|
+
guid = guid_plist["dsAttrTypeStandard:#{@@ns_to_ds_attribute_map[:guid]}"][0]
|
283
|
+
self.class.set_password(@resource.name, guid, passphrase)
|
284
|
+
rescue Puppet::ExecutionFailure => detail
|
285
|
+
raise Puppet::Error, "Could not set %s on %s[%s]: %s" % [param, @resource.class.name, @resource.name, detail]
|
286
|
+
end
|
251
287
|
end
|
252
288
|
|
253
|
-
#
|
254
|
-
#
|
255
|
-
#
|
256
|
-
# I'm not sure what the implications are of doing things this way.
|
257
|
-
# It was a bit difficult to sort out what was happening in my head,
|
258
|
-
# but ruby-debug makes this process much more transparent.
|
259
|
-
#
|
260
|
-
def set(property, value)
|
261
|
-
# JJM: As it turns out, the set method defined in our parent class
|
262
|
-
# is fine. It just calls the modifycmd() method, which
|
263
|
-
# I'll implement here.
|
264
|
-
super
|
265
|
-
end
|
289
|
+
# NBK: we override @parent.set as we need to execute a series of commands
|
290
|
+
# to deal with array values, rather than the single command nameservice.rb
|
291
|
+
# expects to be returned by modifycmd. Thus we don't bother defining modifycmd.
|
266
292
|
|
267
|
-
def
|
268
|
-
|
269
|
-
|
270
|
-
|
293
|
+
def set(param, value)
|
294
|
+
self.class.validate(param, value)
|
295
|
+
current_members = @property_value_cache_hash[:members]
|
296
|
+
if param == :members
|
297
|
+
# If we are meant to be authoritative for the group membership
|
298
|
+
# then remove all existing members who haven't been specified
|
299
|
+
# in the manifest.
|
300
|
+
if @resource[:auth_membership] and not current_members.nil?
|
301
|
+
remove_unwanted_members(current_members, value)
|
302
|
+
end
|
303
|
+
|
304
|
+
# if they're not a member, make them one.
|
305
|
+
add_members(current_members, value)
|
271
306
|
else
|
272
|
-
|
307
|
+
exec_arg_vector = self.class.get_exec_preamble("-create", @resource[:name])
|
308
|
+
# JJM: The following line just maps the NS name to the DS name
|
309
|
+
# e.g. { :uid => 'UniqueID' }
|
310
|
+
exec_arg_vector << @@ns_to_ds_attribute_map[symbolize(param)]
|
311
|
+
# JJM: The following line sends the actual value to set the property to
|
312
|
+
exec_arg_vector << value.to_s
|
313
|
+
begin
|
314
|
+
execute(exec_arg_vector)
|
315
|
+
rescue Puppet::ExecutionFailure => detail
|
316
|
+
raise Puppet::Error, "Could not set %s on %s[%s]: %s" % [param, @resource.class.name, @resource.name, detail]
|
317
|
+
end
|
273
318
|
end
|
274
319
|
end
|
275
320
|
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
321
|
+
# NBK: we override @parent.create as we need to execute a series of commands
|
322
|
+
# to create objects with dscl, rather than the single command nameservice.rb
|
323
|
+
# expects to be returned by addcmd. Thus we don't bother defining addcmd.
|
324
|
+
def create
|
325
|
+
if exists?
|
326
|
+
info "already exists"
|
327
|
+
# The object already exists
|
328
|
+
return nil
|
329
|
+
end
|
330
|
+
|
331
|
+
# NBK: First we create the object with a known guid so we can set the contents
|
332
|
+
# of the password hash if required
|
333
|
+
# Shelling out sucks, but for a single use case it doesn't seem worth
|
334
|
+
# requiring people install a UUID library that doesn't come with the system.
|
335
|
+
# This should be revisited if Puppet starts managing UUIDs for other platform
|
336
|
+
# user records.
|
337
|
+
guid = %x{/usr/bin/uuidgen}.chomp
|
338
|
+
|
281
339
|
exec_arg_vector = self.class.get_exec_preamble("-create", @resource[:name])
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
340
|
+
exec_arg_vector << @@ns_to_ds_attribute_map[:guid] << guid
|
341
|
+
begin
|
342
|
+
execute(exec_arg_vector)
|
343
|
+
rescue Puppet::ExecutionFailure => detail
|
344
|
+
raise Puppet::Error, "Could not set GeneratedUID for %s %s: %s" %
|
345
|
+
[@resource.class.name, @resource.name, detail]
|
346
|
+
end
|
347
|
+
|
348
|
+
if value = @resource.should(:password) and value != ""
|
349
|
+
self.class.set_password(@resource[:name], guid, value)
|
350
|
+
end
|
351
|
+
|
352
|
+
# Now we create all the standard properties
|
353
|
+
Puppet::Type.type(@resource.class.name).validproperties.each do |property|
|
354
|
+
next if property == :ensure
|
355
|
+
if value = @resource.should(property) and value != ""
|
356
|
+
if property == :members
|
357
|
+
add_members(nil, value)
|
358
|
+
else
|
359
|
+
exec_arg_vector = self.class.get_exec_preamble("-create", @resource[:name])
|
360
|
+
exec_arg_vector << @@ns_to_ds_attribute_map[symbolize(property)]
|
361
|
+
next if property == :password # skip setting the password here
|
362
|
+
exec_arg_vector << value.to_s
|
363
|
+
begin
|
364
|
+
execute(exec_arg_vector)
|
365
|
+
rescue Puppet::ExecutionFailure => detail
|
366
|
+
raise Puppet::Error, "Could not create %s %s: %s" %
|
367
|
+
[@resource.class.name, @resource.name, detail]
|
368
|
+
end
|
369
|
+
end
|
370
|
+
end
|
371
|
+
end
|
288
372
|
end
|
289
373
|
|
290
|
-
def
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
374
|
+
def remove_unwanted_members(current_members, new_members)
|
375
|
+
current_members.each do |member|
|
376
|
+
if not value.include?(member)
|
377
|
+
cmd = [:dseditgroup, "-o", "edit", "-n", ".", "-d", member, @resource[:name]]
|
378
|
+
begin
|
379
|
+
execute(cmd)
|
380
|
+
rescue Puppet::ExecutionFailure => detail
|
381
|
+
raise Puppet::Error, "Could not set %s on %s[%s]: %s" % [param, @resource.class.name, @resource.name, detail]
|
382
|
+
end
|
383
|
+
end
|
384
|
+
end
|
385
|
+
end
|
386
|
+
|
387
|
+
def add_members(current_members, new_members)
|
388
|
+
new_members.each do |user|
|
389
|
+
if current_members.nil? or not current_members.include?(user)
|
390
|
+
cmd = [:dseditgroup, "-o", "edit", "-n", ".", "-a", user, @resource[:name]]
|
391
|
+
begin
|
392
|
+
execute(cmd)
|
393
|
+
rescue Puppet::ExecutionFailure => detail
|
394
|
+
raise Puppet::Error, "Could not set %s on %s[%s]: %s" % [param, @resource.class.name, @resource.name, detail]
|
395
|
+
end
|
396
|
+
end
|
397
|
+
end
|
299
398
|
end
|
300
399
|
|
301
400
|
def deletecmd
|
@@ -341,9 +440,13 @@ class DirectoryService < Puppet::Provider::NameService
|
|
341
440
|
# list, then report on the remaining list. Pretty whacky, ehh?
|
342
441
|
type_properties = [:name] + self.class.resource_type.validproperties
|
343
442
|
type_properties.delete(:ensure) if type_properties.include? :ensure
|
443
|
+
type_properties << :guid # append GeneratedUID so we just get the report here
|
344
444
|
@property_value_cache_hash = self.class.single_report(@resource[:name], *type_properties)
|
445
|
+
[:uid, :gid].each do |param|
|
446
|
+
@property_value_cache_hash[param] = @property_value_cache_hash[param].to_i if @property_value_cache_hash and @property_value_cache_hash.include?(param)
|
447
|
+
end
|
345
448
|
end
|
346
449
|
return @property_value_cache_hash
|
347
450
|
end
|
348
451
|
end
|
349
|
-
end
|
452
|
+
end
|