puppet 4.2.1-x86-mingw32 → 4.2.2-x86-mingw32

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 (40) hide show
  1. data/Rakefile +20 -0
  2. data/ext/osx/puppet.plist +2 -2
  3. data/ext/solaris/smf/puppet +44 -0
  4. data/ext/solaris/smf/puppet.xml +44 -0
  5. data/ext/suse/client.init +2 -2
  6. data/ext/suse/server.init +2 -2
  7. data/install.rb +21 -39
  8. data/lib/puppet/application/cert.rb +16 -0
  9. data/lib/puppet/configurer.rb +2 -2
  10. data/lib/puppet/defaults.rb +2 -1
  11. data/lib/puppet/file_system/windows.rb +3 -1
  12. data/lib/puppet/parser/compiler.rb +1 -3
  13. data/lib/puppet/parser/functions/inline_template.rb +2 -2
  14. data/lib/puppet/parser/resource.rb +13 -10
  15. data/lib/puppet/pops/evaluator/evaluator_impl.rb +5 -1
  16. data/lib/puppet/pops/issues.rb +4 -0
  17. data/lib/puppet/pops/model/factory.rb +4 -3
  18. data/lib/puppet/pops/model/model_meta.rb +4 -1
  19. data/lib/puppet/pops/parser/egrammar.ra +10 -0
  20. data/lib/puppet/pops/parser/eparser.rb +1279 -1148
  21. data/lib/puppet/pops/parser/lexer2.rb +6 -0
  22. data/lib/puppet/pops/validation/checker4_0.rb +17 -1
  23. data/lib/puppet/pops/validation/validator_factory_4_0.rb +3 -1
  24. data/lib/puppet/provider/exec.rb +6 -1
  25. data/lib/puppet/provider/package/yum.rb +9 -3
  26. data/lib/puppet/provider/service/launchd.rb +36 -7
  27. data/lib/puppet/provider/service/systemd.rb +10 -2
  28. data/lib/puppet/reference/configuration.rb +10 -4
  29. data/lib/puppet/type/package.rb +9 -6
  30. data/lib/puppet/util/execution.rb +18 -2
  31. data/lib/puppet/version.rb +1 -1
  32. data/spec/unit/file_system_spec.rb +20 -0
  33. data/spec/unit/pops/parser/lexer2_spec.rb +13 -0
  34. data/spec/unit/pops/validator/validator_spec.rb +24 -0
  35. data/spec/unit/provider/package/yum_spec.rb +15 -0
  36. data/spec/unit/provider/service/launchd_spec.rb +85 -10
  37. data/spec/unit/provider/service/systemd_spec.rb +1 -0
  38. data/spec/unit/type/exec_spec.rb +16 -8
  39. metadata +3053 -3029
  40. checksums.yaml +0 -7
data/Rakefile CHANGED
@@ -75,3 +75,23 @@ task(:rubocop) do
75
75
  raise "RuboCop detected offenses" if exit_code != 0
76
76
  end
77
77
 
78
+ desc "verify that commit messages match CONTRIBUTING.md requirements"
79
+ task(:commits) do
80
+ # This git command looks at the summary from every commit from this branch not in master.
81
+ # Ideally this would compare against the branch that a PR is submitted against, but I don't
82
+ # know how to get that information. Absent that, comparing with master should work in most cases.
83
+ %x{git log --no-merges --pretty=%s master..$HEAD}.each_line do |commit_summary|
84
+ # This regex tests for the currently supported commit summary tokens: maint, doc, packaging, or pup-<number>.
85
+ # The exception tries to explain it in more full.
86
+ if /^\((maint|doc|docs|packaging|pup-\d+)\)|revert/i.match(commit_summary).nil?
87
+ raise "\n\n\n\tThis commit summary didn't match CONTRIBUTING.md guidelines:\n" \
88
+ "\n\t\t#{commit_summary}\n" \
89
+ "\tThe commit summary (i.e. the first line of the commit message) should start with one of:\n" \
90
+ "\t\t(pup-<digits>) # this is most common and should be a ticket at tickets.puppetlabs.com\n" \
91
+ "\t\t(docs)\n" \
92
+ "\t\t(maint)\n" \
93
+ "\t\t(packaging)\n" \
94
+ "\n\tThis test for the commit summary is case-insensitive.\n\n\n"
95
+ end
96
+ end
97
+ end
data/ext/osx/puppet.plist CHANGED
@@ -25,8 +25,8 @@
25
25
  <key>RunAtLoad</key>
