puppet 2.6.1 → 2.6.2
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 +51 -195
- data/LICENSE +2 -2
- data/conf/suse/puppet.spec +13 -10
- data/install.rb +7 -13
- data/lib/puppet.rb +1 -1
- data/lib/puppet/application.rb +17 -21
- data/lib/puppet/defaults.rb +1 -1
- data/lib/puppet/dsl.rb +0 -4
- data/lib/puppet/dsl/resource_type_api.rb +16 -10
- data/lib/puppet/external/event-loop/event-loop.rb +15 -11
- data/lib/puppet/feature/base.rb +2 -1
- data/lib/puppet/feature/rails.rb +1 -3
- data/lib/puppet/network/http/webrick/rest.rb +1 -0
- data/lib/puppet/network/http_pool.rb +0 -12
- data/lib/puppet/parser/ast/function.rb +1 -1
- data/lib/puppet/parser/ast/resource.rb +1 -5
- data/lib/puppet/parser/functions/extlookup.rb +1 -1
- data/lib/puppet/parser/functions/versioncmp.rb +3 -3
- data/lib/puppet/parser/lexer.rb +1 -1
- data/lib/puppet/parser/parser_support.rb +4 -2
- data/lib/puppet/parser/resource.rb +8 -0
- data/lib/puppet/parser/type_loader.rb +50 -48
- data/lib/puppet/provider/nameservice.rb +1 -0
- data/lib/puppet/provider/nameservice/objectadd.rb +2 -1
- data/lib/puppet/provider/service/freebsd.rb +1 -1
- data/lib/puppet/provider/service/launchd.rb +16 -9
- data/lib/puppet/provider/ssh_authorized_key/parsed.rb +7 -0
- data/lib/puppet/provider/user/hpux.rb +0 -1
- data/lib/puppet/provider/user/user_role_add.rb +21 -9
- data/lib/puppet/provider/user/useradd.rb +44 -3
- data/lib/puppet/rails.rb +3 -3
- data/lib/puppet/reference/configuration.rb +7 -12
- data/lib/puppet/reference/indirection.rb +2 -2
- data/lib/puppet/reference/metaparameter.rb +10 -9
- data/lib/puppet/reference/type.rb +6 -6
- data/lib/puppet/reports/rrdgraph.rb +1 -1
- data/lib/puppet/reports/tagmail.rb +1 -1
- data/lib/puppet/ssl/certificate_request.rb +1 -1
- data/lib/puppet/sslcertificates/ca.rb +4 -10
- data/lib/puppet/type.rb +3 -3
- data/lib/puppet/type/cron.rb +1 -1
- data/lib/puppet/type/tidy.rb +1 -0
- data/lib/puppet/type/user.rb +55 -0
- data/lib/puppet/type/whit.rb +4 -0
- data/lib/puppet/util.rb +8 -0
- data/lib/puppet/util/metric.rb +38 -9
- data/lib/puppet/util/rdoc/parser.rb +10 -7
- data/lib/puppet/util/reference.rb +4 -4
- data/lib/puppet/util/zaml.rb +0 -1
- data/spec/fixtures/yaml/report0.25.x.yaml +64 -0
- data/spec/fixtures/yaml/report2.6.x.yaml +190 -0
- data/spec/integration/application/doc_spec.rb +55 -0
- data/spec/integration/defaults_spec.rb +1 -1
- data/spec/integration/parser/compiler_spec.rb +21 -0
- data/spec/integration/parser/ruby_manifest_spec.rb +128 -0
- data/spec/lib/puppet_spec/files.rb +1 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/unit/application_spec.rb +16 -25
- data/spec/unit/dsl/resource_type_api_spec.rb +32 -12
- data/spec/unit/indirector/node/active_record_spec.rb +0 -1
- data/spec/unit/parser/ast/function_spec.rb +14 -4
- data/spec/unit/parser/lexer_spec.rb +8 -0
- data/spec/unit/parser/parser_spec.rb +0 -9
- data/spec/unit/parser/type_loader_spec.rb +3 -16
- data/spec/unit/provider/service/launchd_spec.rb +8 -5
- data/spec/unit/provider/user/user_role_add_spec.rb +18 -1
- data/spec/unit/provider/user/useradd_spec.rb +19 -0
- data/spec/unit/rails_spec.rb +10 -4
- data/spec/unit/reports/rrdgraph_spec.rb +31 -0
- data/spec/unit/reports/tagmail_spec.rb +1 -0
- data/spec/unit/sslcertificates/ca_spec.rb +110 -0
- data/spec/unit/type/user_spec.rb +19 -1
- data/spec/unit/type/whit_spec.rb +11 -0
- data/spec/unit/type_spec.rb +7 -0
- data/spec/unit/util/rdoc/parser_spec.rb +18 -14
- data/spec/unit/util/zaml_spec.rb +2 -1
- metadata +11 -6
- data/conf/suse/ruby-env.patch +0 -17
- data/test/certmgr/ca.rb +0 -87
data/LICENSE
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
Puppet - Automating Configuration Management. Copyright (C) 2005
|
1
|
+
Puppet - Automating Configuration Management. Copyright (C) 2005 Puppet Labs LLC
|
2
2
|
|
3
|
-
|
3
|
+
Puppet Labs can be contacted at: info@puppetlabs.com
|
4
4
|
|
5
5
|
This program and entire repository is free software; you can
|
6
6
|
redistribute it and/or modify it under the terms of the GNU
|
data/conf/suse/puppet.spec
CHANGED
@@ -4,23 +4,20 @@
|
|
4
4
|
|
5
5
|
Summary: A network tool for managing many disparate systems
|
6
6
|
Name: puppet
|
7
|
-
Version: 2.6.
|
7
|
+
Version: 2.6.1
|
8
8
|
Release: 1%{?dist}
|
9
9
|
License: GPL
|
10
10
|
Group: Productivity/Networking/System
|
11
11
|
|
12
12
|
URL: http://puppetlabs.com/projects/puppet/
|
13
13
|
Source0: http://puppetlabs.com/downloads/puppet/%{name}-%{version}.tar.gz
|
14
|
-
Source1: client.init
|
15
|
-
Source2: server.init
|
16
|
-
Patch0: ruby-env.patch
|
17
14
|
|
18
15
|
PreReq: %{insserv_prereq} %{fillup_prereq}
|
19
16
|
Requires: ruby >= 1.8.2
|
20
17
|
Requires: facter >= 1.5
|
21
18
|
Requires: cron
|
22
19
|
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
23
|
-
BuildRequires: ruby >= 1.8.
|
20
|
+
BuildRequires: ruby >= 1.8.2
|
24
21
|
|
25
22
|
%description
|
26
23
|
Puppet lets you centrally manage every important aspect of your system using a
|
@@ -39,11 +36,10 @@ The server can also function as a certificate authority and file server.
|
|
39
36
|
|
40
37
|
%prep
|
41
38
|
%setup -q
|
42
|
-
%patch0 -p0
|
43
39
|
|
44
40
|
%build
|
45
|
-
for f in bin/*
|
46
|
-
sed -i -e '
|
41
|
+
for f in bin/* sbin/*; do
|
42
|
+
sed -i -e '1s,^#!.*ruby$,#!/usr/bin/ruby,' $f
|
47
43
|
done
|
48
44
|
|
49
45
|
%install
|
@@ -63,16 +59,16 @@ done
|
|
63
59
|
find %{buildroot}%{ruby_sitelibdir} -type f -perm +ugo+x -exec chmod a-x '{}' \;
|
64
60
|
%{__cp} -a %{pbuild}/conf/redhat/client.sysconfig %{buildroot}%{_confdir}/client.sysconfig
|
65
61
|
%{__install} -Dp -m0644 %{buildroot}%{_confdir}/client.sysconfig %{buildroot}/var/adm/fillup-templates/sysconfig.puppet
|
66
|
-
%{__install} -Dp -m0755 %SOURCE1 %{buildroot}%{_initrddir}/puppet
|
67
62
|
%{__cp} -a %{pbuild}/conf/redhat/server.sysconfig %{buildroot}%{_confdir}/server.sysconfig
|
68
63
|
%{__install} -Dp -m0644 %{buildroot}%{_confdir}/server.sysconfig %{buildroot}/var/adm/fillup-templates/sysconfig.puppetmaster
|
69
|
-
%{__install} -Dp -m0755 %SOURCE2 %{buildroot}%{_initrddir}/puppetmaster
|
70
64
|
%{__cp} -a %{pbuild}/conf/redhat/fileserver.conf %{buildroot}%{_confdir}/fileserver.conf
|
71
65
|
%{__install} -Dp -m0644 %{buildroot}%{_confdir}/fileserver.conf %{buildroot}%{_sysconfdir}/puppet/fileserver.conf
|
72
66
|
%{__cp} -a %{pbuild}/conf/redhat/puppet.conf %{buildroot}%{_confdir}/puppet.conf
|
73
67
|
%{__install} -Dp -m0644 %{buildroot}%{_confdir}/puppet.conf %{buildroot}%{_sysconfdir}/puppet/puppet.conf
|
74
68
|
%{__cp} -a %{pbuild}/conf/redhat/logrotate %{buildroot}%{_confdir}/logrotate
|
75
69
|
%{__install} -Dp -m0644 %{buildroot}%{_confdir}/logrotate %{buildroot}%{_sysconfdir}/logrotate.d/puppet
|
70
|
+
%{__install} -Dp -m0755 %{confdir}/client.init %{buildroot}%{_initrddir}/puppet
|
71
|
+
%{__install} -Dp -m0755 %{confdir}/server.init %{buildroot}%{_initrddir}/puppetmaster
|
76
72
|
%{__ln_s} %{_initrddir}/puppet %{buildroot}%{_sbindir}/rcpuppet
|
77
73
|
%{__ln_s} %{_initrddir}/puppetmaster %{buildroot}%{_sbindir}/rcpuppetmaster
|
78
74
|
|
@@ -140,6 +136,13 @@ find %{buildroot}%{ruby_sitelibdir} -type f -perm +ugo+x -exec chmod a-x '{}' \;
|
|
140
136
|
%{__rm} -rf %{buildroot}
|
141
137
|
|
142
138
|
%changelog
|
139
|
+
* Tue Sep 14 2010 Ben Kevan <ben.kevan@gmail.com> - 2.6.1
|
140
|
+
- New version to 2.6.1
|
141
|
+
- Add client.init and server.init from source since it's now included in the packages
|
142
|
+
- Change BuildRequires Ruby version to match Requires Ruby version
|
143
|
+
- Removed ruby-env patch, replaced with sed in prep
|
144
|
+
- Update urls to puppetlabs.com
|
145
|
+
|
143
146
|
* Wed Jul 21 2010 Ben Kevan <ben.kevan@gmail.com> - 2.6.0
|
144
147
|
- New version and ruby version bump
|
145
148
|
- Add puppetdoc to %_bindir (unknown why original suse package, excluded or forgot to add)
|
data/install.rb
CHANGED
@@ -88,6 +88,7 @@ libs = glob(%w{lib/**/*.rb lib/**/*.py lib/puppet/util/command_line/*})
|
|
88
88
|
tests = glob(%w{test/**/*.rb})
|
89
89
|
|
90
90
|
def do_bins(bins, target, strip = 's?bin/')
|
91
|
+
Dir.mkdir(target) unless File.directory? target
|
91
92
|
bins.each do |bf|
|
92
93
|
obf = bf.gsub(/#{strip}/, '')
|
93
94
|
install_binfile(bf, obf, target)
|
@@ -154,10 +155,12 @@ end
|
|
154
155
|
# Prepare the file installation.
|
155
156
|
#
|
156
157
|
def prepare_installation
|
158
|
+
$operatingsystem = Facter["operatingsystem"].value
|
159
|
+
|
157
160
|
# Only try to do docs if we're sure they have rdoc
|
158
161
|
if $haverdoc
|
159
162
|
InstallOptions.rdoc = true
|
160
|
-
InstallOptions.ri =
|
163
|
+
InstallOptions.ri = $operatingsystem != "windows"
|
161
164
|
else
|
162
165
|
InstallOptions.rdoc = false
|
163
166
|
InstallOptions.ri = false
|
@@ -166,7 +169,7 @@ def prepare_installation
|
|
166
169
|
|
167
170
|
if $haveman
|
168
171
|
InstallOptions.man = true
|
169
|
-
if
|
172
|
+
if $operatingsystem == "windows"
|
170
173
|
InstallOptions.man = false
|
171
174
|
end
|
172
175
|
else
|
@@ -175,15 +178,6 @@ def prepare_installation
|
|
175
178
|
|
176
179
|
InstallOptions.tests = true
|
177
180
|
|
178
|
-
if $haveman
|
179
|
-
InstallOptions.man = true
|
180
|
-
if RUBY_PLATFORM == "i386-mswin32"
|
181
|
-
InstallOptions.man = false
|
182
|
-
end
|
183
|
-
else
|
184
|
-
InstallOptions.man = false
|
185
|
-
end
|
186
|
-
|
187
181
|
ARGV.options do |opts|
|
188
182
|
opts.banner = "Usage: #{File.basename($0)} [options]"
|
189
183
|
opts.separator ""
|
@@ -418,7 +412,7 @@ def install_binfile(from, op_file, target)
|
|
418
412
|
end
|
419
413
|
end
|
420
414
|
|
421
|
-
if
|
415
|
+
if $operatingsystem == "windows"
|
422
416
|
installed_wrapper = false
|
423
417
|
|
424
418
|
if File.exists?("#{from}.bat")
|
@@ -468,4 +462,4 @@ prepare_installation
|
|
468
462
|
do_bins(sbins, InstallOptions.sbin_dir)
|
469
463
|
do_bins(bins, InstallOptions.bin_dir)
|
470
464
|
do_libs(libs)
|
471
|
-
do_man(man)
|
465
|
+
do_man(man) unless $operatingsystem == "windows"
|
data/lib/puppet.rb
CHANGED
data/lib/puppet/application.rb
CHANGED
@@ -254,19 +254,6 @@ class Application
|
|
254
254
|
def preinit
|
255
255
|
end
|
256
256
|
|
257
|
-
def option_parser
|
258
|
-
return @option_parser if defined?(@option_parser)
|
259
|
-
|
260
|
-
@option_parser = OptionParser.new(self.class.banner)
|
261
|
-
|
262
|
-
self.class.option_parser_commands.each do |options, fname|
|
263
|
-
@option_parser.on(*options) do |value|
|
264
|
-
self.send(fname, value)
|
265
|
-
end
|
266
|
-
end
|
267
|
-
@option_parser
|
268
|
-
end
|
269
|
-
|
270
257
|
def initialize(command_line = nil)
|
271
258
|
require 'puppet/util/command_line'
|
272
259
|
@command_line = command_line || Puppet::Util::CommandLine.new
|
@@ -323,20 +310,29 @@ class Application
|
|
323
310
|
end
|
324
311
|
|
325
312
|
def parse_options
|
326
|
-
#
|
327
|
-
|
328
|
-
optparse_opt = Puppet.settings.optparse_addargs(optparse_opt)
|
313
|
+
# Create an option parser
|
314
|
+
option_parser = OptionParser.new(self.class.banner)
|
329
315
|
|
330
|
-
#
|
331
|
-
|
332
|
-
|
316
|
+
# Add all global options to it.
|
317
|
+
Puppet.settings.optparse_addargs([]).each do |option|
|
318
|
+
option_parser.on(*option) do |arg|
|
333
319
|
handlearg(option[0], arg)
|
334
320
|
end
|
335
321
|
end
|
336
322
|
|
337
|
-
#
|
323
|
+
# Add options that are local to this application, which were
|
324
|
+
# created using the "option()" metaprogramming method. If there
|
325
|
+
# are any conflicts, this application's options will be favored.
|
326
|
+
self.class.option_parser_commands.each do |options, fname|
|
327
|
+
option_parser.on(*options) do |value|
|
328
|
+
# Call the method that "option()" created.
|
329
|
+
self.send(fname, value)
|
330
|
+
end
|
331
|
+
end
|
332
|
+
|
333
|
+
# scan command line.
|
338
334
|
begin
|
339
|
-
|
335
|
+
option_parser.parse!(self.command_line.args)
|
340
336
|
rescue OptionParser::ParseError => detail
|
341
337
|
$stderr.puts detail
|
342
338
|
$stderr.puts "Try 'puppet #{command_line.subcommand_name} --help'"
|
data/lib/puppet/defaults.rb
CHANGED
@@ -268,7 +268,7 @@ module Puppet
|
|
268
268
|
|
269
269
|
setdefaults(
|
270
270
|
:ca,
|
271
|
-
:ca_name => ["$certname", "The name to use the Certificate Authority certificate."],
|
271
|
+
:ca_name => ["Puppet CA: $certname", "The name to use the Certificate Authority certificate."],
|
272
272
|
:cadir => { :default => "$ssldir/ca",
|
273
273
|
:owner => "service",
|
274
274
|
:group => "service",
|
data/lib/puppet/dsl.rb
CHANGED
@@ -1,33 +1,39 @@
|
|
1
1
|
require 'puppet/resource/type'
|
2
2
|
|
3
|
-
|
3
|
+
class Puppet::DSL::ResourceTypeAPI
|
4
4
|
def define(name, *args, &block)
|
5
|
-
result =
|
6
|
-
result.set_arguments(
|
7
|
-
|
5
|
+
result = __mk_resource_type__(:definition, name, Hash.new, block)
|
6
|
+
result.set_arguments(__munge_type_arguments__(args))
|
7
|
+
nil
|
8
8
|
end
|
9
9
|
|
10
10
|
def hostclass(name, options = {}, &block)
|
11
|
-
|
11
|
+
__mk_resource_type__(:hostclass, name, options, block)
|
12
|
+
nil
|
12
13
|
end
|
13
14
|
|
14
15
|
def node(name, options = {}, &block)
|
15
|
-
|
16
|
+
__mk_resource_type__(:node, name, options, block)
|
17
|
+
nil
|
16
18
|
end
|
17
19
|
|
18
|
-
|
20
|
+
# Note: we don't want the user to call the following methods
|
21
|
+
# directly. However, we can't stop them by making the methods
|
22
|
+
# private because the user's .rb code gets instance_eval'ed on an
|
23
|
+
# instance of this class. So instead we name the methods using
|
24
|
+
# double underscores to discourage customers from calling them.
|
19
25
|
|
20
|
-
def
|
26
|
+
def __mk_resource_type__(type, name, options, code)
|
21
27
|
klass = Puppet::Resource::Type.new(type, name, options)
|
22
28
|
|
23
29
|
klass.ruby_code = code if code
|
24
30
|
|
25
|
-
|
31
|
+
Thread.current[:known_resource_types].add klass
|
26
32
|
|
27
33
|
klass
|
28
34
|
end
|
29
35
|
|
30
|
-
def
|
36
|
+
def __munge_type_arguments__(args)
|
31
37
|
args.inject([]) do |result, item|
|
32
38
|
if item.is_a?(Hash)
|
33
39
|
item.each { |p, v| result << [p, v] }
|
@@ -75,8 +75,10 @@ class EventLoop
|
|
75
75
|
@notify_src, @notify_snk = IO.pipe
|
76
76
|
|
77
77
|
# prevent file descriptor leaks
|
78
|
-
@notify_src.fcntl(Fcntl::F_SETFD
|
79
|
-
|
78
|
+
if @notify_src.respond_to?(:fcntl) and defined?(Fcntl) and defined?(Fcntl::F_SETFD) and defined?(Fcntl::FD_CLOEXEC)
|
79
|
+
@notify_src.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
|
80
|
+
@notify_snk.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
|
81
|
+
end
|
80
82
|
|
81
83
|
@notify_src.will_block = false
|
82
84
|
@notify_snk.will_block = false
|
@@ -234,19 +236,21 @@ class IO
|
|
234
236
|
end
|
235
237
|
|
236
238
|
def will_block?
|
237
|
-
|
238
|
-
|
239
|
+
if respond_to?(:fcntl) and defined?(Fcntl) and defined?(Fcntl::F_GETFL) and defined?(Fcntl::O_NONBLOCK)
|
240
|
+
fcntl(Fcntl::F_GETFL, 0) & Fcntl::O_NONBLOCK == 0
|
241
|
+
end
|
239
242
|
end
|
240
243
|
|
241
244
|
def will_block= (wants_blocking)
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
245
|
+
if respond_to?(:fcntl) and defined?(Fcntl) and defined?(Fcntl::F_GETFL) and defined?(Fcntl::O_NONBLOCK)
|
246
|
+
flags = fcntl(Fcntl::F_GETFL, 0)
|
247
|
+
if wants_blocking
|
248
|
+
flags &= ~Fcntl::O_NONBLOCK
|
249
|
+
else
|
250
|
+
flags |= Fcntl::O_NONBLOCK
|
251
|
+
end
|
252
|
+
fcntl(Fcntl::F_SETFL, flags)
|
248
253
|
end
|
249
|
-
fcntl(Fcntl::F_SETFL, flags)
|
250
254
|
end
|
251
255
|
end
|
252
256
|
|
data/lib/puppet/feature/base.rb
CHANGED
@@ -27,7 +27,8 @@ Puppet.features.add :diff, :libs => %w{diff/lcs diff/lcs/hunk}
|
|
27
27
|
Puppet.features.add(:augeas, :libs => ["augeas"])
|
28
28
|
|
29
29
|
# We have RRD available
|
30
|
-
Puppet.features.add(:
|
30
|
+
Puppet.features.add(:rrd_legacy, :libs => ["RRDtool"])
|
31
|
+
Puppet.features.add(:rrd, :libs => ["RRD"])
|
31
32
|
|
32
33
|
# We have OpenSSL
|
33
34
|
Puppet.features.add(:openssl, :libs => ["openssl"])
|
data/lib/puppet/feature/rails.rb
CHANGED
@@ -24,9 +24,7 @@ Puppet.features.add(:rails) do
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
|
28
|
-
false
|
29
|
-
elsif ! (::ActiveRecord::VERSION::MAJOR == 2 and ::ActiveRecord::VERSION::MINOR >= 1)
|
27
|
+
unless (Puppet::Util.activerecord_version >= 2.1)
|
30
28
|
Puppet.info "ActiveRecord 2.1 or later required for StoreConfigs"
|
31
29
|
false
|
32
30
|
else
|
@@ -58,18 +58,6 @@ module Puppet::Network::HttpPool
|
|
58
58
|
http.cert = ssl_host.certificate.content
|
59
59
|
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
60
60
|
http.key = ssl_host.key.content
|
61
|
-
http.verify_callback = self.method(:ssl_verify_callback).to_proc if Puppet[:debug]
|
62
|
-
end
|
63
|
-
|
64
|
-
def self.ssl_verify_callback(peer_ok, x509_store_ctx)
|
65
|
-
if not peer_ok
|
66
|
-
Puppet.debug "OpenSSL: Error(#{x509_store_ctx.error}): #{x509_store_ctx.error_string}"
|
67
|
-
Puppet.debug "OpenSSL: Cert: #{x509_store_ctx.current_cert.issuer}"
|
68
|
-
Puppet.debug "OpenSSL: Current CRL: #{x509_store_ctx.current_crl}"
|
69
|
-
Puppet.debug "OpenSSL: Chain:"
|
70
|
-
x509_store_ctx.chain.each_index { |i| Puppet.debug "OpenSSL: \t#{i} #{x509_store_ctx.chain[i].issuer}" }
|
71
|
-
end
|
72
|
-
peer_ok
|
73
61
|
end
|
74
62
|
|
75
63
|
# Retrieve a cached http instance if caching is enabled, else return
|
@@ -28,7 +28,7 @@ class Puppet::Parser::AST
|
|
28
28
|
end
|
29
29
|
|
30
30
|
# We don't need to evaluate the name, because it's plaintext
|
31
|
-
args = @arguments.safeevaluate(scope)
|
31
|
+
args = @arguments.safeevaluate(scope).map { |x| x == :undef ? '' : x }
|
32
32
|
|
33
33
|
scope.send("function_#{@name}", args)
|
34
34
|
end
|
@@ -46,7 +46,6 @@ class Resource < AST::ResourceReference
|
|
46
46
|
:virtual => virt,
|
47
47
|
:source => scope.source,
|
48
48
|
:scope => scope,
|
49
|
-
|
50
49
|
:strict => true
|
51
50
|
)
|
52
51
|
|
@@ -64,12 +63,9 @@ class Resource < AST::ResourceReference
|
|
64
63
|
if params.is_a?(AST::ASTArray)
|
65
64
|
@parameters = params
|
66
65
|
else
|
67
|
-
|
68
|
-
@parameters = AST::ASTArray.new(
|
69
|
-
|
66
|
+
@parameters = AST::ASTArray.new(
|
70
67
|
:line => params.line,
|
71
68
|
:file => params.file,
|
72
|
-
|
73
69
|
:children => [params]
|
74
70
|
)
|
75
71
|
end
|
@@ -52,7 +52,7 @@ the exact same outcome:
|
|
52
52
|
|
53
53
|
$snmp_contact = extlookup(\"snmp_contact\")
|
54
54
|
|
55
|
-
The
|
55
|
+
The above code shows some other features, you can use any fact or variable that
|
56
56
|
is in scope by simply using %{varname} in your data files, you can return arrays
|
57
57
|
by just having multiple values in the csv after the initial variable name.
|
58
58
|
|
@@ -14,9 +14,9 @@ Where a and b are arbitrary version strings
|
|
14
14
|
|
15
15
|
This functions returns a number:
|
16
16
|
|
17
|
-
*
|
18
|
-
*
|
19
|
-
*
|
17
|
+
* Greater than 0 if version a is greater than version b
|
18
|
+
* Equal to 0 if both version are equals
|
19
|
+
* Less than 0 if version a is less than version b
|
20
20
|
|
21
21
|
Example:
|
22
22
|
|
data/lib/puppet/parser/lexer.rb
CHANGED
@@ -520,7 +520,7 @@ class Puppet::Parser::Lexer
|
|
520
520
|
def slurpstring(terminators,escapes=%w{ \\ $ ' " n t s }+["\n"],ignore_invalid_escapes=false)
|
521
521
|
# we search for the next quote that isn't preceded by a
|
522
522
|
# backslash; the caret is there to match empty strings
|
523
|
-
str = @scanner.scan_until(/([^\\]
|
523
|
+
str = @scanner.scan_until(/([^\\]|^|[^\\])([\\]{2})*[#{terminators}]/) or lex_error "Unclosed quote after '#{last}' in '#{rest}'"
|
524
524
|
@line += str.count("\n") # literal carriage returns add to the line count.
|
525
525
|
str.gsub!(/\\(.)/) {
|
526
526
|
ch = $1
|
@@ -111,7 +111,7 @@ class Puppet::Parser::Parser
|
|
111
111
|
end
|
112
112
|
|
113
113
|
def import(file)
|
114
|
-
known_resource_types.loader.
|
114
|
+
known_resource_types.loader.import(file, @lexer.file)
|
115
115
|
end
|
116
116
|
|
117
117
|
def initialize(env)
|
@@ -215,7 +215,9 @@ class Puppet::Parser::Parser
|
|
215
215
|
end
|
216
216
|
|
217
217
|
def parse_ruby_file
|
218
|
-
|
218
|
+
# Execute the contents of the file inside its own "main" object so
|
219
|
+
# that it can call methods in the resource type API.
|
220
|
+
Puppet::DSL::ResourceTypeAPI.new.instance_eval(File.read(self.file))
|
219
221
|
end
|
220
222
|
|
221
223
|
def string=(string)
|