puppet 0.25.1 → 0.25.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 (198) hide show
  1. data/CHANGELOG +159 -135
  2. data/Rakefile +4 -1
  3. data/conf/gentoo/conf.d/puppetmaster +1 -1
  4. data/conf/osx/createpackage.sh +12 -0
  5. data/conf/osx/preflight +4 -0
  6. data/conf/redhat/puppet.spec +12 -2
  7. data/conf/redhat/server.init +1 -0
  8. data/conf/redhat/server.sysconfig +1 -1
  9. data/ext/ldap/puppet.schema +5 -9
  10. data/ext/puppetlast +2 -1
  11. data/ext/rack/README +2 -2
  12. data/ext/regexp_nodes/classes/databases +2 -0
  13. data/ext/regexp_nodes/classes/webservers +2 -0
  14. data/ext/regexp_nodes/parameters/environment/prod +1 -0
  15. data/ext/regexp_nodes/parameters/environment/qa +3 -0
  16. data/ext/regexp_nodes/regexp_nodes.rb +215 -0
  17. data/lib/puppet.rb +1 -1
  18. data/lib/puppet/agent.rb +2 -2
  19. data/lib/puppet/application/puppet.rb +1 -1
  20. data/lib/puppet/application/puppetd.rb +1 -1
  21. data/lib/puppet/application/puppetdoc.rb +4 -3
  22. data/lib/puppet/application/puppetrun.rb +5 -14
  23. data/lib/puppet/application/ralsh.rb +9 -25
  24. data/lib/puppet/configurer.rb +2 -1
  25. data/lib/puppet/configurer/fact_handler.rb +8 -6
  26. data/lib/puppet/daemon.rb +2 -2
  27. data/lib/puppet/defaults.rb +21 -2
  28. data/lib/puppet/external/pson/common.rb +1 -1
  29. data/lib/puppet/external/pson/pure.rb +3 -3
  30. data/lib/puppet/feature/base.rb +3 -0
  31. data/lib/puppet/feature/selinux.rb +3 -0
  32. data/lib/puppet/feature/zlib.rb +6 -0
  33. data/lib/puppet/file_serving/base.rb +16 -1
  34. data/lib/puppet/file_serving/metadata.rb +46 -9
  35. data/lib/puppet/file_serving/mount/file.rb +4 -1
  36. data/lib/puppet/indirector/catalog/active_record.rb +5 -0
  37. data/lib/puppet/indirector/envelope.rb +1 -3
  38. data/lib/puppet/indirector/indirection.rb +13 -16
  39. data/lib/puppet/indirector/node/ldap.rb +7 -4
  40. data/lib/puppet/indirector/ssl_file.rb +1 -1
  41. data/lib/puppet/network/authstore.rb +48 -118
  42. data/lib/puppet/network/client/resource.rb +2 -15
  43. data/lib/puppet/network/format.rb +2 -12
  44. data/lib/puppet/network/format_handler.rb +15 -1
  45. data/lib/puppet/network/formats.rb +19 -4
  46. data/lib/puppet/network/handler/fileserver.rb +1 -0
  47. data/lib/puppet/network/http/handler.rb +1 -0
  48. data/lib/puppet/network/http/rack/httphandler.rb +0 -18
  49. data/lib/puppet/network/http/rack/rest.rb +4 -4
  50. data/lib/puppet/network/http/rack/xmlrpc.rb +4 -4
  51. data/lib/puppet/network/http/webrick.rb +2 -1
  52. data/lib/puppet/network/server.rb +1 -1
  53. data/lib/puppet/node/environment.rb +20 -9
  54. data/lib/puppet/parameter.rb +17 -1
  55. data/lib/puppet/parser/ast/boolean_operator.rb +2 -2
  56. data/lib/puppet/parser/ast/leaf.rb +5 -1
  57. data/lib/puppet/parser/ast/resourceparam.rb +4 -0
  58. data/lib/puppet/parser/ast/selector.rb +4 -0
  59. data/lib/puppet/parser/functions/generate.rb +2 -2
  60. data/lib/puppet/parser/functions/shellquote.rb +1 -1
  61. data/lib/puppet/property.rb +3 -11
  62. data/lib/puppet/provider/cron/crontab.rb +2 -0
  63. data/lib/puppet/provider/host/parsed.rb +9 -9
  64. data/lib/puppet/provider/package/blastwave.rb +7 -6
  65. data/lib/puppet/provider/package/portage.rb +23 -27
  66. data/lib/puppet/provider/package/rug.rb +1 -1
  67. data/lib/puppet/provider/package/sun.rb +5 -3
  68. data/lib/puppet/provider/service/daemontools.rb +1 -1
  69. data/lib/puppet/provider/service/debian.rb +1 -1
  70. data/lib/puppet/provider/service/runit.rb +1 -1
  71. data/lib/puppet/provider/ssh_authorized_key/parsed.rb +2 -1
  72. data/lib/puppet/provider/sshkey/parsed.rb +3 -5
  73. data/lib/puppet/provider/zone/solaris.rb +1 -1
  74. data/lib/puppet/rails.rb +9 -2
  75. data/lib/puppet/rails/benchmark.rb +1 -1
  76. data/lib/puppet/rails/host.rb +2 -7
  77. data/lib/puppet/rails/resource.rb +20 -26
  78. data/lib/puppet/resource/catalog.rb +3 -3
  79. data/lib/puppet/resource/reference.rb +13 -25
  80. data/lib/puppet/ssl/certificate.rb +3 -2
  81. data/lib/puppet/ssl/host.rb +14 -33
  82. data/lib/puppet/sslcertificates.rb +1 -5
  83. data/lib/puppet/sslcertificates/ca.rb +8 -7
  84. data/lib/puppet/transaction.rb +15 -12
  85. data/lib/puppet/type.rb +12 -5
  86. data/lib/puppet/type/file.rb +26 -32
  87. data/lib/puppet/type/file/content.rb +5 -5
  88. data/lib/puppet/type/file/ensure.rb +6 -17
  89. data/lib/puppet/type/file/mode.rb +18 -1
  90. data/lib/puppet/type/file/source.rb +12 -12
  91. data/lib/puppet/type/host.rb +6 -9
  92. data/lib/puppet/type/k5login.rb +1 -1
  93. data/lib/puppet/type/maillist.rb +4 -7
  94. data/lib/puppet/type/port.rb +6 -5
  95. data/lib/puppet/type/resources.rb +12 -12
  96. data/lib/puppet/type/sshkey.rb +5 -5
  97. data/lib/puppet/type/tidy.rb +9 -2
  98. data/lib/puppet/type/yumrepo.rb +3 -1
  99. data/lib/puppet/util.rb +64 -56
  100. data/lib/puppet/util/backups.rb +2 -1
  101. data/lib/puppet/util/filetype.rb +46 -0
  102. data/lib/puppet/util/log.rb +10 -18
  103. data/lib/puppet/util/log_paths.rb +14 -0
  104. data/lib/puppet/util/methodhelper.rb +3 -4
  105. data/lib/puppet/util/monkey_patches.rb +8 -0
  106. data/lib/puppet/util/rdoc/generators/puppet_generator.rb +5 -3
  107. data/lib/puppet/util/rdoc/parser.rb +32 -16
  108. data/lib/puppet/util/reference.rb +6 -3
  109. data/lib/puppet/util/selinux.rb +21 -14
  110. data/lib/puppet/util/settings.rb +30 -25
  111. data/lib/puppet/util/settings/file_setting.rb +7 -4
  112. data/lib/puppet/util/subclass_loader.rb +1 -1
  113. data/lib/puppet/util/suidmanager.rb +11 -1
  114. data/lib/puppet/util/tagging.rb +22 -4
  115. data/man/man8/filebucket.8 +23 -18
  116. data/man/man8/pi.8 +42 -20
  117. data/man/man8/puppet.8 +47 -32
  118. data/man/man8/puppet.conf.8 +807 -764
  119. data/man/man8/puppetca.8 +24 -14
  120. data/man/man8/puppetd.8 +33 -16
  121. data/man/man8/puppetdoc.8 +71 -18
  122. data/man/man8/puppetmasterd.8 +18 -25
  123. data/man/man8/puppetqd.8 +60 -0
  124. data/man/man8/puppetrun.8 +27 -14
  125. data/man/man8/ralsh.8 +33 -40
  126. data/spec/integration/bin/puppetmasterd.rb +3 -2
  127. data/spec/integration/defaults.rb +11 -0
  128. data/spec/integration/file_serving/metadata.rb +1 -0
  129. data/spec/integration/indirector/file_content/file_server.rb +2 -1
  130. data/spec/integration/ssl/certificate_request.rb +2 -0
  131. data/spec/integration/type/file.rb +20 -1
  132. data/spec/shared_behaviours/file_serving.rb +1 -1
  133. data/spec/spec_helper.rb +1 -1
  134. data/spec/unit/application/puppet.rb +11 -30
  135. data/spec/unit/application/puppetd.rb +1 -0
  136. data/spec/unit/application/puppetdoc.rb +13 -4
  137. data/spec/unit/application/puppetmasterd.rb +1 -0
  138. data/spec/unit/application/puppetrun.rb +12 -2
  139. data/spec/unit/application/ralsh.rb +39 -22
  140. data/spec/unit/configurer.rb +6 -0
  141. data/spec/unit/configurer/fact_handler.rb +15 -1
  142. data/spec/unit/file_serving/metadata.rb +128 -16
  143. data/spec/unit/file_serving/mount/file.rb +8 -0
  144. data/spec/unit/indirector/catalog/active_record.rb +20 -1
  145. data/spec/unit/indirector/catalog/compiler.rb +2 -1
  146. data/spec/unit/indirector/indirection.rb +29 -18
  147. data/spec/unit/indirector/node/ldap.rb +20 -6
  148. data/spec/unit/network/authstore.rb +197 -0
  149. data/spec/unit/network/format_handler.rb +28 -8
  150. data/spec/unit/network/formats.rb +31 -0
  151. data/spec/unit/network/http/handler.rb +10 -0
  152. data/spec/unit/network/http/webrick.rb +2 -2
  153. data/spec/unit/network/rest_authconfig.rb +2 -2
  154. data/spec/unit/network/rights.rb +1 -1
  155. data/spec/unit/node/environment.rb +39 -23
  156. data/spec/unit/other/selinux.rb +2 -2
  157. data/spec/unit/parameter.rb +8 -0
  158. data/spec/unit/parser/ast/leaf.rb +9 -0
  159. data/spec/unit/parser/ast/selector.rb +8 -1
  160. data/spec/unit/parser/lexer.rb +1 -1
  161. data/spec/unit/parser/resource.rb +11 -0
  162. data/spec/unit/parser/resource/reference.rb +13 -1
  163. data/spec/unit/property.rb +6 -0
  164. data/spec/unit/provider/mount/parsed.rb +3 -1
  165. data/spec/unit/provider/service/debian.rb +1 -1
  166. data/spec/unit/provider/ssh_authorized_key/parsed.rb +9 -1
  167. data/spec/unit/provider/sshkey/parsed.rb +19 -0
  168. data/spec/unit/rails.rb +22 -9
  169. data/spec/unit/rails/resource.rb +20 -0
  170. data/spec/unit/ssl/host.rb +19 -57
  171. data/spec/unit/transaction.rb +39 -4
  172. data/spec/unit/type.rb +9 -0
  173. data/spec/unit/type/file/content.rb +29 -0
  174. data/spec/unit/type/maillist.rb +42 -0
  175. data/spec/unit/type/resources.rb +66 -1
  176. data/spec/unit/type/tidy.rb +14 -1
  177. data/spec/unit/util/autoload.rb +2 -0
  178. data/spec/unit/util/ldap/connection.rb +1 -1
  179. data/spec/unit/util/log.rb +14 -0
  180. data/spec/unit/util/monkey_patches.rb +103 -0
  181. data/spec/unit/util/queue.rb +10 -2
  182. data/spec/unit/util/selinux.rb +61 -2
  183. data/spec/unit/util/settings.rb +19 -0
  184. data/spec/unit/util/settings/file_setting.rb +25 -0
  185. data/spec/unit/util/tagging.rb +10 -0
  186. data/tasks/rake/changelog.rake +15 -0
  187. data/tasks/rake/ci.rake +22 -0
  188. data/tasks/rake/dailybuild.rake +9 -0
  189. data/tasks/rake/gem.rake +46 -0
  190. data/tasks/rake/git_workflow.rake +121 -0
  191. data/tasks/rake/metrics.rake +6 -0
  192. data/tasks/rake/sign.rake +14 -0
  193. data/tasks/rake/testbranch.rake +16 -0
  194. data/tasks/rake/tracdocs.rake +8 -0
  195. data/test/data/providers/ssh_authorized_key/parsed/authorized_keys +1 -0
  196. metadata +1042 -1288
  197. data/ext/bin/sleeper +0 -67
  198. data/ext/module_puppet +0 -209