26
26
  <true/>
27
27
  <key>StandardErrorPath</key>
28
- <string>/var/log/puppetlabs/puppet/puppet.log</string>
28
+ <string>/var/log/puppetlabs/puppet/puppet.log</string>
29
29
  <key>StandardOutPath</key>
30
- <string>/var/log/puppetlabs/puppet/puppet.log</string>
30
+ <string>/var/log/puppetlabs/puppet/puppet.log</string>
31
31
  </dict>
32
32
  </plist>
@@ -0,0 +1,44 @@
1
+ #!/sbin/sh
2
+
3
+ . /lib/svc/share/smf_include.sh
4
+
5
+ [ -z "${SMF_FMRI}" ] && exit $SMF_EXIT_ERR
6
+
7
+ CONF_FILE=/etc/puppetlabs/puppet/puppet.conf
8
+ [ ! -f "${CONF_FILE}" ] && exit $SMF_EXIT_ERR_CONFIG
9
+
10
+ PUPPET=/opt/puppetlabs/bin/puppet
11
+
12
+ case "$1" in
13
+ start)
14
+ exec $PUPPET agent
15
+ ;;
16
+
17
+ stop)
18
+ # stop sends sigterm first followed by sigkill
19
+ # smf_kill_contract <CTID> TERM 1 30
20
+ # sends sigterm to all process in ctid and will continue
21
+ # to do so for 30 seconds with interval of 5 seconds
22
+ # smf_kill_contract <CTID> KILL 1
23
+ # continues until all processes are killed.
24
+ # svcs -p <fmri> lists all processes in the contract.
25
+ # http://bnsmb.de/solaris/My_Little_SMF_FAQ.html
26
+ ctid=`svcprop -p restarter/contract $SMF_FMRI`
27
+ if [ -n "$ctid" ]; then
28
+ smf_kill_contract $ctid TERM 1 30
29
+ ret=$?
30
+ [ $ret -eq 1 ] && exit $SMF_EXIT_ERR_FATAL
31
+
32
+ if [ $ret -eq 2 ] ; then
33
+ smf_kill_contract $ctid KILL 1
34
+ [ $? -ne 0 ] && exit $SMF_EXIT_ERR_FATAL
35
+ fi
36
+ fi
37
+ ;;
38
+ *)
39
+ echo "Usage: $0 {start|stop}";
40
+ exit $SMF_EXIT_ERR_FATAL
41
+ ;;
42
+ esac
43
+ exit $SMF_EXIT_OK
44
+
@@ -0,0 +1,44 @@
1
+ <?xml version="1.0"?>
2
+ <!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
3
+ <!-- Original puppet manifest: Luke Kanies - puppetlabs.com -->
4
+ <service_bundle type="manifest" name="puppet">
5
+
6
+ <service name="network/puppet" type="service" version="1">
7
+
8
+ <create_default_instance enabled="false"/>
9
+ <single_instance/>
10
+
11
+ <dependency name="config-file" grouping="require_all" restart_on="none" type="path">
12
+ <service_fmri value="file:///etc/puppetlabs/puppet/puppet.conf"/>
13
+ </dependency>
14
+
15
+ <dependency name="loopback" grouping="require_all" restart_on="error" type="service">
16
+ <service_fmri value="svc:/network/loopback:default"/>
17
+ </dependency>
18
+
19
+ <dependency name="physical" grouping="require_all" restart_on="error" type="service">
20
+ <service_fmri value="svc:/network/physical:default"/>
21
+ </dependency>
22
+
23
+ <dependency name="fs-local" grouping="require_all" restart_on="none" type="service">
24
+ <service_fmri value="svc:/system/filesystem/local"/>
25
+ </dependency>
26
+
27
+ <exec_method type="method" name="start" exec="/lib/svc/method/puppet start" timeout_seconds="60"/>
28
+
29
+ <exec_method type="method" name="stop" exec="/lib/svc/method/puppet stop" timeout_seconds="60"/>
30
+
31
+ <stability value="Evolving"/>
32
+
33
+ <template>
34
+ <common_name>
35
+ <loctext xml:lang="C">Puppet Agent Daemon</loctext>
36
+ </common_name>
37
+ <documentation>
38
+ <manpage title="puppet" section="1"/>
39
+ <doc_link name="puppetlabs.com" uri="http://puppetlabs.com/puppet/introduction"/>
40
+ </documentation>
41
+ </template>
42
+ </service>
43
+
44
+ </service_bundle>
data/ext/suse/client.init CHANGED
@@ -87,7 +87,7 @@ case "$1" in
87
87
  # Remember status and be verbose
