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
File without changes
|
@@ -70,7 +70,7 @@ Puppet::Type.type(:package).provide :pkgdmg, :parent => Puppet::Provider::Packag
|
|
70
70
|
self.fail "Mac OS X PKG DMG's must specificy a source string ending in .dmg"
|
71
71
|
end
|
72
72
|
require 'open-uri'
|
73
|
-
require '
|
73
|
+
require 'facter/util/plist'
|
74
74
|
cached_source = source
|
75
75
|
if %r{\A[A-Za-z][A-Za-z0-9+\-\.]*://} =~ cached_source
|
76
76
|
cached_source = "/tmp/#{name}"
|
@@ -7,6 +7,8 @@ Puppet::Type.type(:package).provide :portage, :parent => Puppet::Provider::Packa
|
|
7
7
|
|
8
8
|
commands :emerge => "/usr/bin/emerge", :eix => "/usr/bin/eix", :update_eix => "/usr/bin/update-eix"
|
9
9
|
|
10
|
+
confine :operatingsystem => :gentoo
|
11
|
+
|
10
12
|
defaultfor :operatingsystem => :gentoo
|
11
13
|
|
12
14
|
def self.instances
|
@@ -70,7 +72,7 @@ Puppet::Type.type(:package).provide :portage, :parent => Puppet::Provider::Packa
|
|
70
72
|
result_format = /(\S+) (\S+) \[(?:([0-9.a-zA-Z]+(?:_(?:alpha|beta|pre|rc|p)[0-9]*)*(?:-r[0-9]*)?)(?:\([^\)]+\))?(?:\[([^\]]+)\])?[ ]*)*\] \[(?:(?:\{M\})?(?:\([~*]+\))?([0-9.a-zA-Z]+(?:_(?:alpha|beta|pre|rc|p)[0-9]*)*(?:-r[0-9]*)?)(?:\(([^\)]+)\))?(?:![mf])*(?:\[([^\]]+)\])?)?\] ([\S]*) (.*)/
|
71
73
|
result_fields = [:category, :name, :ensure, :ensure_overlay, :version_available, :slot, :overlay, :vendor, :description]
|
72
74
|
|
73
|
-
search_field =
|
75
|
+
search_field = package_name.count('/') > 0 ? "--category-name" : "--name"
|
74
76
|
search_value = package_name
|
75
77
|
search_format = "<category> <name> [<installedversionsshort>] [<best>] <homepage> <description>"
|
76
78
|
|
@@ -33,7 +33,7 @@ Puppet::Type.type(:package).provide :ports, :parent => :freebsd, :source => :fre
|
|
33
33
|
begin
|
34
34
|
output = portversion(*cmd)
|
35
35
|
rescue Puppet::ExecutionFailure
|
36
|
-
raise Puppet::
|
36
|
+
raise Puppet::Error.new(output)
|
37
37
|
end
|
38
38
|
line = output.split("\n").pop
|
39
39
|
|
@@ -47,7 +47,7 @@ Puppet::Type.type(:package).provide :ports, :parent => :freebsd, :source => :fre
|
|
47
47
|
info = $3
|
48
48
|
|
49
49
|
unless pkgstuff =~ /^(\S+)-([^-\s]+)$/
|
50
|
-
raise Puppet::
|
50
|
+
raise Puppet::Error,
|
51
51
|
"Could not match package info '%s'" % pkgstuff
|
52
52
|
end
|
53
53
|
|
@@ -61,7 +61,7 @@ Puppet::Type.type(:package).provide :ports, :parent => :freebsd, :source => :fre
|
|
61
61
|
# Else, we need to be updated; we need to pull out the new version
|
62
62
|
|
63
63
|
unless info =~ /\((\w+) has (.+)\)/
|
64
|
-
raise Puppet::
|
64
|
+
raise Puppet::Error,
|
65
65
|
"Could not match version info '%s'" % info
|
66
66
|
end
|
67
67
|
|
@@ -23,9 +23,16 @@ Puppet::Type.type(:package).provide :rpm, :source => :rpm, :parent => Puppet::Pr
|
|
23
23
|
def self.instances
|
24
24
|
packages = []
|
25
25
|
|
26
|
+
# rpm < 4.1 don't support --nosignature
|
27
|
+
output = rpm "--version"
|
28
|
+
sig = "--nosignature"
|
29
|
+
if output =~ /RPM version (([123].*)|(4\.0.*))/
|
30
|
+
sig = ""
|
31
|
+
end
|
32
|
+
|
26
33
|
# list out all of the packages
|
27
34
|
begin
|
28
|
-
execpipe("#{command(:rpm)} -qa
|
35
|
+
execpipe("#{command(:rpm)} -qa #{sig} --nodigest --qf '#{NEVRAFORMAT}\n'") { |process|
|
29
36
|
# now turn each returned line into a package object
|
30
37
|
process.each { |line|
|
31
38
|
hash = nevra_to_hash(line)
|
@@ -5,8 +5,8 @@ Puppet.type(:package).provide :rug, :parent => :rpm do
|
|
5
5
|
|
6
6
|
commands :rug => "/usr/bin/rug"
|
7
7
|
commands :rpm => "rpm"
|
8
|
-
defaultfor :operatingsystem => :suse
|
9
|
-
confine :operatingsystem => :suse
|
8
|
+
defaultfor :operatingsystem => [:suse, :sles]
|
9
|
+
confine :operatingsystem => [:suse, :sles]
|
10
10
|
|
11
11
|
# Install a package using 'rug'.
|
12
12
|
def install
|
@@ -4,5 +4,8 @@ Puppet::Type.type(:package).provide :sunfreeware, :parent => :blastwave, :source
|
|
4
4
|
At this point, support is exactly the same as ``blastwave`` support and
|
5
5
|
has not actually been tested."
|
6
6
|
commands :pkgget => "pkg-get"
|
7
|
+
|
8
|
+
confine :operatingsystem => :solaris
|
9
|
+
|
7
10
|
end
|
8
11
|
|
@@ -7,9 +7,7 @@ Puppet::Type.type(:package).provide :yum, :parent => :rpm, :source => :rpm do
|
|
7
7
|
|
8
8
|
YUMHELPER = File::join(File::dirname(__FILE__), "yumhelper.py")
|
9
9
|
|
10
|
-
|
11
|
-
attr_reader :updates
|
12
|
-
end
|
10
|
+
attr_accessor :latest_info
|
13
11
|
|
14
12
|
if command('rpm')
|
15
13
|
confine :true => begin
|
@@ -24,22 +22,32 @@ Puppet::Type.type(:package).provide :yum, :parent => :rpm, :source => :rpm do
|
|
24
22
|
defaultfor :operatingsystem => [:fedora, :centos, :redhat]
|
25
23
|
|
26
24
|
def self.prefetch(packages)
|
27
|
-
@updates = {}
|
28
25
|
if Process.euid != 0
|
29
26
|
raise Puppet::Error, "The yum provider can only be used as root"
|
30
27
|
end
|
31
28
|
super
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
29
|
+
return unless packages.detect { |name, package| package.should(:ensure) == :latest }
|
30
|
+
|
31
|
+
# collect our 'latest' info
|
32
|
+
updates = {}
|
33
|
+
python(YUMHELPER).each_line do |l|
|
34
|
+
l.chomp!
|
35
|
+
next if l.empty?
|
36
|
+
if l[0,4] == "_pkg"
|
37
|
+
hash = nevra_to_hash(l[5..-1])
|
38
|
+
[hash[:name], "#{hash[:name]}.#{hash[:arch]}"].each do |n|
|
39
|
+
updates[n] ||= []
|
40
|
+
updates[n] << hash
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
# Add our 'latest' info to the providers.
|
46
|
+
packages.each do |name, package|
|
47
|
+
if info = updates[package[:name]]
|
48
|
+
package.provider.latest_info = info[0]
|
49
|
+
end
|
50
|
+
end
|
43
51
|
end
|
44
52
|
|
45
53
|
def install
|
@@ -73,11 +81,10 @@ Puppet::Type.type(:package).provide :yum, :parent => :rpm, :source => :rpm do
|
|
73
81
|
|
74
82
|
# What's the latest package version available?
|
75
83
|
def latest
|
76
|
-
upd =
|
84
|
+
upd = latest_info
|
77
85
|
unless upd.nil?
|
78
86
|
# FIXME: there could be more than one update for a package
|
79
87
|
# because of multiarch
|
80
|
-
upd = upd[0]
|
81
88
|
return "#{upd[:version]}-#{upd[:release]}"
|
82
89
|
else
|
83
90
|
# Yum didn't find updates, pretend the current
|
@@ -4,8 +4,23 @@
|
|
4
4
|
# (C) 2007 Red Hat Inc.
|
5
5
|
# David Lutterkort <dlutter @redhat.com>
|
6
6
|
|
7
|
-
import yum
|
8
7
|
import sys
|
8
|
+
import string
|
9
|
+
import re
|
10
|
+
|
11
|
+
# this maintains compatibility with really old platforms with python 1.x
|
12
|
+
from os import popen, WEXITSTATUS
|
13
|
+
|
14
|
+
# Try to use the yum libraries by default, but shell out to the yum executable
|
15
|
+
# if they are not present (i.e. yum <= 2.0). This is only required for RHEL3
|
16
|
+
# and earlier that do not support later versions of Yum. Once RHEL3 is EOL,
|
17
|
+
# shell_out() and related code can be removed.
|
18
|
+
try:
|
19
|
+
import yum
|
20
|
+
except ImportError:
|
21
|
+
useyumlib = 0
|
22
|
+
else:
|
23
|
+
useyumlib = 1
|
9
24
|
|
10
25
|
OVERRIDE_OPTS = {
|
11
26
|
'debuglevel': 0,
|
@@ -26,14 +41,80 @@ def pkg_lists(my):
|
|
26
41
|
my.doRpmDBSetup()
|
27
42
|
return my.doPackageLists('updates')
|
28
43
|
|
29
|
-
|
44
|
+
def shell_out():
|
45
|
+
try:
|
46
|
+
p = popen("/usr/bin/env yum check-update 2>&1")
|
47
|
+
output = p.readlines()
|
48
|
+
rc = p.close()
|
49
|
+
|
50
|
+
if rc is not None:
|
51
|
+
# None represents exit code of 0, otherwise the exit code is in the
|
52
|
+
# format returned by wait(). Exit code of 100 from yum represents
|
53
|
+
# updates available.
|
54
|
+
if WEXITSTATUS(rc) != 100:
|
55
|
+
return WEXITSTATUS(rc)
|
56
|
+
else:
|
57
|
+
# Exit code is None (0), no updates waiting so don't both parsing output
|
58
|
+
return 0
|
59
|
+
|
60
|
+
# Yum prints a line of hyphens (old versions) or a blank line between
|
61
|
+
# headers and package data, so skip everything before them
|
62
|
+
skipheaders = 0
|
63
|
+
for line in output:
|
64
|
+
if not skipheaders:
|
65
|
+
if re.compile("^((-){80}|)$").search(line):
|
66
|
+
skipheaders = 1
|
67
|
+
continue
|
68
|
+
|
69
|
+
# Skip any blank lines
|
70
|
+
if re.compile("^[ \t]*$").search(line):
|
71
|
+
continue
|
72
|
+
|
73
|
+
# Format is:
|
74
|
+
# Yum 1.x: name arch (epoch:)?version
|
75
|
+
# Yum 2.0: name arch (epoch:)?version repo
|
76
|
+
# epoch is optional if 0
|
77
|
+
|
78
|
+
p = string.split(line)
|
79
|
+
pname = p[0]
|
80
|
+
parch = p[1]
|
81
|
+
pevr = p[2]
|
82
|
+
|
83
|
+
# Separate out epoch:version-release
|
84
|
+
evr_re = re.compile("^(\d:)?(\S+)-(\S+)$")
|
85
|
+
evr = evr_re.match(pevr)
|
86
|
+
|
87
|
+
pepoch = ""
|
88
|
+
if evr.group(1) is None:
|
89
|
+
pepoch = "0"
|
90
|
+
else:
|
91
|
+
pepoch = evr.group(1).replace(":", "")
|
92
|
+
pversion = evr.group(2)
|
93
|
+
prelease = evr.group(3)
|
94
|
+
|
95
|
+
print "_pkg", pname, pepoch, pversion, prelease, parch
|
96
|
+
|
97
|
+
return 0
|
98
|
+
except:
|
99
|
+
print sys.exc_info()[0]
|
100
|
+
return 1
|
101
|
+
|
102
|
+
if useyumlib:
|
30
103
|
try:
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
104
|
+
try:
|
105
|
+
my = yum.YumBase()
|
106
|
+
ypl = pkg_lists(my)
|
107
|
+
for pkg in ypl.updates:
|
108
|
+
print "_pkg %s %s %s %s %s" % (pkg.name, pkg.epoch, pkg.version, pkg.release, pkg.arch)
|
109
|
+
finally:
|
110
|
+
my.closeRpmDB()
|
111
|
+
except IOError, e:
|
112
|
+
print "_err IOError %d %s" % (e.errno, e)
|
113
|
+
sys.exit(1)
|
114
|
+
except AttributeError, e:
|
115
|
+
# catch yumlib errors in buggy 2.x versions of yum
|
116
|
+
print "_err AttributeError %s" % e
|
117
|
+
sys.exit(1)
|
118
|
+
else:
|
119
|
+
rc = shell_out()
|
120
|
+
sys.exit(rc)
|
File without changes
|
File without changes
|
@@ -0,0 +1,47 @@
|
|
1
|
+
Puppet::Type.type(:selboolean).provide(:getsetsebool) do
|
2
|
+
desc "Manage SELinux booleans using the getsebool and setsebool binaries."
|
3
|
+
|
4
|
+
commands :getsebool => "/usr/sbin/getsebool"
|
5
|
+
commands :setsebool => "/usr/sbin/setsebool"
|
6
|
+
|
7
|
+
def value
|
8
|
+
self.debug "Retrieving value of selboolean #{@resource[:name]}"
|
9
|
+
|
10
|
+
status = getsebool(@resource[:name])
|
11
|
+
|
12
|
+
if status =~ / off$/ then
|
13
|
+
return :off
|
14
|
+
elsif status =~ / on$/ then
|
15
|
+
return :on
|
16
|
+
else
|
17
|
+
status.chomp!
|
18
|
+
raise Puppet::Error, "Invalid response '%s' returned from getsebool" % [status]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def value=(new)
|
23
|
+
persist = ""
|
24
|
+
if @resource[:persistent] == :true
|
25
|
+
self.debug "Enabling persistence"
|
26
|
+
persist = "-P"
|
27
|
+
end
|
28
|
+
execoutput("#{command(:setsebool)} #{persist} #{@resource[:name]} #{new}")
|
29
|
+
return :file_changed
|
30
|
+
end
|
31
|
+
|
32
|
+
# Required workaround, since SELinux policy prevents setsebool
|
33
|
+
# from writing to any files, even tmp, preventing the standard
|
34
|
+
# 'setsebool("...")' construct from working.
|
35
|
+
|
36
|
+
def execoutput (cmd)
|
37
|
+
output = ''
|
38
|
+
begin
|
39
|
+
execpipe(cmd) do |out|
|
40
|
+
output = out.readlines.join('').chomp!
|
41
|
+
end
|
42
|
+
rescue Puppet::ExecutionFailure
|
43
|
+
raise Puppet::ExecutionFailure, output.split("\n")[0]
|
44
|
+
end
|
45
|
+
return output
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,143 @@
|
|
1
|
+
Puppet::Type.type(:selmodule).provide(:semodule) do
|
2
|
+
desc "Manage SELinux policy modules using the semodule binary."
|
3
|
+
|
4
|
+
commands :semodule => "/usr/sbin/semodule"
|
5
|
+
|
6
|
+
def create
|
7
|
+
begin
|
8
|
+
execoutput("#{command(:semodule)} --install #{selmod_name_to_filename}")
|
9
|
+
rescue Puppet::ExecutionFailure => detail
|
10
|
+
raise Puppet::Error, "Could not load policy module: %s" % [detail];
|
11
|
+
end
|
12
|
+
return :true
|
13
|
+
end
|
14
|
+
|
15
|
+
def destroy
|
16
|
+
begin
|
17
|
+
execoutput("#{command(:semodule)} --remove #{@resource[:name]}")
|
18
|
+
rescue Puppet::ExecutionFailure => detail
|
19
|
+
raise Puppet::Error, "Could not remove policy module: %s" % [detail];
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def exists?
|
24
|
+
self.debug "Checking for module #{@resource[:name]}"
|
25
|
+
execpipe("#{command(:semodule)} --list") do |out|
|
26
|
+
out.each do |line|
|
27
|
+
if line =~ /#{@resource[:name]}\b/
|
28
|
+
return :true
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
return nil
|
33
|
+
end
|
34
|
+
|
35
|
+
def syncversion
|
36
|
+
self.debug "Checking syncversion on #{@resource[:name]}"
|
37
|
+
|
38
|
+
loadver = selmodversion_loaded
|
39
|
+
|
40
|
+
if(loadver) then
|
41
|
+
filever = selmodversion_file
|
42
|
+
if (filever == loadver) then
|
43
|
+
return :true
|
44
|
+
end
|
45
|
+
end
|
46
|
+
return :false
|
47
|
+
end
|
48
|
+
|
49
|
+
def syncversion= (dosync)
|
50
|
+
begin
|
51
|
+
execoutput("#{command(:semodule)} --upgrade #{selmod_name_to_filename}")
|
52
|
+
rescue Puppet::ExecutionFailure => detail
|
53
|
+
raise Puppet::Error, "Could not upgrade policy module: %s" % [detail];
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# Helper functions
|
58
|
+
|
59
|
+
def execoutput (cmd)
|
60
|
+
output = ''
|
61
|
+
begin
|
62
|
+
execpipe(cmd) do |out|
|
63
|
+
output = out.readlines.join('').chomp!
|
64
|
+
end
|
65
|
+
rescue Puppet::ExecutionFailure
|
66
|
+
raise Puppet::ExecutionFailure, output.split("\n")[0]
|
67
|
+
end
|
68
|
+
return output
|
69
|
+
end
|
70
|
+
|
71
|
+
def selmod_name_to_filename
|
72
|
+
if @resource[:selmodulepath]
|
73
|
+
return @resource[:selmodulepath]
|
74
|
+
else
|
75
|
+
return "#{@resource[:selmoduledir]}/#{@resource[:name]}.pp"
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
def selmod_readnext (handle)
|
80
|
+
len = handle.read(4).unpack('L')[0]
|
81
|
+
return handle.read(len)
|
82
|
+
end
|
83
|
+
|
84
|
+
def selmodversion_file
|
85
|
+
magic = 0xF97CFF8F
|
86
|
+
|
87
|
+
filename = selmod_name_to_filename
|
88
|
+
mod = File.new(filename, "r")
|
89
|
+
|
90
|
+
(hdr, ver, numsec) = mod.read(12).unpack('LLL')
|
91
|
+
|
92
|
+
if hdr != magic
|
93
|
+
raise Puppet::Error, "Found #{hdr} instead of magic #{magic} in #{filename}"
|
94
|
+
end
|
95
|
+
|
96
|
+
if ver != 1
|
97
|
+
raise Puppet::Error, "Unknown policy file version #{ver} in #{filename}"
|
98
|
+
end
|
99
|
+
|
100
|
+
# Read through (and throw away) the file section offsets, and also
|
101
|
+
# the magic header for the first section.
|
102
|
+
|
103
|
+
mod.read((numsec + 1) * 4)
|
104
|
+
|
105
|
+
## Section 1 should be "SE Linux Module"
|
106
|
+
|
107
|
+
selmod_readnext(mod)
|
108
|
+
selmod_readnext(mod)
|
109
|
+
|
110
|
+
# Skip past the section headers
|
111
|
+
mod.read(14)
|
112
|
+
|
113
|
+
# Module name
|
114
|
+
selmod_readnext(mod)
|
115
|
+
|
116
|
+
# At last! the version
|
117
|
+
|
118
|
+
v = selmod_readnext(mod)
|
119
|
+
|
120
|
+
self.debug "file version #{v}"
|
121
|
+
return v
|
122
|
+
end
|
123
|
+
|
124
|
+
def selmodversion_loaded
|
125
|
+
lines = ()
|
126
|
+
begin
|
127
|
+
execpipe("#{command(:semodule)} --list") do |output|
|
128
|
+
lines = output.readlines
|
129
|
+
lines.each do |line|
|
130
|
+
line.chomp!
|
131
|
+
bits = line.split
|
132
|
+
if bits[0] == @resource[:name] then
|
133
|
+
self.debug "load version #{bits[1]}"
|
134
|
+
return bits[1]
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
rescue Puppet::ExecutionFailure
|
139
|
+
raise Puppet::ExecutionFailure, "Could not list policy modules: %s" % [lines.join(' ').chomp!]
|
140
|
+
end
|
141
|
+
return nil
|
142
|
+
end
|
143
|
+
end
|