@@ -27,25 +27,12 @@ class Puppet::Network::Client::Resource < Puppet::Network::Client
27
27
  def describe(type, name, retrieve = false, ignore = false)
28
28
  Puppet.info "Describing %s[%s]" % [type.to_s.capitalize, name]
29
29
  text = @driver.describe(type, name, retrieve, ignore, "yaml")
30
-
31
- object = nil
32
- if @local
33
- object = text
34
- else
35
- object = YAML::load(Base64.decode64(text))
36
- end
37
-
38
- return object
30
+ @local ? text : YAML::load(Base64.decode64(text))
39
31
  end
40
32
 
41
33
  def list(type, ignore = false, base = false)
42
34
  bucket = @driver.list(type, ignore, base, "yaml")
43
-
44
- unless @local
45
- bucket = YAML::load(Base64.decode64(bucket))
46
- end
47
-
48
- return bucket
35
+ @local ? bucket : YAML::load(Base64.decode64(bucket))
49
36
  end
50
37
  end
51
38
 
@@ -107,17 +107,7 @@ class Puppet::Network::Format
107
107
 
108
108
  method = send(name)
109
109
 
110
- if type == :class
111
- has_method = klass.respond_to?(method)
112
- message = "has not implemented method '%s'" % method
113
- else
114
- has_method = klass.instance_methods.include?(method)
115
- message = "has not implemented instance method '%s'" % method
116
- end
117
-
118
- return true if has_method
119
-
120
- Puppet.debug "Format %s not supported for %s; %s" % [self.name, klass, message]
121
- return false
110
+ return klass.respond_to?(method) if type == :class
111
+ return klass.instance_methods.include?(method)
122
112
  end