88
88
  rc_status -v
89
89
  ;;
90
- try-restart)
90
+ try-restart|condrestart)
91
91
  ## Stop the service and if this succeeds (i.e. the
92
92
  ## service was running before), start it again.
93
93
  $0 status >/dev/null && $0 restart
@@ -148,7 +148,7 @@ case "$1" in
148
148
  $puppetd "${PUPPET_OPTS}" --onetime "${PUPPET_EXTRA_OPTS}" $@
149
149
  ;;
150
150
  *)
151
- echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|once}"
151
+ echo "Usage: $0 {start|stop|status|try-restart|condrestart|restart|force-reload|reload|once}"
152
152
  exit 1
153
153
  esac
154
154
  rc_exit
data/ext/suse/server.init CHANGED
@@ -115,7 +115,7 @@ case "$1" in
115
115
  # Remember status and be verbose
116
116
  rc_status -v
117
117
  ;;
118
- try-restart)
118
+ try-restart|condrestart)
119
119
  ## Stop the service and if this succeeds (i.e. the
120
120
  ## service was running before), start it again.
121
121
  $0 status >/dev/null && $0 restart
@@ -167,7 +167,7 @@ case "$1" in
167
167
  rc_status -v
168
168
  ;;
169
169
  *)
170
- echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}"
170
+ echo "Usage: $0 {start|stop|status|try-restart|condrestart|restart|force-reload|reload}"
171
171
  exit 1
172
172
  esac
173
173
  rc_exit
data/install.rb CHANGED
@@ -33,13 +33,6 @@ require 'rbconfig'
33
33
  require 'find'
34
34
  require 'fileutils'
35
35
  require 'tempfile'
36
- begin
37
- require 'ftools' # apparently on some system ftools doesn't get loaded
38
- $haveftools = true
39
- rescue LoadError
40
- puts "ftools not found. Using FileUtils instead.."
41
- $haveftools = false
42
- end
43
36
  require 'optparse'
44
37
  require 'ostruct'
45
38
 
@@ -67,21 +60,13 @@ def do_configs(configs, target, strip = 'conf/')
67
60
  Dir.mkdir(target) unless File.directory? target
68
61
  configs.each do |cf|
