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
|
@@ -35,10 +35,6 @@ module Puppet::Network
|
|
35
35
|
|
36
36
|
interface.methods.each { |ary|
|
37
37
|
method = ary[0]
|
38
|
-
if public_method_defined?(method)
|
39
|
-
raise Puppet::DevError, "Method %s is already defined" %
|
40
|
-
method
|
41
|
-
end
|
42
38
|
newclient.send(:define_method,method) { |*args|
|
43
39
|
Puppet.debug "Calling %s.%s" % [namespace, method]
|
44
40
|
begin
|
@@ -51,7 +47,7 @@ module Puppet::Network
|
|
51
47
|
end
|
52
48
|
["certificate verify failed", "hostname was not match", "hostname not match"].each do |str|
|
53
49
|
if detail.message.include?(str)
|
54
|
-
Puppet.warning "Certificate validation failed;
|
50
|
+
Puppet.warning "Certificate validation failed; consider using the certname configuration option"
|
55
51
|
end
|
56
52
|
end
|
57
53
|
raise XMLRPCClientError,
|
@@ -74,6 +70,10 @@ module Puppet::Network
|
|
74
70
|
Puppet.warning "Other end went away; restarting connection and retrying"
|
75
71
|
self.recycle_connection
|
76
72
|
retry
|
73
|
+
rescue Timeout::Error => detail
|
74
|
+
Puppet.err "Connection timeout calling %s.%s: %s" %
|
75
|
+
[namespace, method, detail.to_s]
|
76
|
+
raise XMLRPCClientError.new("Connection Timeout").set_backtrace(detail.backtrace)
|
77
77
|
rescue => detail
|
78
78
|
if detail.message =~ /^Wrong size\. Was \d+, should be \d+$/
|
79
79
|
Puppet.warning "XMLRPC returned wrong size. Retrying."
|
data/lib/puppet/node.rb
CHANGED
@@ -15,12 +15,7 @@ class Puppet::Node
|
|
15
15
|
|
16
16
|
attr_accessor :name, :classes, :parameters, :source, :ipaddress
|
17
17
|
attr_reader :time
|
18
|
-
|
19
|
-
# Set the environment, making sure that it's valid.
|
20
|
-
def environment=(value)
|
21
|
-
raise(ArgumentError, "Invalid environment %s" % value) unless Puppet::Node::Environment.valid?(value)
|
22
|
-
@environment = value
|
23
|
-
end
|
18
|
+
attr_writer :environment
|
24
19
|
|
25
20
|
# Do not return environments that are the empty string, and use
|
26
21
|
# explicitly set environments, then facts, then a central env
|
@@ -28,7 +23,6 @@ class Puppet::Node
|
|
28
23
|
def environment
|
29
24
|
unless @environment
|
30
25
|
if env = parameters["environment"]
|
31
|
-
raise(ArgumentError, "Invalid environment %s from parameters" % env) unless Puppet::Node::Environment.valid?(env)
|
32
26
|
@environment = env
|
33
27
|
else
|
34
28
|
@environment = Puppet::Node::Environment.new.name.to_s
|
@@ -94,8 +88,10 @@ class Puppet::Node
|
|
94
88
|
|
95
89
|
# First, get the fqdn
|
96
90
|
unless fqdn = parameters["fqdn"]
|
97
|
-
if
|
98
|
-
|
91
|
+
if parameters["hostname"] and parameters["domain"]
|
92
|
+
fqdn = parameters["hostname"] + "." + parameters["domain"]
|
93
|
+
else
|
94
|
+
Puppet.warning "Host is missing hostname and/or domain: %s" % name
|
99
95
|
end
|
100
96
|
end
|
101
97
|
|
@@ -1,30 +1,14 @@
|
|
1
1
|
# Model the environment that a node can operate in. This class just
|
2
2
|
# provides a simple wrapper for the functionality around environments.
|
3
3
|
class Puppet::Node::Environment
|
4
|
-
# Return the list of valid environments. Just looks them up in
|
5
|
-
# the settings.
|
6
|
-
def self.valid
|
7
|
-
# LAK:NOTE See http://snurl.com/21zf8 [groups_google_com]
|
8
|
-
x = Puppet.settings.value(:environments).split(",").collect { |e| e.to_sym }
|
9
|
-
end
|
10
|
-
|
11
|
-
# Is the provided environment valid?
|
12
|
-
def self.valid?(name)
|
13
|
-
return false if name.to_s == ""
|
14
|
-
valid.include?(name.to_sym)
|
15
|
-
end
|
16
|
-
|
17
4
|
@seen = {}
|
18
5
|
|
19
|
-
# Return an existing environment instance, or create a new one
|
20
|
-
# validating the environment name.
|
6
|
+
# Return an existing environment instance, or create a new one.
|
21
7
|
def self.new(name = nil)
|
22
8
|
name ||= Puppet.settings.value(:environment)
|
23
9
|
|
24
10
|
raise ArgumentError, "Environment name must be specified" unless name
|
25
11
|
|
26
|
-
raise(ArgumentError, "'%s' is not a valid environment" % name) unless valid?(name)
|
27
|
-
|
28
12
|
symbol = name.to_sym
|
29
13
|
|
30
14
|
return @seen[symbol] if @seen[symbol]
|
data/lib/puppet/node/facts.rb
CHANGED
File without changes
|
data/lib/puppet/parameter.rb
CHANGED
@@ -413,39 +413,12 @@ class Puppet::Parameter
|
|
413
413
|
@shadow = nil
|
414
414
|
end
|
415
415
|
|
416
|
-
|
417
|
-
# it possible to call for properties, too.
|
418
|
-
def value
|
419
|
-
if self.is_a?(Puppet::Property)
|
420
|
-
# We should return the 'is' value if there's not 'should'
|
421
|
-
# value. This might be bad, though, because the 'should'
|
422
|
-
# method knows whether to return an array or not and that info
|
423
|
-
# is not exposed, and the 'is' value could be a symbol. I
|
424
|
-
# can't seem to create a test in which this is a problem, but
|
425
|
-
# that doesn't mean it's not one.
|
426
|
-
if self.should
|
427
|
-
return self.should
|
428
|
-
else
|
429
|
-
return self.retrieve
|
430
|
-
end
|
431
|
-
else
|
432
|
-
if defined? @value
|
433
|
-
return @value
|
434
|
-
else
|
435
|
-
return nil
|
436
|
-
end
|
437
|
-
end
|
438
|
-
end
|
416
|
+
attr_reader :value
|
439
417
|
|
440
418
|
# Store the value provided. All of the checking should possibly be
|
441
419
|
# late-binding (e.g., users might not exist when the value is assigned
|
442
420
|
# but might when it is asked for).
|
443
421
|
def value=(value)
|
444
|
-
# If we're a parameter, just hand the processing off to the should
|
445
|
-
# method.
|
446
|
-
if self.is_a?(Puppet::Property)
|
447
|
-
return self.should = value
|
448
|
-
end
|
449
422
|
if respond_to?(:validate)
|
450
423
|
validate(value)
|
451
424
|
end
|
data/lib/puppet/parser/ast.rb
CHANGED
@@ -74,19 +74,25 @@ class Puppet::Parser::AST
|
|
74
74
|
end
|
75
75
|
|
76
76
|
# And include all of the AST subclasses.
|
77
|
+
require 'puppet/parser/ast/arithmetic_operator'
|
77
78
|
require 'puppet/parser/ast/astarray'
|
78
79
|
require 'puppet/parser/ast/branch'
|
80
|
+
require 'puppet/parser/ast/boolean_operator'
|
79
81
|
require 'puppet/parser/ast/caseopt'
|
80
82
|
require 'puppet/parser/ast/casestatement'
|
81
83
|
require 'puppet/parser/ast/collection'
|
82
84
|
require 'puppet/parser/ast/collexpr'
|
85
|
+
require 'puppet/parser/ast/comparison_operator'
|
83
86
|
require 'puppet/parser/ast/definition'
|
84
87
|
require 'puppet/parser/ast/else'
|
85
88
|
require 'puppet/parser/ast/function'
|
86
89
|
require 'puppet/parser/ast/hostclass'
|
87
90
|
require 'puppet/parser/ast/ifstatement'
|
88
91
|
require 'puppet/parser/ast/leaf'
|
92
|
+
require 'puppet/parser/ast/minus'
|
89
93
|
require 'puppet/parser/ast/node'
|
94
|
+
require 'puppet/parser/ast/nop'
|
95
|
+
require 'puppet/parser/ast/not'
|
90
96
|
require 'puppet/parser/ast/resource'
|
91
97
|
require 'puppet/parser/ast/resource_defaults'
|
92
98
|
require 'puppet/parser/ast/resource_override'
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'puppet'
|
2
|
+
require 'puppet/parser/ast/branch'
|
3
|
+
|
4
|
+
class Puppet::Parser::AST
|
5
|
+
class ArithmeticOperator < AST::Branch
|
6
|
+
|
7
|
+
attr_accessor :operator, :lval, :rval
|
8
|
+
|
9
|
+
# Iterate across all of our children.
|
10
|
+
def each
|
11
|
+
[@lval,@rval,@operator].each { |child| yield child }
|
12
|
+
end
|
13
|
+
|
14
|
+
# Returns a boolean which is the result of the boolean operation
|
15
|
+
# of lval and rval operands
|
16
|
+
def evaluate(scope)
|
17
|
+
# evaluate the operands, should return a boolean value
|
18
|
+
lval = @lval.safeevaluate(scope)
|
19
|
+
lval = Puppet::Parser::Scope.number?(lval)
|
20
|
+
if lval == nil
|
21
|
+
raise ArgumentError, "left operand of %s is not a number" % @operator
|
22
|
+
end
|
23
|
+
rval = @rval.safeevaluate(scope)
|
24
|
+
rval = Puppet::Parser::Scope.number?(rval)
|
25
|
+
if rval == nil
|
26
|
+
raise ArgumentError, "right operand of %s is not a number" % @operator
|
27
|
+
end
|
28
|
+
|
29
|
+
# compute result
|
30
|
+
lval.send(@operator, rval)
|
31
|
+
end
|
32
|
+
|
33
|
+
def initialize(hash)
|
34
|
+
super
|
35
|
+
|
36
|
+
unless %w{+ - * / << >>}.include?(@operator)
|
37
|
+
raise ArgumentError, "Invalid arithmetic operator %s" % @operator
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'puppet'
|
2
|
+
require 'puppet/parser/ast/branch'
|
3
|
+
|
4
|
+
class Puppet::Parser::AST
|
5
|
+
class BooleanOperator < AST::Branch
|
6
|
+
|
7
|
+
attr_accessor :operator, :lval, :rval
|
8
|
+
|
9
|
+
# Iterate across all of our children.
|
10
|
+
def each
|
11
|
+
[@lval,@rval,@operator].each { |child| yield child }
|
12
|
+
end
|
13
|
+
|
14
|
+
# Returns a boolean which is the result of the boolean operation
|
15
|
+
# of lval and rval operands
|
16
|
+
def evaluate(scope)
|
17
|
+
# evaluate the first operand, should return a boolean value
|
18
|
+
lval = @lval.safeevaluate(scope)
|
19
|
+
|
20
|
+
# return result
|
21
|
+
# lazy evaluate right operand
|
22
|
+
case @operator
|
23
|
+
when "and";
|
24
|
+
if Puppet::Parser::Scope.true?(lval)
|
25
|
+
rval = @rval.safeevaluate(scope)
|
26
|
+
Puppet::Parser::Scope.true?(rval)
|
27
|
+
else # false and false == false
|
28
|
+
false
|
29
|
+
end
|
30
|
+
when "or";
|
31
|
+
if Puppet::Parser::Scope.true?(lval)
|
32
|
+
true
|
33
|
+
else
|
34
|
+
rval = @rval.safeevaluate(scope)
|
35
|
+
Puppet::Parser::Scope.true?(rval)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def initialize(hash)
|
41
|
+
super
|
42
|
+
|
43
|
+
unless %w{and or}.include?(@operator)
|
44
|
+
raise ArgumentError, "Invalid boolean operator %s" % @operator
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -30,7 +30,12 @@ class CollExpr < AST::Branch
|
|
30
30
|
case @oper
|
31
31
|
when "and": code1.call(resource) and code2.call(resource)
|
32
32
|
when "or": code1.call(resource) or code2.call(resource)
|
33
|
-
when "==":
|
33
|
+
when "==":
|
34
|
+
if resource[str1].is_a?(Array) && form != :exported
|
35
|
+
resource[str1].include?(str2)
|
36
|
+
else
|
37
|
+
resource[str1] == str2
|
38
|
+
end
|
34
39
|
when "!=": resource[str1] != str2
|
35
40
|
end
|
36
41
|
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'puppet'
|
2
|
+
require 'puppet/parser/ast/branch'
|
3
|
+
|
4
|
+
class Puppet::Parser::AST
|
5
|
+
class ComparisonOperator < AST::Branch
|
6
|
+
|
7
|
+
attr_accessor :operator, :lval, :rval
|
8
|
+
|
9
|
+
# Iterate across all of our children.
|
10
|
+
def each
|
11
|
+
[@lval,@rval,@operator].each { |child| yield child }
|
12
|
+
end
|
13
|
+
|
14
|
+
# Returns a boolean which is the result of the boolean operation
|
15
|
+
# of lval and rval operands
|
16
|
+
def evaluate(scope)
|
17
|
+
# evaluate the operands, should return a boolean value
|
18
|
+
lval = @lval.safeevaluate(scope)
|
19
|
+
rval = @rval.safeevaluate(scope)
|
20
|
+
|
21
|
+
# return result
|
22
|
+
unless @operator == '!='
|
23
|
+
lval.send(@operator,rval)
|
24
|
+
else
|
25
|
+
lval != rval
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def initialize(hash)
|
30
|
+
super
|
31
|
+
|
32
|
+
unless %w{== != < > <= >=}.include?(@operator)
|
33
|
+
raise ArgumentError, "Invalid comparison operator %s" % @operator
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'puppet'
|
2
|
+
require 'puppet/parser/ast/branch'
|
3
|
+
|
4
|
+
# An object that returns a boolean which is the boolean not
|
5
|
+
# of the given value.
|
6
|
+
class Puppet::Parser::AST
|
7
|
+
class Minus < AST::Branch
|
8
|
+
attr_accessor :value
|
9
|
+
|
10
|
+
def each
|
11
|
+
yield @value
|
12
|
+
end
|
13
|
+
|
14
|
+
def evaluate(scope)
|
15
|
+
val = @value.safeevaluate(scope)
|
16
|
+
val = Puppet::Parser::Scope.number?(val)
|
17
|
+
if val == nil
|
18
|
+
raise ArgumentError, "minus operand %s is not a number" % val
|
19
|
+
end
|
20
|
+
return -val
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'puppet'
|
2
|
+
require 'puppet/parser/ast/branch'
|
3
|
+
|
4
|
+
# An object that returns a boolean which is the boolean not
|
5
|
+
# of the given value.
|
6
|
+
class Puppet::Parser::AST
|
7
|
+
class Not < AST::Branch
|
8
|
+
attr_accessor :value
|
9
|
+
|
10
|
+
def each
|
11
|
+
yield @value
|
12
|
+
end
|
13
|
+
|
14
|
+
def evaluate(scope)
|
15
|
+
val = @value.safeevaluate(scope)
|
16
|
+
return ! Puppet::Parser::Scope.true?(val)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -19,7 +19,7 @@ class Puppet::Parser::AST
|
|
19
19
|
# in the current scope.
|
20
20
|
def evaluate(scope)
|
21
21
|
# Get our object reference.
|
22
|
-
|
22
|
+
resource = @object.safeevaluate(scope)
|
23
23
|
|
24
24
|
hash = {}
|
25
25
|
|
@@ -30,21 +30,28 @@ class Puppet::Parser::AST
|
|
30
30
|
|
31
31
|
# Now we just create a normal resource, but we call a very different
|
32
32
|
# method on the scope.
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
33
|
+
resource = [resource] unless resource.is_a?(Array)
|
34
|
+
|
35
|
+
resource = resource.collect do |r|
|
36
|
+
res = Puppet::Parser::Resource.new(
|
37
|
+
:type => r.type,
|
38
|
+
:title => r.title,
|
39
|
+
:params => params,
|
40
|
+
:file => @file,
|
41
|
+
:line => @line,
|
42
|
+
:source => scope.source,
|
43
|
+
:scope => scope
|
44
|
+
)
|
45
|
+
|
46
|
+
# Now we tell the scope that it's an override, and it behaves as
|
47
|
+
# necessary.
|
48
|
+
scope.compiler.add_override(res)
|
49
|
+
|
50
|
+
res
|
51
|
+
end
|
52
|
+
# decapsulate array in case of only one item
|
53
|
+
return resource.pop if resource.length == 1
|
54
|
+
return resource
|
48
55
|
end
|
49
56
|
|
50
57
|
# Create our ResourceDef. Handles type checking for us.
|
@@ -24,16 +24,20 @@ class Puppet::Parser::AST
|
|
24
24
|
# and name.
|
25
25
|
def evaluate(scope)
|
26
26
|
title = @title.safeevaluate(scope)
|
27
|
+
title = [title] unless title.is_a?(Array)
|
28
|
+
|
27
29
|
if @type.to_s.downcase == "class"
|
28
|
-
|
29
|
-
title = qualified_class(scope,
|
30
|
+
resource_type = "class"
|
31
|
+
title = title.collect { |t| qualified_class(scope, t) }
|
30
32
|
else
|
31
|
-
|
33
|
+
resource_type = qualified_type(scope)
|
32
34
|
end
|
33
35
|
|
34
|
-
|
35
|
-
:type =>
|
36
|
-
)
|
36
|
+
title = title.collect { |t| Puppet::Parser::Resource::Reference.new(
|
37
|
+
:type => resource_type, :title => t
|
38
|
+
) }
|
39
|
+
return title.pop if title.length == 1
|
40
|
+
return title
|
37
41
|
end
|
38
42
|
|
39
43
|
# Look up a fully qualified class name.
|