123
113
  end
@@ -119,16 +119,30 @@ module Puppet::Network::FormatHandler
119
119
  format_handler.format(b).weight <=> format_handler.format(a).weight
120
120
  end
121
121
 
122
- put_preferred_format_first(result)
122
+ result = put_preferred_format_first(result)
123
+
124
+ Puppet.debug "#{friendly_name} supports formats: #{result.map{ |f| f.to_s }.sort.join(' ')}; using #{result.first}"
125
+
126
+ result
123
127
  end
124
128
 
125
129
  private
126
130
 
131
+ def friendly_name
132
+ if self.respond_to? :indirection
133
+ indirection.name
134
+ else
135
+ self
136
+ end
137
+ end
138
+
127
139
  def put_preferred_format_first(list)
128
140
  preferred_format = Puppet.settings[:preferred_serialization_format].to_sym
129
141
  if list.include?(preferred_format)
130
142
  list.delete(preferred_format)
131
143
  list.unshift(preferred_format)
144
+ else
145
+ Puppet.warning "Value of 'preferred_serialization_format' (#{preferred_format}) is invalid for #{friendly_name}, using default (#{list.first})"
132
146
  end
133
147
  list
134
148
  end
@@ -44,7 +44,18 @@ end
44
44
  # This format combines a yaml serialization, then zlib compression and base64 encoding.
