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.

Files changed (79) hide show
  1. data/CHANGELOG +51 -195
  2. data/LICENSE +2 -2
  3. data/conf/suse/puppet.spec +13 -10
  4. data/install.rb +7 -13
  5. data/lib/puppet.rb +1 -1
  6. data/lib/puppet/application.rb +17 -21
  7. data/lib/puppet/defaults.rb +1 -1
  8. data/lib/puppet/dsl.rb +0 -4
  9. data/lib/puppet/dsl/resource_type_api.rb +16 -10
  10. data/lib/puppet/external/event-loop/event-loop.rb +15 -11
  11. data/lib/puppet/feature/base.rb +2 -1
  12. data/lib/puppet/feature/rails.rb +1 -3
  13. data/lib/puppet/network/http/webrick/rest.rb +1 -0
  14. data/lib/puppet/network/http_pool.rb +0 -12
  15. data/lib/puppet/parser/ast/function.rb +1 -1
  16. data/lib/puppet/parser/ast/resource.rb +1 -5
  17. data/lib/puppet/parser/functions/extlookup.rb +1 -1
  18. data/lib/puppet/parser/functions/versioncmp.rb +3 -3
  19. data/lib/puppet/parser/lexer.rb +1 -1
  20. data/lib/puppet/parser/parser_support.rb +4 -2
  21. data/lib/puppet/parser/resource.rb +8 -0
  22. data/lib/puppet/parser/type_loader.rb +50 -48
  23. data/lib/puppet/provider/nameservice.rb +1 -0
  24. data/lib/puppet/provider/nameservice/objectadd.rb +2 -1
  25. data/lib/puppet/provider/service/freebsd.rb +1 -1
  26. data/lib/puppet/provider/service/launchd.rb +16 -9
  27. data/lib/puppet/provider/ssh_authorized_key/parsed.rb +7 -0
  28. data/lib/puppet/provider/user/hpux.rb +0 -1
  29. data/lib/puppet/provider/user/user_role_add.rb +21 -9
  30. data/lib/puppet/provider/user/useradd.rb +44 -3
  31. data/lib/puppet/rails.rb +3 -3
  32. data/lib/puppet/reference/configuration.rb +7 -12
  33. data/lib/puppet/reference/indirection.rb +2 -2
  34. data/lib/puppet/reference/metaparameter.rb +10 -9
  35. data/lib/puppet/reference/type.rb +6 -6
  36. data/lib/puppet/reports/rrdgraph.rb +1 -1
  37. data/lib/puppet/reports/tagmail.rb +1 -1
  38. data/lib/puppet/ssl/certificate_request.rb +1 -1
  39. data/lib/puppet/sslcertificates/ca.rb +4 -10
  40. data/lib/puppet/type.rb +3 -3
  41. data/lib/puppet/type/cron.rb +1 -1
  42. data/lib/puppet/type/tidy.rb +1 -0
  43. data/lib/puppet/type/user.rb +55 -0
  44. data/lib/puppet/type/whit.rb +4 -0
  45. data/lib/puppet/util.rb +8 -0
  46. data/lib/puppet/util/metric.rb +38 -9
  47. data/lib/puppet/util/rdoc/parser.rb +10 -7
  48. data/lib/puppet/util/reference.rb +4 -4
  49. data/lib/puppet/util/zaml.rb +0 -1
  50. data/spec/fixtures/yaml/report0.25.x.yaml +64 -0
  51. data/spec/fixtures/yaml/report2.6.x.yaml +190 -0
  52. data/spec/integration/application/doc_spec.rb +55 -0
  53. data/spec/integration/defaults_spec.rb +1 -1
  54. data/spec/integration/parser/compiler_spec.rb +21 -0
  55. data/spec/integration/parser/ruby_manifest_spec.rb +128 -0
  56. data/spec/lib/puppet_spec/files.rb +1 -0
  57. data/spec/spec_helper.rb +1 -0
  58. data/spec/unit/application_spec.rb +16 -25
  59. data/spec/unit/dsl/resource_type_api_spec.rb +32 -12
  60. data/spec/unit/indirector/node/active_record_spec.rb +0 -1
  61. data/spec/unit/parser/ast/function_spec.rb +14 -4
  62. data/spec/unit/parser/lexer_spec.rb +8 -0
  63. data/spec/unit/parser/parser_spec.rb +0 -9
  64. data/spec/unit/parser/type_loader_spec.rb +3 -16
  65. data/spec/unit/provider/service/launchd_spec.rb +8 -5
  66. data/spec/unit/provider/user/user_role_add_spec.rb +18 -1
  67. data/spec/unit/provider/user/useradd_spec.rb +19 -0
  68. data/spec/unit/rails_spec.rb +10 -4
  69. data/spec/unit/reports/rrdgraph_spec.rb +31 -0
  70. data/spec/unit/reports/tagmail_spec.rb +1 -0
  71. data/spec/unit/sslcertificates/ca_spec.rb +110 -0
  72. data/spec/unit/type/user_spec.rb +19 -1
  73. data/spec/unit/type/whit_spec.rb +11 -0
  74. data/spec/unit/type_spec.rb +7 -0
  75. data/spec/unit/util/rdoc/parser_spec.rb +18 -14
  76. data/spec/unit/util/zaml_spec.rb +2 -1
  77. metadata +11 -6
  78. data/conf/suse/ruby-env.patch +0 -17
  79. data/test/certmgr/ca.rb +0 -87
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
- Puppet - Automating Configuration Management. Copyright (C) 2005 Reductive Labs LLC
1
+ Puppet - Automating Configuration Management. Copyright (C) 2005 Puppet Labs LLC
2
2
 
