puppet 0.24.5 → 0.24.6
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 +206 -0
- data/Rakefile +53 -0
- data/bin/filebucket +0 -0
- data/bin/puppet +32 -11
- data/bin/puppetca +1 -0
- data/bin/puppetd +0 -0
- data/bin/puppetdoc +0 -0
- data/bin/puppetmasterd +0 -0
- data/bin/puppetrun +16 -8
- data/bin/ralsh +0 -0
- data/conf/debian/rules +0 -0
- data/conf/gentoo/init.d/puppetmaster +0 -0
- data/conf/osx/PackageInfo.plist +36 -0
- data/conf/osx/createpackage.sh +167 -0
- data/conf/osx/preflight +12 -0
- data/conf/redhat/client.init +1 -1
- data/conf/redhat/puppet.spec +34 -6
- data/conf/redhat/server.init +42 -7
- data/conf/redhat/server.sysconfig +22 -0
- data/conf/solaris/smf/svc-puppetd +0 -0
- data/conf/solaris/smf/svc-puppetmasterd +0 -0
- data/examples/etc/init.d/sleeper +0 -0
- data/examples/mac_dscl.pp +0 -0
- data/examples/mac_dscl_revert.pp +0 -0
- data/examples/mac_netinfo.pp +0 -0
- data/examples/mac_pkgdmg.pp +0 -0
- data/ext/bin/sleeper +0 -0
- data/ext/module_puppet +0 -0
- data/ext/nagios/check_puppet.rb +0 -0
- data/ext/passenger/README +63 -0
- data/ext/passenger/apache2.conf +29 -0
- data/ext/passenger/config.ru +40 -0
- data/ext/puppet-test +0 -0
- data/ext/puppetlast +6 -31
- data/ext/puppetstoredconfigclean.rb +87 -0
- data/install.rb +75 -20
- data/lib/puppet.rb +1 -1
- data/lib/puppet/daemon.rb +0 -0
- data/lib/puppet/defaults.rb +3 -7
- data/lib/puppet/external/base64.rb +0 -0
- data/lib/puppet/external/nagios.rb +0 -0
- data/lib/puppet/external/nagios/base.rb +0 -0
- data/lib/puppet/file_serving/fileset.rb +2 -2
- data/lib/puppet/file_serving/metadata.rb +3 -3
- data/lib/puppet/indirector/facts/facter.rb +3 -2
- data/lib/puppet/indirector/yaml.rb +10 -1
- data/lib/puppet/module.rb +36 -12
- data/lib/puppet/network/authstore.rb +0 -0
- data/lib/puppet/network/client/master.rb +12 -11
- data/lib/puppet/network/handler/filebucket.rb +0 -0
- data/lib/puppet/network/handler/fileserver.rb +38 -46
- data/lib/puppet/network/handler/master.rb +1 -1
- data/lib/puppet/network/handler/report.rb +0 -0
- data/lib/puppet/network/handler/resource.rb +0 -0
- data/lib/puppet/network/handler/runner.rb +0 -0
- data/lib/puppet/network/http_server/rack.rb +148 -0
- data/lib/puppet/network/rights.rb +0 -0
- data/lib/puppet/network/xmlrpc/client.rb +5 -5
- data/lib/puppet/node.rb +5 -9
- data/lib/puppet/node/environment.rb +1 -17
- data/lib/puppet/node/facts.rb +0 -0
- data/lib/puppet/parameter.rb +1 -28
- data/lib/puppet/parser/ast.rb +6 -0
- data/lib/puppet/parser/ast/arithmetic_operator.rb +41 -0
- data/lib/puppet/parser/ast/boolean_operator.rb +48 -0
- data/lib/puppet/parser/ast/collexpr.rb +6 -1
- data/lib/puppet/parser/ast/comparison_operator.rb +37 -0
- data/lib/puppet/parser/ast/minus.rb +23 -0
- data/lib/puppet/parser/ast/nop.rb +11 -0
- data/lib/puppet/parser/ast/not.rb +19 -0
- data/lib/puppet/parser/ast/resource_override.rb +23 -16
- data/lib/puppet/parser/ast/resource_reference.rb +10 -6
- data/lib/puppet/parser/ast/vardef.rb +2 -2
- data/lib/puppet/parser/collector.rb +2 -1
- data/lib/puppet/parser/functions.rb +7 -217
- data/lib/puppet/parser/functions/defined.rb +27 -0
- data/lib/puppet/parser/functions/fail.rb +4 -0
- data/lib/puppet/parser/functions/file.rb +21 -0
- data/lib/puppet/parser/functions/fqdn_rand.rb +15 -0
- data/lib/puppet/parser/functions/generate.rb +35 -0
- data/lib/puppet/parser/functions/include.rb +26 -0
- data/lib/puppet/parser/functions/realize.rb +14 -0
- data/lib/puppet/parser/functions/search.rb +7 -0
- data/lib/puppet/parser/functions/sha1.rb +6 -0
- data/lib/puppet/parser/functions/tag.rb +6 -0
- data/lib/puppet/parser/functions/tagged.rb +18 -0
- data/lib/puppet/parser/functions/template.rb +22 -0
- data/lib/puppet/parser/lexer.rb +15 -5
- data/lib/puppet/parser/parser.rb +1073 -715
- data/lib/puppet/parser/parser_support.rb +18 -13
- data/lib/puppet/parser/resource.rb +1 -1
- data/lib/puppet/parser/resource/param.rb +10 -2
- data/lib/puppet/parser/scope.rb +63 -5
- data/lib/puppet/parser/templatewrapper.rb +61 -15
- data/lib/puppet/property.rb +7 -1
- data/lib/puppet/property/keyvalue.rb +96 -0
- data/lib/puppet/property/list.rb +78 -0
- data/lib/puppet/provider/confine.rb +1 -1
- data/lib/puppet/provider/confine/variable.rb +10 -1
- data/lib/puppet/provider/cron/crontab.rb +0 -0
- data/lib/puppet/provider/mailalias/aliases.rb +0 -0
- data/lib/puppet/provider/maillist/mailman.rb +0 -0
- data/lib/puppet/provider/mount/parsed.rb +0 -0
- data/lib/puppet/provider/nameservice.rb +24 -39
- data/lib/puppet/provider/nameservice/directoryservice.rb +12 -3
- data/lib/puppet/provider/nameservice/netinfo.rb +12 -2
- data/lib/puppet/provider/nameservice/objectadd.rb +1 -10
- data/lib/puppet/provider/package/appdmg.rb +1 -1
- data/lib/puppet/provider/package/apple.rb +0 -0
- data/lib/puppet/provider/package/apt.rb +14 -21
- data/lib/puppet/provider/package/aptitude.rb +0 -0
- data/lib/puppet/provider/package/blastwave.rb +2 -0
- data/lib/puppet/provider/package/darwinport.rb +0 -0
- data/lib/puppet/provider/package/dpkg.rb +33 -51
- data/lib/puppet/provider/package/fink.rb +1 -1
- data/lib/puppet/provider/package/freebsd.rb +0 -0
- data/lib/puppet/provider/package/gem.rb +0 -0
- data/lib/puppet/provider/package/hpux.rb +46 -0
- data/lib/puppet/provider/package/openbsd.rb +0 -0
- data/lib/puppet/provider/package/pkgdmg.rb +1 -1
- data/lib/puppet/provider/package/portage.rb +3 -1
- data/lib/puppet/provider/package/ports.rb +3 -3
- data/lib/puppet/provider/package/rpm.rb +8 -1
- data/lib/puppet/provider/package/rug.rb +2 -2
- data/lib/puppet/provider/package/sun.rb +2 -0
- data/lib/puppet/provider/package/sunfreeware.rb +3 -0
- data/lib/puppet/provider/package/yum.rb +24 -17
- data/lib/puppet/provider/package/yumhelper.py +92 -11
- data/lib/puppet/provider/parsedfile.rb +0 -0
- data/lib/puppet/provider/port/parsed.rb +0 -0
- data/lib/puppet/provider/selboolean/getsetsebool.rb +47 -0
- data/lib/puppet/provider/selmodule/semodule.rb +143 -0
- data/lib/puppet/provider/service/base.rb +0 -0
- data/lib/puppet/provider/service/daemontools.rb +154 -0
- data/lib/puppet/provider/service/debian.rb +1 -1
- data/lib/puppet/provider/service/freebsd.rb +2 -0
- data/lib/puppet/provider/service/gentoo.rb +2 -0
- data/lib/puppet/provider/service/init.rb +0 -0
- data/lib/puppet/provider/service/redhat.rb +1 -1
- data/lib/puppet/provider/service/runit.rb +93 -0
- data/lib/puppet/provider/service/smf.rb +2 -0
- data/lib/puppet/provider/ssh_authorized_key/parsed.rb +7 -1
- data/lib/puppet/provider/sshkey/parsed.rb +0 -0
- data/lib/puppet/provider/user/hpux.rb +30 -0
- data/lib/puppet/provider/user/user_role_add.rb +156 -0
- data/lib/puppet/provider/user/useradd.rb +23 -14
- data/lib/puppet/rails/database/002_remove_duplicated_index_on_all_tables.rb +17 -0
- data/lib/puppet/rails/database/schema.rb +0 -8
- data/lib/puppet/rails/resource.rb +6 -6
- data/lib/puppet/reference/configuration.rb +0 -7
- data/lib/puppet/reports.rb +0 -0
- data/lib/puppet/reports/rrdgraph.rb +3 -2
- data/lib/puppet/sslcertificates.rb +0 -0
- data/lib/puppet/sslcertificates/inventory.rb +3 -2
- data/lib/puppet/sslcertificates/support.rb +3 -0
- data/lib/puppet/transaction/report.rb +1 -7
- data/lib/puppet/transportable.rb +10 -7
- data/lib/puppet/type.rb +2110 -14
- data/lib/puppet/type/cron.rb +0 -0
- data/lib/puppet/type/exec.rb +0 -0
- data/lib/puppet/type/file.rb +12 -2
- data/lib/puppet/type/file/checksum.rb +4 -0
- data/lib/puppet/type/file/content.rb +0 -0
- data/lib/puppet/type/file/ensure.rb +0 -0
- data/lib/puppet/type/file/group.rb +30 -43
- data/lib/puppet/type/file/mode.rb +0 -0
- data/lib/puppet/type/file/owner.rb +0 -0
- data/lib/puppet/type/file/selcontext.rb +104 -0
- data/lib/puppet/type/file/source.rb +0 -0
- data/lib/puppet/type/file/type.rb +0 -0
- data/lib/puppet/type/filebucket.rb +0 -0
- data/lib/puppet/type/group.rb +0 -8
- data/lib/puppet/type/host.rb +0 -0
- data/lib/puppet/type/mailalias.rb +0 -0
- data/lib/puppet/type/maillist.rb +0 -0
- data/lib/puppet/type/mount.rb +0 -0
- data/lib/puppet/type/package.rb +2 -2
- data/lib/puppet/type/port.rb +0 -0
- data/lib/puppet/type/schedule.rb +0 -0
- data/lib/puppet/type/selboolean.rb +31 -0
- data/lib/puppet/type/selmodule.rb +54 -0
- data/lib/puppet/type/ssh_authorized_key.rb +3 -3
- data/lib/puppet/type/sshkey.rb +0 -0
- data/lib/puppet/type/tidy.rb +0 -0
- data/lib/puppet/type/user.rb +153 -137
- data/lib/puppet/type/yumrepo.rb +18 -2
- data/lib/puppet/type/zone.rb +5 -1
- data/lib/puppet/util.rb +7 -7
- data/lib/puppet/util/filetype.rb +7 -0
- data/lib/puppet/util/instance_loader.rb +0 -0
- data/lib/puppet/util/ldap/connection.rb +11 -1
- data/lib/puppet/util/ldap/manager.rb +1 -1
- data/lib/puppet/util/loadedfile.rb +0 -0
- data/lib/puppet/util/log.rb +42 -43
- data/lib/puppet/util/metric.rb +23 -9
- data/lib/puppet/util/posix.rb +69 -18
- data/lib/puppet/util/selinux.rb +139 -0
- data/lib/puppet/util/settings.rb +5 -7
- data/lib/puppet/util/user_attr.rb +21 -0
- data/test/certmgr/ca.rb +0 -0
- data/test/certmgr/certmgr.rb +0 -0
- data/test/certmgr/inventory.rb +0 -0
- data/test/certmgr/support.rb +0 -0
- data/test/data/providers/ssh_authorized_key/parsed/authorized_keys1 +3 -0
- data/test/data/snippets/append.pp +11 -0
- data/test/data/snippets/arithmetic_expression.pp +8 -0
- data/test/data/snippets/arraytrailingcomma.pp +3 -0
- data/test/data/snippets/emptyifelse.pp +9 -0
- data/test/data/snippets/funccomma.pp +5 -0
- data/test/data/snippets/ifexpression.rb +6 -0
- data/test/data/snippets/subclass_name_duplication.pp +0 -0
- data/test/executables/filebucket.rb +0 -0
- data/test/executables/puppetbin.rb +0 -0
- data/test/executables/puppetca.rb +0 -0
- data/test/executables/puppetd.rb +0 -0
- data/test/executables/puppetmasterd.rb +0 -0
- data/test/executables/puppetmodule.rb +0 -0
- data/test/language/ast.rb +0 -0
- data/test/language/ast/casestatement.rb +0 -0
- data/test/language/ast/resource.rb +0 -0
- data/test/language/ast/resource_reference.rb +0 -28
- data/test/language/ast/selector.rb +0 -0
- data/test/language/ast/variable.rb +0 -0
- data/test/language/functions.rb +91 -12
- data/test/language/parser.rb +21 -0
- data/test/language/resource.rb +0 -0
- data/test/language/scope.rb +28 -0
- data/test/language/snippets.rb +14 -0
- data/test/language/transportable.rb +0 -0
- data/test/lib/puppettest.rb +0 -0
- data/test/lib/puppettest/reporttesting.rb +0 -2
- data/test/lib/puppettest/runnable_test.rb +2 -0
- data/test/lib/puppettest/support/resources.rb +0 -0
- data/test/network/authconfig.rb +0 -0
- data/test/network/authorization.rb +0 -0
- data/test/network/authstore.rb +0 -0
- data/test/network/client/ca.rb +0 -0
- data/test/network/client/client.rb +0 -0
- data/test/network/client/dipper.rb +0 -0
- data/test/network/client/master.rb +2 -6
- data/test/network/client/resource.rb +0 -0
- data/test/network/client_request.rb +0 -0
- data/test/network/daemon.rb +0 -0
- data/test/network/handler/bucket.rb +0 -0
- data/test/network/handler/ca.rb +0 -0
- data/test/network/handler/fileserver.rb +8 -0
- data/test/network/handler/handler.rb +0 -0
- data/test/network/handler/master.rb +3 -1
- data/test/network/handler/report.rb +0 -0
- data/test/network/handler/resource.rb +0 -0
- data/test/network/handler/runner.rb +0 -0
- data/test/network/rights.rb +0 -0
- data/test/network/server/mongrel_test.rb +0 -0
- data/test/network/server/webrick.rb +0 -0
- data/test/network/xmlrpc/client.rb +0 -0
- data/test/network/xmlrpc/processor.rb +0 -0
- data/test/network/xmlrpc/server.rb +0 -0
- data/test/network/xmlrpc/webrick_servlet.rb +0 -0
- data/test/other/dsl.rb +0 -0
- data/test/other/events.rb +0 -0
- data/test/other/overrides.rb +0 -0
- data/test/other/provider.rb +0 -0
- data/test/other/puppet.rb +0 -0
- data/test/other/relationships.rb +0 -0
- data/test/other/report.rb +2 -4
- data/test/other/transactions.rb +1 -1
- data/test/puppet/conffiles.rb +0 -0
- data/test/puppet/defaults.rb +0 -0
- data/test/puppet/errortest.rb +0 -0
- data/test/puppet/tc_suidmanager.rb +0 -0
- data/test/rails/ast.rb +0 -0
- data/test/rails/configuration.rb +0 -0
- data/test/rails/host.rb +0 -0
- data/test/rails/rails.rb +0 -0
- data/test/rails/railsparameter.rb +0 -0
- data/test/rails/railsresource.rb +0 -0
- data/test/ral/manager/attributes.rb +0 -0
- data/test/ral/manager/instances.rb +0 -0
- data/test/ral/manager/manager.rb +0 -0
- data/test/ral/manager/provider.rb +0 -0
- data/test/ral/manager/type.rb +0 -0
- data/test/ral/providers/cron/crontab.rb +0 -0
- data/test/ral/providers/group.rb +14 -13
- data/test/ral/providers/host/netinfo.rb +0 -0
- data/test/ral/providers/host/parsed.rb +0 -0
- data/test/ral/providers/mailalias/aliases.rb +0 -0
- data/test/ral/providers/mount/netinfo.rb +0 -0
- data/test/ral/providers/nameservice.rb +0 -0
- data/test/ral/providers/package.rb +0 -31
- data/test/ral/providers/package/aptitude.rb +1 -2
- data/test/ral/providers/package/aptrpm.rb +2 -2
- data/test/ral/providers/parsedfile.rb +0 -0
- data/test/ral/providers/port/parsed.rb +0 -0
- data/test/ral/providers/provider.rb +0 -0
- data/test/ral/providers/service/base.rb +0 -0
- data/test/ral/providers/service/debian.rb +0 -0
- data/test/ral/providers/sshkey/parsed.rb +0 -0
- data/test/ral/providers/user.rb +8 -8
- data/test/ral/providers/user/useradd.rb +0 -0
- data/test/ral/type/basic.rb +0 -0
- data/test/ral/type/cron.rb +0 -0
- data/test/ral/type/exec.rb +0 -0
- data/test/ral/type/file.rb +0 -0
- data/test/ral/type/file/target.rb +0 -0
- data/test/ral/type/filebucket.rb +0 -0
- data/test/ral/type/fileignoresource.rb +0 -0
- data/test/ral/type/filesources.rb +1 -3
- data/test/ral/type/group.rb +0 -0
- data/test/ral/type/host.rb +0 -0
- data/test/ral/type/mailalias.rb +1 -2
- data/test/ral/type/parameter.rb +0 -0
- data/test/ral/type/port.rb +0 -0
- data/test/ral/type/property.rb +0 -0
- data/test/ral/type/resources.rb +0 -0
- data/test/ral/type/service.rb +0 -0
- data/test/ral/type/sshkey.rb +0 -0
- data/test/ral/type/tidy.rb +0 -0
- data/test/ral/type/user.rb +0 -50
- data/test/ral/type/yumrepo.rb +7 -1
- data/test/ral/type/zone.rb +0 -0
- data/test/test +0 -0
- data/test/util/autoload.rb +0 -0
- data/test/util/classgen.rb +0 -0
- data/test/util/execution.rb +0 -0
- data/test/util/features.rb +0 -0
- data/test/util/fileparsing.rb +0 -0
- data/test/util/filetype.rb +0 -0
- data/test/util/inifile.rb +0 -0
- data/test/util/instance_loader.rb +0 -0
- data/test/util/log.rb +0 -59
- data/test/util/metrics.rb +0 -0
- data/test/util/package.rb +0 -0
- data/test/util/pidlock.rb +0 -0
- data/test/util/settings.rb +0 -0
- data/test/util/storage.rb +0 -0
- data/test/util/subclass_loader.rb +0 -0
- data/test/util/utiltest.rb +0 -0
- metadata +54 -19
- data/lib/puppet/metatype/attributes.rb +0 -685
- data/lib/puppet/metatype/closure.rb +0 -49
- data/lib/puppet/metatype/container.rb +0 -50
- data/lib/puppet/metatype/evaluation.rb +0 -163
- data/lib/puppet/metatype/instances.rb +0 -305
- data/lib/puppet/metatype/metaparams.rb +0 -423
- data/lib/puppet/metatype/providers.rb +0 -247
- data/lib/puppet/metatype/relationships.rb +0 -115
- data/lib/puppet/metatype/schedules.rb +0 -33
- data/lib/puppet/metatype/tags.rb +0 -38
- data/lib/puppet/util/plist.rb +0 -23
- data/lib/puppet/util/plist/generator.rb +0 -225
- data/lib/puppet/util/plist/parser.rb +0 -226
- data/test/ral/providers/package/apt.rb +0 -169
- data/test/ral/providers/package/dpkg.rb +0 -64
- data/test/util/posixtest.rb +0 -169
data/lib/puppet/type/cron.rb
CHANGED
File without changes
|
data/lib/puppet/type/exec.rb
CHANGED
File without changes
|
data/lib/puppet/type/file.rb
CHANGED
@@ -368,7 +368,7 @@ module Puppet
|
|
368
368
|
Find.find(self[:path]) do |f|
|
369
369
|
if File.file?(f)
|
370
370
|
sum = backup.backup(f)
|
371
|
-
self.
|
371
|
+
self.notice "Filebucketed %s to %s with sum %s" %
|
372
372
|
[f, backup.name, sum]
|
373
373
|
end
|
374
374
|
end
|
@@ -403,7 +403,7 @@ module Puppet
|
|
403
403
|
case backup
|
404
404
|
when Puppet::Network::Client.client(:Dipper):
|
405
405
|
sum = backup.backup(file)
|
406
|
-
self.
|
406
|
+
self.notice "Filebucketed to %s with sum %s" %
|
407
407
|
[backup.name, sum]
|
408
408
|
return true
|
409
409
|
when String:
|
@@ -849,6 +849,8 @@ module Puppet
|
|
849
849
|
# Keep track of all the files we found in the source, so we can purge
|
850
850
|
# appropriately.
|
851
851
|
sourced = []
|
852
|
+
|
853
|
+
success = false
|
852
854
|
|
853
855
|
@parameters[:source].should.each do |source|
|
854
856
|
sourceobj, path = uri2obj(source)
|
@@ -863,6 +865,8 @@ module Puppet
|
|
863
865
|
if desc == ""
|
864
866
|
next
|
865
867
|
end
|
868
|
+
|
869
|
+
success = true
|
866
870
|
|
867
871
|
# Now create a new child for every file returned in the list.
|
868
872
|
result += desc.split("\n").collect { |line|
|
@@ -898,6 +902,11 @@ module Puppet
|
|
898
902
|
return [result, sourced]
|
899
903
|
end
|
900
904
|
end
|
905
|
+
|
906
|
+
unless success
|
907
|
+
raise Puppet::Error, "None of the provided sources exist"
|
908
|
+
end
|
909
|
+
|
901
910
|
return [result, sourced]
|
902
911
|
end
|
903
912
|
|
@@ -1148,4 +1157,5 @@ module Puppet
|
|
1148
1157
|
require 'puppet/type/file/group'
|
1149
1158
|
require 'puppet/type/file/mode'
|
1150
1159
|
require 'puppet/type/file/type'
|
1160
|
+
require 'puppet/type/file/selcontext' # SELinux file context
|
1151
1161
|
end
|
@@ -53,6 +53,9 @@ Puppet::Type.type(:file).newproperty(:checksum) do
|
|
53
53
|
else
|
54
54
|
if FileTest.directory?(@resource[:path])
|
55
55
|
return :time
|
56
|
+
elsif @resource[:source] and value.to_s != "md5"
|
57
|
+
self.warning("Files with source set must use md5 as checksum. Forcing to md5 from %s for %s" % [ value, @resource[:path] ])
|
58
|
+
return :md5
|
56
59
|
else
|
57
60
|
return symbolize(value)
|
58
61
|
end
|
@@ -161,6 +164,7 @@ Puppet::Type.type(:file).newproperty(:checksum) do
|
|
161
164
|
|
162
165
|
checktype = :mtime if checktype == :timestamp
|
163
166
|
checktype = :ctime if checktype == :time
|
167
|
+
self.should = checktype = :md5 if @resource.property(:source)
|
164
168
|
|
165
169
|
file ||= @resource[:path]
|
166
170
|
|
File without changes
|
File without changes
|
@@ -1,6 +1,10 @@
|
|
1
|
+
require 'puppet/util/posix'
|
2
|
+
|
1
3
|
# Manage file group ownership.
|
2
4
|
module Puppet
|
3
5
|
Puppet.type(:file).newproperty(:group) do
|
6
|
+
include Puppet::Util::POSIX
|
7
|
+
|
4
8
|
require 'etc'
|
5
9
|
desc "Which group should own the file. Argument can be either group
|
6
10
|
name or group ID."
|
@@ -42,32 +46,23 @@ module Puppet
|
|
42
46
|
end
|
43
47
|
end
|
44
48
|
|
45
|
-
def
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
end
|
54
|
-
else
|
55
|
-
val
|
56
|
-
end
|
49
|
+
def insync?(current)
|
50
|
+
@should.each do |value|
|
51
|
+
if value =~ /^\d+$/
|
52
|
+
gid = Integer(value)
|
53
|
+
elsif value.is_a?(String)
|
54
|
+
fail "Could not find group %s" % value unless gid = gid(value)
|
55
|
+
else
|
56
|
+
gid = value
|
57
57
|
end
|
58
|
-
end
|
59
|
-
stat = @resource.stat(false)
|
60
58
|
|
61
|
-
|
62
|
-
return :absent
|
59
|
+
return true if gid == current
|
63
60
|
end
|
61
|
+
return false
|
62
|
+
end
|
64
63
|
|
65
|
-
|
66
|
-
|
67
|
-
@method = :lchown
|
68
|
-
else
|
69
|
-
@method = :chown
|
70
|
-
end
|
64
|
+
def retrieve
|
65
|
+
return :absent unless stat = resource.stat(false)
|
71
66
|
|
72
67
|
currentvalue = stat.gid
|
73
68
|
|
@@ -84,12 +79,8 @@ module Puppet
|
|
84
79
|
|
85
80
|
# Determine if the group is valid, and if so, return the GID
|
86
81
|
def validgroup?(value)
|
87
|
-
if
|
88
|
-
|
89
|
-
end
|
90
|
-
|
91
|
-
if gid = Puppet::Util.gid(value)
|
92
|
-
return gid
|
82
|
+
if number = gid(value)
|
83
|
+
return number
|
93
84
|
else
|
94
85
|
return false
|
95
86
|
end
|
@@ -99,32 +90,28 @@ module Puppet
|
|
99
90
|
# we'll just let it fail, but we should probably set things up so
|
100
91
|
# that users get warned if they try to change to an unacceptable group.
|
101
92
|
def sync
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
self.debug "File '%s' does not exist; cannot chgrp" %
|
108
|
-
@resource[:path]
|
109
|
-
return nil
|
110
|
-
end
|
93
|
+
# Set our method appropriately, depending on links.
|
94
|
+
if resource[:links] == :manage
|
95
|
+
method = :lchown
|
96
|
+
else
|
97
|
+
method = :chown
|
111
98
|
end
|
112
99
|
|
113
100
|
gid = nil
|
114
|
-
|
115
|
-
|
101
|
+
@should.each do |group|
|
102
|
+
break if gid = validgroup?(group)
|
116
103
|
end
|
117
104
|
|
105
|
+
raise Puppet::Error, "Could not find group(s) %s" % @should.join(",") unless gid
|
106
|
+
|
118
107
|
begin
|
119
108
|
# set owner to nil so it's ignored
|
120
|
-
File.send(
|
109
|
+
File.send(method, nil, gid, resource[:path])
|
121
110
|
rescue => detail
|
122
|
-
error = Puppet::Error.new( "failed to chgrp %s to %s: %s" %
|
123
|
-
[@resource[:path], self.should, detail.message])
|
111
|
+
error = Puppet::Error.new( "failed to chgrp %s to %s: %s" % [resource[:path], gid, detail.message])
|
124
112
|
raise error
|
125
113
|
end
|
126
114
|
return :file_changed
|
127
115
|
end
|
128
116
|
end
|
129
117
|
end
|
130
|
-
|
File without changes
|
File without changes
|
@@ -0,0 +1,104 @@
|
|
1
|
+
# Manage SELinux context of files.
|
2
|
+
#
|
3
|
+
# This code actually manages three pieces of data in the context.
|
4
|
+
#
|
5
|
+
# [root@delenn files]# ls -dZ /
|
6
|
+
# drwxr-xr-x root root system_u:object_r:root_t /
|
7
|
+
#
|
8
|
+
# The context of '/' here is 'system_u:object_r:root_t'. This is
|
9
|
+
# three seperate fields:
|
10
|
+
#
|
11
|
+
# system_u is the user context
|
12
|
+
# object_r is the role context
|
13
|
+
# root_t is the type context
|
14
|
+
#
|
15
|
+
# All three of these fields are returned in a single string by the
|
16
|
+
# output of the stat command, but set individually with the chcon
|
17
|
+
# command. This allows the user to specify a subset of the three
|
18
|
+
# values while leaving the others alone.
|
19
|
+
#
|
20
|
+
# See http://www.nsa.gov/selinux/ for complete docs on SELinux.
|
21
|
+
|
22
|
+
module Puppet
|
23
|
+
require 'puppet/util/selinux'
|
24
|
+
|
25
|
+
class SELFileContext < Puppet::Property
|
26
|
+
include Puppet::Util::SELinux
|
27
|
+
|
28
|
+
def retrieve
|
29
|
+
unless @resource.stat(false)
|
30
|
+
return :absent
|
31
|
+
end
|
32
|
+
context = self.get_selinux_current_context(@resource[:path])
|
33
|
+
return parse_selinux_context(name, context)
|
34
|
+
end
|
35
|
+
|
36
|
+
def retrieve_default_context(property)
|
37
|
+
unless context = self.get_selinux_default_context(@resource[:path])
|
38
|
+
return nil
|
39
|
+
end
|
40
|
+
property_default = self.parse_selinux_context(property, context)
|
41
|
+
self.debug "Found #{property} default '#{property_default}' for #{@resource[:path]}"
|
42
|
+
return property_default
|
43
|
+
end
|
44
|
+
|
45
|
+
def sync
|
46
|
+
unless @resource.stat(false)
|
47
|
+
stat = @resource.stat(true)
|
48
|
+
unless stat
|
49
|
+
return nil
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
self.set_selinux_context(@resource[:path], @should, name)
|
54
|
+
return :file_changed
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
Puppet.type(:file).newproperty(:seluser, :parent => Puppet::SELFileContext) do
|
59
|
+
desc "What the SELinux user component of the context of the file should be.
|
60
|
+
Any valid SELinux user component is accepted. For example ``user_u``.
|
61
|
+
If not specified it defaults to the value returned by matchpathcon for
|
62
|
+
the file, if any exists. Only valid on systems with SELinux support
|
63
|
+
enabled."
|
64
|
+
|
65
|
+
@event = :file_changed
|
66
|
+
defaultto { self.retrieve_default_context(:seluser) }
|
67
|
+
end
|
68
|
+
|
69
|
+
Puppet.type(:file).newproperty(:selrole, :parent => Puppet::SELFileContext) do
|
70
|
+
desc "What the SELinux role component of the context of the file should be.
|
71
|
+
Any valid SELinux role component is accepted. For example ``role_r``.
|
72
|
+
If not specified it defaults to the value returned by matchpathcon for
|
73
|
+
the file, if any exists. Only valid on systems with SELinux support
|
74
|
+
enabled."
|
75
|
+
|
76
|
+
@event = :file_changed
|
77
|
+
defaultto { self.retrieve_default_context(:selrole) }
|
78
|
+
end
|
79
|
+
|
80
|
+
Puppet.type(:file).newproperty(:seltype, :parent => Puppet::SELFileContext) do
|
81
|
+
desc "What the SELinux type component of the context of the file should be.
|
82
|
+
Any valid SELinux type component is accepted. For example ``tmp_t``.
|
83
|
+
If not specified it defaults to the value returned by matchpathcon for
|
84
|
+
the file, if any exists. Only valid on systems with SELinux support
|
85
|
+
enabled."
|
86
|
+
|
87
|
+
@event = :file_changed
|
88
|
+
defaultto { self.retrieve_default_context(:seltype) }
|
89
|
+
end
|
90
|
+
|
91
|
+
Puppet.type(:file).newproperty(:selrange, :parent => Puppet::SELFileContext) do
|
92
|
+
desc "What the SELinux range component of the context of the file should be.
|
93
|
+
Any valid SELinux range component is accepted. For example ``s0`` or
|
94
|
+
``SystemHigh``. If not specified it defaults to the value returned by
|
95
|
+
matchpathcon for the file, if any exists. Only valid on systems with
|
96
|
+
SELinux support enabled and that have support for MCS (Multi-Category
|
97
|
+
Security)."
|
98
|
+
|
99
|
+
@event = :file_changed
|
100
|
+
defaultto { self.retrieve_default_context(:selrange) }
|
101
|
+
end
|
102
|
+
|
103
|
+
end
|
104
|
+
|
File without changes
|
File without changes
|
File without changes
|
data/lib/puppet/type/group.rb
CHANGED
data/lib/puppet/type/host.rb
CHANGED
File without changes
|
File without changes
|
data/lib/puppet/type/maillist.rb
CHANGED
File without changes
|
data/lib/puppet/type/mount.rb
CHANGED
File without changes
|
data/lib/puppet/type/package.rb
CHANGED
@@ -138,8 +138,8 @@ module Puppet
|
|
138
138
|
# that can't query versions.
|
139
139
|
return true
|
140
140
|
else
|
141
|
-
self.debug "
|
142
|
-
[
|
141
|
+
self.debug "%s %s is installed, latest is %s" %
|
142
|
+
[@resource.name, is.inspect, @latest.inspect]
|
143
143
|
end
|
144
144
|
when :absent
|
145
145
|
return true if is == :absent or is == :purged
|
data/lib/puppet/type/port.rb
CHANGED
File without changes
|
data/lib/puppet/type/schedule.rb
CHANGED
File without changes
|
@@ -0,0 +1,31 @@
|
|
1
|
+
#
|
2
|
+
# Simple module for manageing SELinux booleans
|
3
|
+
#
|
4
|
+
|
5
|
+
module Puppet
|
6
|
+
newtype(:selboolean) do
|
7
|
+
@doc = "Manages SELinux booleans on systems with SELinux support. The supported booleans
|
8
|
+
are any of the ones found in /selinux/booleans/."
|
9
|
+
|
10
|
+
newparam(:name) do
|
11
|
+
desc "The name of the SELinux boolean to be managed."
|
12
|
+
isnamevar
|
13
|
+
end
|
14
|
+
|
15
|
+
newproperty(:value) do
|
16
|
+
desc "Whether the the SELinux boolean should be enabled or disabled."
|
17
|
+
newvalue(:on)
|
18
|
+
newvalue(:off)
|
19
|
+
end
|
20
|
+
|
21
|
+
newparam(:persistent) do
|
22
|
+
desc "If set true, SELinux booleans will be written to disk and persist accross reboots.
|
23
|
+
The default is ``false``."
|
24
|
+
|
25
|
+
defaultto :false
|
26
|
+
newvalues(:true, :false)
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
@@ -0,0 +1,54 @@
|
|
1
|
+
#
|
2
|
+
# Simple module for manageing SELinux policy modules
|
3
|
+
#
|
4
|
+
|
5
|
+
Puppet::Type.newtype(:selmodule) do
|
6
|
+
@doc = "Manages loading and unloading of SELinux policy modules
|
7
|
+
on the system. Requires SELinux support. See man semodule(8)
|
8
|
+
for more information on SELinux policy modules."
|
9
|
+
|
10
|
+
ensurable
|
11
|
+
|
12
|
+
newparam(:name) do
|
13
|
+
desc "The name of the SELinux policy to be managed. You should not
|
14
|
+
include the customary trailing .pp extension."
|
15
|
+
isnamevar
|
16
|
+
end
|
17
|
+
|
18
|
+
newparam(:selmoduledir) do
|
19
|
+
|
20
|
+
desc "The directory to look for the compiled pp module file in.
|
21
|
+
Currently defaults to /usr/share/selinux/targeted. If selmodulepath
|
22
|
+
is not specified the module will be looked for in this directory in a
|
23
|
+
in a file called NAME.pp, where NAME is the value of the name parameter."
|
24
|
+
|
25
|
+
defaultto "/usr/share/selinux/targeted"
|
26
|
+
end
|
27
|
+
|
28
|
+
newparam(:selmodulepath) do
|
29
|
+
|
30
|
+
desc "The full path to the compiled .pp policy module. You only need to use
|
31
|
+
this if the module file is not in the directory pointed at by selmoduledir."
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
newproperty(:syncversion) do
|
36
|
+
|
37
|
+
desc "If set to ``true``, the policy will be reloaded if the
|
38
|
+
version found in the on-disk file differs from the loaded
|
39
|
+
version. If set to ``false`` (the default) the the only check
|
40
|
+
that will be made is if the policy is loaded at all or not."
|
41
|
+
|
42
|
+
newvalue(:true)
|
43
|
+
newvalue(:false)
|
44
|
+
end
|
45
|
+
|
46
|
+
autorequire(:file) do
|
47
|
+
if self[:selmodulepath]
|
48
|
+
[self[:selmodulepath]]
|
49
|
+
else
|
50
|
+
["#{self[:selmoduledir]}/#{self[:name]}.pp"]
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module Puppet
|
2
2
|
newtype(:ssh_authorized_key) do
|
3
|
-
@doc = "Manages
|
3
|
+
@doc = "Manages SSH authorized keys. Currently only type 2 keys are
|
4
|
+
supported."
|
4
5
|
|
5
6
|
ensurable
|
6
7
|
|
@@ -11,8 +12,7 @@ module Puppet
|
|
11
12
|
end
|
12
13
|
|
13
14
|
newproperty(:type) do
|
14
|
-
desc "The encryption type used
|
15
|
-
SSH version 2. Not used for SSH version 1."
|
15
|
+
desc "The encryption type used: ssh-dss or ssh-rsa."
|
16
16
|
|
17
17
|
newvalue("ssh-dss")
|
18
18
|
newvalue("ssh-rsa")
|