45
45
  Puppet::Network::FormatHandler.create(:b64_zlib_yaml, :mime => "text/b64_zlib_yaml") do
46
46
  require 'base64'
47
- require 'zlib'
47
+
48
+ def use_zlib?
49
+ Puppet.features.zlib? && Puppet[:zlib]
50
+ end
51
+
52
+ def requiring_zlib
53
+ if use_zlib?
54
+ yield
55
+ else
56
+ raise Puppet::Error, "the zlib library is not installed or is disabled."
57
+ end
58
+ end
48
59
 
49
60
  def intern(klass, text)
50
61
  decode(text)
@@ -70,7 +81,7 @@ Puppet::Network::FormatHandler.create(:b64_zlib_yaml, :mime => "text/b64_zlib_ya
70
81
 
71
82
  # Because of yaml issue in ruby 1.8.1...
72
83
  def supported?(klass)
73
- RUBY_VERSION != '1.8.1'
84
+ RUBY_VERSION != '1.8.1' and use_zlib?
74
85
  end
75
86
 
76
87
  # fixup invalid yaml as per:
@@ -81,11 +92,15 @@ Puppet::Network::FormatHandler.create(:b64_zlib_yaml, :mime => "text/b64_zlib_ya
81
92
  end
82
93
 
83
94
  def encode(text)
84
- Base64.encode64(Zlib::Deflate.deflate(text, Zlib::BEST_COMPRESSION))
95
+ requiring_zlib do
96
+ Base64.encode64(Zlib::Deflate.deflate(text, Zlib::BEST_COMPRESSION))
97
+ end
85
98
  end
86
99
 
87
100
  def decode(yaml)
88
- YAML.load(Zlib::Inflate.inflate(Base64.decode64(yaml)))
101
+ requiring_zlib do
102
+ YAML.load(Zlib::Inflate.inflate(Base64.decode64(yaml)))
103
+ end
89
104
  end
90
105
  end
91
106
 
@@ -310,6 +310,7 @@ class Puppet::Network::Handler
310
310
  mount.info "allowing %s access" % val
311
311
  mount.allow(val)
312
312
  rescue AuthStoreError => detail
313
+ puts detail.backtrace if Puppet[:trace]
313
314
  raise FileServerError.new(detail.to_s,
314
315
  count, @configuration.file)
315
316
  end
@@ -97,6 +97,7 @@ module Puppet::Network::HTTP::Handler
97
97
  # Execute our find.
98
98
  def do_find(indirection_request, request, response)
99
99
  unless result = indirection_request.model.find(indirection_request.key, indirection_request.to_hash)
100
+ Puppet.info("Could not find %s for '%s'" % [indirection_request.indirection_name, indirection_request.key])
100
101
  return do_exception(response, "Could not find %s %s" % [indirection_request.indirection_name, indirection_request.key], 404)
101
102
  end
102
103
 
@@ -12,23 +12,5 @@ class Puppet::Network::HTTP::RackHttpHandler
12
12
  raise NotImplementedError, "Your RackHttpHandler subclass is supposed to override service(request)"
13
13
  end
14
14
 
15
- def ssl_client_header(request)
16
- env_or_request_env(Puppet[:ssl_client_header], request)
17
- end
18
-
19
- def ssl_client_verify_header(request)
20
- env_or_request_env(Puppet[:ssl_client_verify_header], request)
21
- end
22
-
23
- # Older Passenger versions passed all Environment vars in app(env),
24
- # but since 2.2.3 they (some?) are really in ENV.
25
- # Mongrel, etc. may also still use request.env.
26
- def env_or_request_env(var, request)
27
- if ENV.include?(var)
28
- ENV[var]
29
- else
30
- request.env[var]
31
- end
32
- end
33
15
  end
34
16
 
@@ -63,11 +63,11 @@ class Puppet::Network::HTTP::RackREST < Puppet::Network::HTTP::RackHttpHandler
63
63
  result[:ip] = request.ip
64
64
 
65
65
  # if we find SSL info in the headers, use them to get a hostname.
66
- # try this with :ssl_client_header.
67
- # For Apache you need special configuration, see ext/rack/README.
68
- if dn = ssl_client_header(request) and dn_matchdata = dn.match(/^.*?CN\s*=\s*(.*)/)
66
+ # try this with :ssl_client_header, which defaults should work for
67
+ # Apache with StdEnvVars.
68
+ if dn = request.env[Puppet[:ssl_client_header]] and dn_matchdata = dn.match(/^.*?CN\s*=\s*(.*)/)
69
69
  result[:node] = dn_matchdata[1].to_str
70
- result[:authenticated] = (ssl_client_verify_header(request) == 'SUCCESS')
70
+ result[:authenticated] = (request.env[Puppet[:ssl_client_verify_header]] == 'SUCCESS')
71
71
  else
72
72
  result[:node] = resolve_node(result)
73
73
  result[:authenticated] = false
@@ -43,11 +43,11 @@ class Puppet::Network::HTTP::RackXMLRPC < Puppet::Network::HTTP::RackHttpHandler
43
43
  ip = request.ip
44
44
 
45
45
  # if we find SSL info in the headers, use them to get a hostname.
46
- # try this with :ssl_client_header.
47
- # For Apache you need special configuration, see ext/rack/README.
48
- if dn = ssl_client_header(request) and dn_matchdata = dn.match(/^.*?CN\s*=\s*(.*)/)
46
+ # try this with :ssl_client_header, which defaults should work for
47
+ # Apache with StdEnvVars.
48
+ if dn = request.env[Puppet[:ssl_client_header]] and dn_matchdata = dn.match(/^.*?CN\s*=\s*(.*)/)
49
49
  node = dn_matchdata[1].to_str
50
- authenticated = (ssl_client_verify_header(request) == 'SUCCESS')
50
+ authenticated = (request.env[Puppet[:ssl_client_verify_header]] == 'SUCCESS')
51
51
  else
52
52
  begin
53
53
  node = Resolv.getname(ip)
@@ -44,7 +44,8 @@ class Puppet::Network::HTTP::WEBrick
44
44
  sock.accept
45
45
  @server.run(sock)
46
46
  }
47
- }
47
+ }
48
+ sleep 0.1 until @server.status == :Running
48
49
  end