69
62
  ocf = File.join(InstallOptions.config_dir, cf.gsub(/#{strip}/, ''))
70
- if $haveftools
71
- File.install(cf, ocf, 0644, true)
72
- else
73
- FileUtils.install(cf, ocf, {:mode => 0644, :preserve => true, :verbose => true})
74
- end
63
+ FileUtils.install(cf, ocf, {:mode => 0644, :preserve => true, :verbose => true})
75
64
  end
76
65
 
77
66
  if $operatingsystem == 'windows'
78
67
  src_dll = 'ext/windows/eventlog/puppetres.dll'
79
68
  dst_dll = File.join(InstallOptions.bin_dir, 'puppetres.dll')
80
- if $haveftools
81
- File.install(src_dll, dst_dll, 0644, true)
82
- else
83
- FileUtils.install(src_dll, dst_dll, {:mode => 0644, :preserve => true, :verbose => true})
84
- end
69
+ FileUtils.install(src_dll, dst_dll, {:mode => 0644, :preserve => true, :verbose => true})
85
70
 
86
71
  require 'win32/registry'
87
72
  include Win32::Registry::Constants
@@ -110,15 +95,9 @@ def do_libs(libs, strip = 'lib/')
110
95
  next if File.directory? lf
111
96
  olf = File.join(InstallOptions.site_dir, lf.sub(/^#{strip}/, ''))
112
97
  op = File.dirname(olf)
113
- if $haveftools
114
- File.makedirs(op, true)
115
- File.chmod(0755, op)
116
- File.install(lf, olf, 0644, true)
117
- else
118
- FileUtils.makedirs(op, {:mode => 0755, :verbose => true})
119
- FileUtils.chmod(0755, op)
120
- FileUtils.install(lf, olf, {:mode => 0644, :preserve => true, :verbose => true})
121
- end
98
+ FileUtils.makedirs(op, {:mode => 0755, :verbose => true})
99
+ FileUtils.chmod(0755, op)
100
+ FileUtils.install(lf, olf, {:mode => 0644, :preserve => true, :verbose => true})
122
101
  end
123
102
  end
124
103
 
@@ -126,15 +105,9 @@ def do_man(man, strip = 'man/')
126
105
  man.each do |mf|
127
106
  omf = File.join(InstallOptions.man_dir, mf.gsub(/#{strip}/, ''))
128
107
  om = File.dirname(omf)
129
- if $haveftools
130
- File.makedirs(om, true)
131
- File.chmod(0755, om)
132
- File.install(mf, omf, 0644, true)
133
- else
134
- FileUtils.makedirs(om, {:mode => 0755, :verbose => true})
135
- FileUtils.chmod(0755, om)
136
- FileUtils.install(mf, omf, {:mode => 0644, :preserve => true, :verbose => true})
137
- end
108
+ FileUtils.makedirs(om, {:mode => 0755, :verbose => true})
109
+ FileUtils.chmod(0755, om)
110
+ FileUtils.install(mf, omf, {:mode => 0644, :preserve => true, :verbose => true})
138
111
  gzip = %x{which gzip}
139
112
  gzip.chomp!
140
113
  %x{#{gzip} -f #{omf}}
@@ -166,14 +139,13 @@ end
166
139
  # Prepare the file installation.
167
140
  #
168
141
  def prepare_installation
169
- $operatingsystem = Facter.value :operatingsystem
170
-
171
142
  InstallOptions.configs = true
143
+ InstallOptions.check_prereqs = true
172
144
 
173
145
  # Only try to do docs if we're sure they have rdoc
174
146
  if $haverdoc
175
147
  InstallOptions.rdoc = true
176
- InstallOptions.ri = $operatingsystem != "windows"
148
+ InstallOptions.ri = true
177
149
  else
178
150
  InstallOptions.rdoc = false
179
151
  InstallOptions.ri = false
@@ -226,6 +198,9 @@ def prepare_installation
226
198
  opts.on('--mandir[=OPTIONAL]', 'Installation directory for man pages', 'overrides RbConfig::CONFIG["mandir"]') do |mandir|
227
199
  InstallOptions.mandir = mandir
228
200
  end
201
+ opts.on('--[no-]check-prereqs', 'Prevents validation of prerequisite libraries', 'Default on') do |prereq|
202
+ InstallOptions.check_prereqs = prereq
203
+ end
229
204
  opts.on('--quick', 'Performs a quick installation. Only the', 'installation is done.') do |quick|
230
205
  InstallOptions.rdoc = false
231
206
  InstallOptions.ri = false
@@ -256,6 +231,13 @@ def prepare_installation
256
231
  RbConfig::CONFIG['bindir'] = "/usr/bin"
257
232
  end
258
233
 
234
+ # Here we only set $operatingsystem if we have opted to check for prereqs.
235
+ # Otherwise facter won't be guaranteed to be present.
236
+ if InstallOptions.check_prereqs
237
+ check_prereqs
238
+ $operatingsystem = Facter.value :operatingsystem
239
+ end
240
+
259
241
  if not InstallOptions.configdir.nil?
260
242
  configdir = InstallOptions.configdir
261
243
  elsif $operatingsystem == "windows"
@@ -395,6 +377,7 @@ end
395
377
 
396
378
  def build_ri(files)
397
379
  return unless $haverdoc
380
+ return if $operatingsystem == "windows"
398
381
  begin
399
382
  ri = RDoc::RDoc.new
400
383
  #ri.document(["--ri-site", "--merge"] + files)
@@ -473,7 +456,6 @@ FileUtils.cd File.dirname(__FILE__) do
473
456
  man = glob(%w{man/man[0-9]/*})
474
457
  libs = glob(%w{lib/**/*})
475
458
 
476
- check_prereqs
477
459
  prepare_installation
478
460
 
479
461
  #build_rdoc(rdoc) if InstallOptions.rdoc
@@ -110,6 +110,8 @@ ACTIONS
110
110
  Every action except 'list' and 'generate' requires a hostname to act on,
111
111
  unless the '--all' option is set.
112
112
 
113
+ The most important actions for day-to-day use are 'list' and 'sign'.
114
+
113
115
  * clean:
114
116
  Revoke a host's certificate (if applicable) and remove all files
115
117
  related to that host from puppet cert's storage. This is useful when
@@ -171,6 +173,20 @@ configuration options can also be generated by running puppet cert with
171
173
  Operate on all items. Currently only makes sense with the 'sign',
172
174
  'list', and 'fingerprint' actions.
173
175
 
176
+ * --allow-dns-alt-names:
177
+ Sign a certificate request even if it contains one or more alternate DNS
178
+ names. If this option isn't specified, 'puppet cert sign' will ignore any
179
+ requests that contain alternate names.
180
+
181
+ In general, ONLY certs intended for a Puppet master server should include
182
+ alternate DNS names, since Puppet agent relies on those names for identifying
183
+ its rightful server.
184
+
185
+ You can make Puppet agent request a certificate with alternate names by
186
+ setting 'dns_alt_names' in puppet.conf or specifying '--dns_alt_names' on the
187
+ command line. The output of 'puppet cert list' shows any requested alt names
188
+ for pending certificate requests.
189
+
174
190
  * --digest:
175
191
  Set the digest for fingerprinting (defaults to the digest used when
176
192
  signing the cert). Valid values depends on your openssl and openssl ruby
@@ -171,7 +171,7 @@ class Puppet::Configurer
171
171
  end
172
172
 
173
173
  if node.environment.to_s != @environment
174
- Puppet.warning "Local environment: \"#{@environment}\" doesn't match server specified node environment \"#{node.environment}\", switching agent to \"#{node.environment}\"."
174
+ Puppet.notice "Local environment: \"#{@environment}\" doesn't match server specified node environment \"#{node.environment}\", switching agent to \"#{node.environment}\"."
175
175
  @environment = node.environment.to_s
176
176
  report.environment = @environment
177
177
  query_options = nil
@@ -212,7 +212,7 @@ class Puppet::Configurer
212
212
  if tries > 3
213
213
  raise Puppet::Error, "Catalog environment didn't stabilize after #{tries} fetches, aborting run"
214
214
  end
215
- Puppet.warning "Local environment: \"#{@environment}\" doesn't match server specified environment \"#{catalog.environment}\", restarting agent run with environment \"#{catalog.environment}\""
215
+ Puppet.notice "Local environment: \"#{@environment}\" doesn't match server specified environment \"#{catalog.environment}\", restarting agent run with environment \"#{catalog.environment}\""
216
216
  @environment = catalog.environment
217
217
  report.environment = @environment
218
218
 
@@ -20,7 +20,8 @@ module Puppet
20
20
  :cfacter => {
21
21
  :default => false,
22
22
  :type => :boolean,
23
- :desc => 'Whether or not to use the native facter (cfacter) implementation instead of the Ruby one (facter). Defaults to false.',
23
+ :desc => 'Whether to enable a pre-Facter 3.0 release of native Facter (distributed as
24
+ the "cfacter" package). This is not necessary if Facter 3.0 or later is installed.',
24
25
  :hook => proc do |value|
25
26
  return unless value
26
27
  raise ArgumentError, 'facter has already evaluated facts.' if Facter.instance_variable_get(:@collection)
@@ -62,7 +62,9 @@ class Puppet::FileSystem::Windows < Puppet::FileSystem::Posix
62
62
  stat = Puppet::Util::Windows::File.stat(file_name) rescue nil
63
63
 
64
64
  # sigh, Ruby + Windows :(
65
- if stat && stat.ftype == 'directory'
65
+ if !stat
66
+ ::File.unlink(file_name) rescue Dir.rmdir(file_name)
67
+ elsif stat.ftype == 'directory'
66
68
  if Puppet::Util::Windows::File.symlink?(file_name)
67
69
  Dir.rmdir(file_name)
68
70
  else
@@ -364,9 +364,7 @@ class Puppet::Parser::Compiler
364
364
  exceptwrap do
365
365
  Puppet::Util::Profiler.profile("Evaluated definitions", [:compiler, :evaluate_definitions]) do
366
366
  !unevaluated_resources.each do |resource|
367
- Puppet::Util::Profiler.profile("Evaluated resource #{resource}", [:compiler, :evaluate_resource, resource]) do
368
- resource.evaluate
369
- end
367
+ resource.evaluate
370
368
  end.empty?
371
369
  end
372
370
  end
@@ -1,7 +1,7 @@
1
1
  Puppet::Parser::Functions::newfunction(:inline_template, :type => :rvalue, :arity => -2, :doc =>
2
2
  "Evaluate a template string and return its value. See
3
- [the templating docs](http://docs.puppetlabs.com/guides/templating.html) for
4
- more information. Note that if multiple template strings are specified, their
3
+ [the templating docs](http://docs.puppetlabs.com/puppet/latest/reference/lang_template.html) for
4
+ more information. Note that if multiple template strings are specified, their
5
5
  output is all concatenated and returned as the output of the function.") do |vals|
6
6
 
7
7
  require 'erb'
@@ -73,16 +73,19 @@ class Puppet::Parser::Resource < Puppet::Resource
73
73
  # Retrieve the associated definition and evaluate it.
74
74
  def evaluate
75
75
  return if evaluated?
76
- @evaluated = true
77
- if klass = resource_type and ! builtin_type?
78
- finish
79
- evaluated_code = klass.evaluate_code(self)
80
-
81
- return evaluated_code
82
- elsif builtin?
83
- devfail "Cannot evaluate a builtin type (#{type})"
84
- else
85
- self.fail "Cannot find definition #{type}"
76
+
77
+ Puppet::Util::Profiler.profile("Evaluated resource #{self}", [:compiler, :evaluate_resource, self]) do
78
+ @evaluated = true
79
+ if klass = resource_type and ! builtin_type?
80
+ finish
81
+ evaluated_code = klass.evaluate_code(self)
82
+
83
+ return evaluated_code
84
+ elsif builtin?
85
+ devfail "Cannot evaluate a builtin type (#{type})"
86
+ else
87
+ self.fail "Cannot find definition #{type}"
88
+ end
86
89
  end
87
90
  end
88
91
 
@@ -256,7 +256,11 @@ class Puppet::Pops::Evaluator::EvaluatorImpl
256
256
  # Reserved Words fail to evaluate
257
257
  #
258
258
  def eval_ReservedWord(o, scope)
259
- fail(Puppet::Pops::Issues::RESERVED_WORD, o, {:word => o.word})
259
+ if !o.future
260
+ fail(Puppet::Pops::Issues::RESERVED_WORD, o, {:word => o.word})
261
+ else
262
+ o.word
263
+ end
260
264
  end
261
265
 
262
266
  def eval_LiteralDefault(o, scope)
@@ -544,6 +544,10 @@ module Puppet::Pops::Issues
544
544
  "Use of reserved word: #{word}, must be quoted if intended to be a String value"
545
545
  end
546
546
 
547
+ FUTURE_RESERVED_WORD = issue :FUTURE_RESERVED_WORD, :word do
548
+ "Use of future reserved word: '#{word}'"
549
+ end
550
+
547
551
  RESERVED_TYPE_NAME = hard_issue :RESERVED_TYPE_NAME, :name do
548
552
  "The name: '#{name}' is already defined by Puppet and can not be used as the name of #{label.a_an(semantic)}."
549
553
  end