3
- Reductive Labs can be contacted at: info@reductivelabs.com
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
@@ -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.0
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.7
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/* ; do
46
- sed -i -e '1c#!/usr/bin/ruby' $f
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 = RUBY_PLATFORM != "i386-mswin32"
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 RUBY_PLATFORM == "i386-mswin32"
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 Config::CONFIG["target_os"] =~ /win/io and Config::CONFIG["target_os"] !~ /darwin/io
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"
@@ -24,7 +24,7 @@ require 'puppet/util/run_mode'
24
24
  # it's also a place to find top-level commands like 'debug'
25
25
 
26
26
  module Puppet
27
- PUPPETVERSION = '2.6.1'
27
+ PUPPETVERSION = '2.6.2'
28
28
 
29
29
  def Puppet.version
30
30
  PUPPETVERSION
@@ -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
- # get all puppet options
327
- optparse_opt = []
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
- # convert them to OptionParser format
331
- optparse_opt.each do |option|
332
- self.option_parser.on(*option) do |arg|
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
- # scan command line argument
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
- self.option_parser.parse!(self.command_line.args)
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'"
@@ -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",
@@ -5,7 +5,3 @@ end
5
5
 
6
6
  require 'puppet/dsl/resource_type_api'
7
7
  require 'puppet/dsl/resource_api'
8
-
9
- class Object
10
- include Puppet::DSL::ResourceTypeAPI
11
- end
@@ -1,33 +1,39 @@
1
1
  require 'puppet/resource/type'
2
2
 
3
- module Puppet::DSL::ResourceTypeAPI
3
+ class Puppet::DSL::ResourceTypeAPI
4
4
  def define(name, *args, &block)
5
- result = mk_resource_type(:definition, name, Hash.new, block)
6
- result.set_arguments(munge_type_arguments(args))
7
- result
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
- mk_resource_type(:hostclass, name, options, block)
11
+ __mk_resource_type__(:hostclass, name, options, block)
12
+ nil
12
13
  end
13
14
 
14
15
  def node(name, options = {}, &block)
15
- mk_resource_type(:node, name, options, block)
16
+ __mk_resource_type__(:node, name, options, block)
17
+ nil
16
18
  end
17
19
 
18
- private
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 mk_resource_type(type, name, options, code)
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
- Puppet::Node::Environment.new.known_resource_types.add klass
31
+ Thread.current[:known_resource_types].add klass
26
32
 
27
33
  klass
28
34
  end
29
35
 
30
- def munge_type_arguments(args)
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, Fcntl::FD_CLOEXEC)
79
- @notify_snk.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
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
- require "fcntl"
238
- fcntl(Fcntl::F_GETFL, 0) & Fcntl::O_NONBLOCK == 0
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
- require "fcntl"
243
- flags = fcntl(Fcntl::F_GETFL, 0)
244
- if wants_blocking
245
- flags &= ~Fcntl::O_NONBLOCK
246
- else
247
- flags |= Fcntl::O_NONBLOCK
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
 
@@ -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(:rrd, :libs => ["RRDtool"])
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"])
@@ -24,9 +24,7 @@ Puppet.features.add(:rails) do
24
24
  end
25
25
  end
26
26
 
27
- if ! (defined?(::ActiveRecord) and defined?(::ActiveRecord::VERSION) and defined?(::ActiveRecord::VERSION::MAJOR) and defined?(::ActiveRecord::VERSION::MINOR))
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
@@ -1,5 +1,6 @@
1
1
  require 'puppet/network/http/handler'
2
2
  require 'resolv'
3
+ require 'webrick'
3
4
 
4
5
  class Puppet::Network::HTTP::WEBrickREST < WEBrick::HTTPServlet::AbstractServlet
5
6
 
@@ -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 obove code shows some other features, you can use any fact or variable that
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
- * > 0 if version a is greater than version b
18
- * == 0 if both version are equals
19
- * < 0 if version a is less than version b
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
 
@@ -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(/([^\\]|^)[#{terminators}]/) or lex_error "Unclosed quote after '#{last}' in '#{rest}'"
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.import_if_possible(file, @lexer.file)
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
- require self.file
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)