49
50
  end
50
51
 
@@ -22,7 +22,7 @@ class Puppet::Network::Server
22
22
  $stderr.reopen $stdout
23
23
  Puppet::Util::Log.reopen
24
24
  rescue => detail
25
- File.open("/tmp/daemonout", "w") { |f|
25
+ Puppet::Util.secure_open("/tmp/daemonout", "w") { |f|
26
26
  f.puts "Could not start %s: %s" % [Puppet[:name], detail]
27
27
  }
28
28
  raise "Could not start %s: %s" % [Puppet[:name], detail]
@@ -55,15 +55,7 @@ class Puppet::Node::Environment
55
55
  if ENV["PUPPETLIB"]
56
56
  dirs = ENV["PUPPETLIB"].split(File::PATH_SEPARATOR) + dirs
57
57
  end
58
- dirs.collect do |dir|
59
- if dir !~ /^#{File::SEPARATOR}/
60
- File.join(Dir.getwd, dir)
61
- else
62
- dir
63
- end
64
- end.find_all do |p|
65
- p =~ /^#{File::SEPARATOR}/ && FileTest.directory?(p)
66
- end
58
+ validate_dirs(dirs)
67
59
  end
68
60
 
69
61
  # Return all modules from this environment.
@@ -73,7 +65,26 @@ class Puppet::Node::Environment
73
65
  module_names.collect { |path| Puppet::Module.new(path, self) rescue nil }.compact
74
66
  end
75
67
 
68
+ # Cache the manifestdir, so that we aren't searching through
69
+ # all known directories all the time.
70
+ cached_attr(:manifestdir, :ttl => Puppet[:filetimeout]) do
71
+ validate_dirs(self[:manifestdir].split(File::PATH_SEPARATOR))
72
+ end
73
+
76
74
  def to_s
77
75
  name.to_s
78
76
  end
77
+
78
+ def validate_dirs(dirs)
79
+ dirs.collect do |dir|
80
+ if dir !~ /^#{File::SEPARATOR}/
81
+ File.join(Dir.getwd, dir)
82
+ else
83
+ dir
84
+ end
85
+ end.find_all do |p|
86
+ p =~ /^#{File::SEPARATOR}/ && FileTest.directory?(p)
87
+ end
88
+ end
89
+
79
90
  end
@@ -293,6 +293,13 @@ class Puppet::Parameter
293
293
  define_method(:unmunge, &block)
294
294
  end
295
295
 
296
+ # Optionaly convert the value to a canonical form so that it will
297
+ # be found in hashes, etc. Mostly useful for namevars.
298
+ def to_canonicalize(&block)
299
+ metaclass = (class << self; self; end)
300
+ metaclass.send(:define_method,:canonicalize,&block)
301
+ end
302
+
296
303
  # Mark whether we're the namevar.
297
304
  def isnamevar
298
305
  @isnamevar = true
@@ -464,10 +471,19 @@ class Puppet::Parameter
464
471
  value
465
472
  end
466
473
 
474
+ # Assume the value is already in canonical form by default
475
+ def self.canonicalize(value)
476
+ value
477
+ end
478
+
479
+ def canonicalize(value)
480
+ self.class.canonicalize(value)
481
+ end
482
+
467
483
  # A wrapper around our munging that makes sure we raise useful exceptions.
468
484
  def munge(value)
469
485
  begin
470
- ret = unsafe_munge(value)
486
+ ret = unsafe_munge(canonicalize(value))
471
487
  rescue Puppet::Error => detail
472
488
  Puppet.debug "Reraising %s" % detail
473
489
  raise
@@ -20,14 +20,14 @@ class Puppet::Parser::AST
20
20
  # return result
21
21
  # lazy evaluate right operand
22
22
  case @operator
23
- when "and";
23
+ when "and"
24
24
  if Puppet::Parser::Scope.true?(lval)
25
25
  rval = @rval.safeevaluate(scope)
26
26
  Puppet::Parser::Scope.true?(rval)
27
27
  else # false and false == false
28
28
  false
29
29
  end
30
- when "or";
30
+ when "or"
31
31
  if Puppet::Parser::Scope.true?(lval)
32
32
  true
33
33
  else
@@ -101,7 +101,7 @@ class Puppet::Parser::AST
101
101
  end
102
102
  end
103
103
 
104
- def to_classname
104
+ def to_classname(dummy_argument=:work_arround_for_ruby_GC_bug)
105
105
  to_s.downcase.gsub(/[^-\w:.]/,'').sub(/^\.+/,'')
106
106
  end
107
107
 
@@ -150,6 +150,10 @@ class Puppet::Parser::AST
150
150
  return scope.lookupvar(@value)
151
151
  end
152
152
  end
153
+
154
+ def to_s
155
+ "\$#{value}"
156
+ end
153
157
  end
154
158
 
155
159
  class Regex < AST::Leaf
@@ -18,5 +18,9 @@ class Puppet::Parser::AST
18
18
  :add => self.add
19
19
  )
20
20
  end
21
+
22
+ def to_s
23
+ "#{@param} => #{@value.to_s}"
24
+ end
21
25
  end
22
26
  end
@@ -41,5 +41,9 @@ class Puppet::Parser::AST
41
41
  ensure
42
42
  scope.unset_ephemeral_var
43
43
  end
44
+
45
+ def to_s
46
+ param.to_s + " ? { " + values.collect { |v| v.to_s }.join(', ') + " }"
47
+ end
44
48
  end
45
49
  end
@@ -1,7 +1,7 @@
1
1
  # Runs an external command and returns the results
2
2
  Puppet::Parser::Functions::newfunction(:generate, :type => :rvalue,
3
- :doc => "Calls an external command and returns the results of the
4
- command. Any arguments are passed to the external command as
3
+ :doc => "Calls an external command on the Puppet master and returns
4
+ the results of the command. Any arguments are passed to the external command as
5
5
  arguments. If the generator does not exit with return code of 0,
6
6
  the generator is considered to have failed and a parse error is
7
7
  thrown. Generators can only have file separators, alphanumerics, dashes,
@@ -10,7 +10,7 @@ module Puppet::Parser::Functions
10
10
  with spaces. If an argument is an array, the elements of that
11
11
  array is interpolated within the rest of the arguments; this makes
12
12
  it possible to have an array of arguments and pass that array to
13
- shellquote() instead of having to specify specify each argument
13
+ shellquote() instead of having to specify each argument
14
14
  individually in the call.
15
15
  ") \
16
16
  do |args|
@@ -355,20 +355,12 @@ class Puppet::Property < Puppet::Parameter
355
355
  end
356
356
 
357
357
  def should_to_s(newvalue)
358
- newvalue = [newvalue] unless newvalue.is_a? Array
359
- if defined? newvalue
360
- newvalue.join(" ")
361
- else
362
- return nil
363
- end
358
+ [newvalue].flatten.join(" ")
364
359
  end
365
360
 
366
361
  def sync
367
- if value = self.should
368
- set(value)
369
- else
370
- self.devfail "Got a nil value for should"
371
- end
362
+ devfail "Got a nil value for should" unless should
363
+ set(should)
372
364
  end
373
365
 
374
366
  def to_s
@@ -3,6 +3,8 @@ require 'puppet/provider/parsedfile'
3
3
  tab = case Facter.value(:operatingsystem)
4
4
  when "Solaris"
5
5
  :suntab
6
+ when "AIX"
7
+ :aixtab
6
8
  else
7
9
  :crontab
8
10
  end
@@ -17,8 +17,8 @@ Puppet::Type.type(:host).provide(:parsed,
17
17
  text_line :comment, :match => /^#/
18
18
  text_line :blank, :match => /^\s*$/
19
19
 
20
- record_line :parsed, :fields => %w{ip name alias},
21
- :optional => %w{alias},
20
+ record_line :parsed, :fields => %w{ip name host_aliases},
21
+ :optional => %w{host_aliases},
22
22
  :rts => true do |line|
23
23
  hash = {}
24
24
  if line.sub!(/^(\S+)\s+(\S+)\s*/, '')
@@ -30,7 +30,7 @@ Puppet::Type.type(:host).provide(:parsed,
30
30
  line.sub!(/^([^#]+)\s*/) do |value|
31
31
  aliases = $1
32
32
  unless aliases =~ /^\s*$/
33
- hash[:alias] = aliases.split(/\s+/)
33
+ hash[:host_aliases] = aliases.split(/\s+/)
34
34
  end
35
35
 
36
36
  ""
@@ -40,8 +40,8 @@ Puppet::Type.type(:host).provide(:parsed,
40
40
  raise Puppet::Error, "Could not match '%s'" % line
41
41
  end
42
42
 
43
- if hash[:alias] == ""
44
- hash.delete(:alias)
43
+ if hash[:host_aliases] == ""
44
+ hash.delete(:host_aliases)
45
45
  end
46
46
 
47
47
  return hash
@@ -58,11 +58,11 @@ Puppet::Type.type(:host).provide(:parsed,
58
58
 
59
59
  str = "%s\t%s" % [hash[:ip], hash[:name]]
60
60
 
61
- if hash.include? :alias
62
- if hash[:alias].is_a? Array
63
- str += "\t%s" % hash[:alias].join("\t")
61
+ if hash.include? :host_aliases
62
+ if hash[:host_aliases].is_a? Array
63
+ str += "\t%s" % hash[:host_aliases].join("\t")
64
64
  else
65
- raise ArgumentError, "Aliases must be specified as an array"
65
+ raise ArgumentError, "Host aliases must be specified as an array"
66
66
  end
67
67
  end
68
68