puppet 2.6.6 → 2.6.7

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 (140) hide show
  1. data/CHANGELOG +107 -1
  2. data/README.queueing +1 -1
  3. data/Rakefile +1 -1
  4. data/conf/solaris/smf/svc-puppetd +0 -2
  5. data/conf/solaris/smf/svc-puppetmasterd +0 -2
  6. data/examples/etc/init.d/sleeper +0 -2
  7. data/examples/modules/sample-module/README.txt +2 -2
  8. data/ext/puppetstoredconfigclean.rb +1 -1
  9. data/install.rb +20 -25
  10. data/lib/puppet.rb +1 -1
  11. data/lib/puppet/application/agent.rb +2 -2
  12. data/lib/puppet/application/apply.rb +2 -2
  13. data/lib/puppet/application/cert.rb +27 -11
  14. data/lib/puppet/application/filebucket.rb +1 -1
  15. data/lib/puppet/application/inspect.rb +1 -1
  16. data/lib/puppet/application/kick.rb +2 -2
  17. data/lib/puppet/application/master.rb +1 -1
  18. data/lib/puppet/application/queue.rb +2 -2
  19. data/lib/puppet/configurer/downloader.rb +1 -0
  20. data/lib/puppet/configurer/plugin_handler.rb +8 -1
  21. data/lib/puppet/daemon.rb +1 -1
  22. data/lib/puppet/defaults.rb +18 -2
  23. data/lib/puppet/external/nagios.rb +0 -2
  24. data/lib/puppet/external/nagios/base.rb +0 -2
  25. data/lib/puppet/indirector/facts/inventory_active_record.rb +97 -0
  26. data/lib/puppet/indirector/facts/rest.rb +2 -0
  27. data/lib/puppet/indirector/facts/yaml.rb +75 -0
  28. data/lib/puppet/indirector/indirection.rb +1 -0
  29. data/lib/puppet/module.rb +1 -1
  30. data/lib/puppet/network/http/api/v1.rb +3 -4
  31. data/lib/puppet/network/http/compression.rb +4 -1
  32. data/lib/puppet/network/http/handler.rb +1 -1
  33. data/lib/puppet/network/rest_authconfig.rb +1 -1
  34. data/lib/puppet/node/facts.rb +29 -0
  35. data/lib/puppet/parser/ast/collection.rb +5 -4
  36. data/lib/puppet/parser/ast/leaf.rb +1 -1
  37. data/lib/puppet/parser/functions/regsubst.rb +7 -14
  38. data/lib/puppet/parser/functions/split.rb +7 -7
  39. data/lib/puppet/parser/grammar.ra +2 -4
  40. data/lib/puppet/parser/lexer.rb +4 -1
  41. data/lib/puppet/parser/parser.rb +2062 -1976
  42. data/lib/puppet/parser/parser_support.rb +3 -3
  43. data/lib/puppet/provider/computer/computer.rb +1 -3
  44. data/lib/puppet/provider/mount.rb +12 -16
  45. data/lib/puppet/provider/mount/parsed.rb +67 -8
  46. data/lib/puppet/provider/parsedfile.rb +3 -1
  47. data/lib/puppet/provider/service/daemontools.rb +6 -6
  48. data/lib/puppet/provider/service/gentoo.rb +0 -2
  49. data/lib/puppet/provider/service/launchd.rb +11 -8
  50. data/lib/puppet/provider/service/runit.rb +4 -4
  51. data/lib/puppet/provider/user/useradd.rb +6 -1
  52. data/lib/puppet/rails/database/004_add_inventory_service_tables.rb +36 -0
  53. data/lib/puppet/rails/database/schema.rb +17 -0
  54. data/lib/puppet/rails/fact_name.rb +0 -2
  55. data/lib/puppet/rails/fact_value.rb +0 -2
  56. data/lib/puppet/rails/inventory_fact.rb +5 -0
  57. data/lib/puppet/rails/inventory_node.rb +25 -0
  58. data/lib/puppet/reference/configuration.rb +1 -1
  59. data/lib/puppet/reference/metaparameter.rb +1 -1
  60. data/lib/puppet/reports/store.rb +4 -1
  61. data/lib/puppet/resource.rb +39 -25
  62. data/lib/puppet/type.rb +5 -5
  63. data/lib/puppet/type/augeas.rb +4 -4
  64. data/lib/puppet/type/computer.rb +5 -1
  65. data/lib/puppet/type/exec.rb +3 -1
  66. data/lib/puppet/type/file.rb +3 -1
  67. data/lib/puppet/type/file/content.rb +13 -15
  68. data/lib/puppet/type/file/ensure.rb +11 -17
  69. data/lib/puppet/type/file/selcontext.rb +16 -0
  70. data/lib/puppet/type/file/target.rb +14 -1
  71. data/lib/puppet/type/k5login.rb +0 -2
  72. data/lib/puppet/type/macauthorization.rb +4 -1
  73. data/lib/puppet/type/mcx.rb +4 -1
  74. data/lib/puppet/type/mount.rb +37 -21
  75. data/lib/puppet/type/package.rb +5 -1
  76. data/lib/puppet/type/schedule.rb +20 -20
  77. data/lib/puppet/type/selmodule.rb +3 -1
  78. data/lib/puppet/type/ssh_authorized_key.rb +5 -1
  79. data/lib/puppet/type/user.rb +14 -1
  80. data/lib/puppet/type/zfs.rb +3 -1
  81. data/lib/puppet/type/zone.rb +3 -1
  82. data/lib/puppet/type/zpool.rb +7 -5
  83. data/lib/puppet/util.rb +5 -0
  84. data/lib/puppet/util/command_line.rb +1 -1
  85. data/lib/puppet/util/execution.rb +4 -5
  86. data/lib/puppet/util/execution_stub.rb +26 -0
  87. data/lib/puppet/util/monkey_patches.rb +21 -0
  88. data/lib/puppet/util/rdoc/code_objects.rb +39 -0
  89. data/lib/puppet/util/rdoc/generators/puppet_generator.rb +18 -0
  90. data/lib/puppet/util/rdoc/parser.rb +5 -3
  91. data/lib/puppet/util/settings.rb +1 -1
  92. data/spec/integration/parser/parser_spec.rb +7 -0
  93. data/spec/integration/provider/mount_spec.rb +151 -0
  94. data/spec/integration/type/file_spec.rb +32 -29
  95. data/spec/spec_helper.rb +2 -0
  96. data/spec/unit/application/agent_spec.rb +3 -7
  97. data/spec/unit/application/apply_spec.rb +17 -2
  98. data/spec/unit/application/cert_spec.rb +54 -14
  99. data/spec/unit/application/filebucket_spec.rb +1 -1
  100. data/spec/unit/application/queue_spec.rb +1 -5
  101. data/spec/unit/configurer/downloader_spec.rb +22 -10
  102. data/spec/unit/daemon_spec.rb +1 -5
  103. data/spec/unit/indirector/facts/inventory_active_record_spec.rb +163 -0
  104. data/spec/unit/indirector/facts/yaml_spec.rb +216 -2
  105. data/spec/unit/indirector/queue_spec.rb +3 -0
  106. data/spec/unit/module_spec.rb +2 -2
  107. data/spec/unit/network/handler/fileserver_spec.rb +1 -1
  108. data/spec/unit/network/http/api/v1_spec.rb +28 -0
  109. data/spec/unit/network/http/compression_spec.rb +1 -1
  110. data/spec/unit/network/http/handler_spec.rb +7 -4
  111. data/spec/unit/node/facts_spec.rb +24 -0
  112. data/spec/unit/parser/ast/collection_spec.rb +16 -12
  113. data/spec/unit/parser/lexer_spec.rb +16 -0
  114. data/spec/unit/parser/parser_spec.rb +35 -2
  115. data/spec/unit/provider/mount/parsed_spec.rb +199 -114
  116. data/spec/unit/provider/mount_spec.rb +54 -53
  117. data/spec/unit/provider/ssh_authorized_key/parsed_spec.rb +1 -0
  118. data/spec/unit/provider/user/user_role_add_spec.rb +1 -0
  119. data/spec/unit/provider/user/useradd_spec.rb +43 -3
  120. data/spec/unit/reports/store_spec.rb +1 -1
  121. data/spec/unit/resource_spec.rb +39 -13
  122. data/spec/unit/type/file/content_spec.rb +38 -137
  123. data/spec/unit/type/file/selinux_spec.rb +5 -0
  124. data/spec/unit/type/mount_spec.rb +167 -122
  125. data/spec/unit/type/user_spec.rb +4 -0
  126. data/spec/unit/type_spec.rb +12 -1
  127. data/spec/unit/util/execution_spec.rb +49 -0
  128. data/spec/unit/util/execution_stub_spec.rb +35 -0
  129. data/spec/unit/util/rdoc/parser_spec.rb +15 -3
  130. data/spec/unit/util/settings_spec.rb +11 -2
  131. data/tasks/rake/git_workflow.rake +1 -1
  132. data/test/Rakefile +0 -2
  133. data/test/data/providers/mount/parsed/aix.mount +7 -0
  134. data/test/data/providers/mount/parsed/darwin.mount +6 -0
  135. data/test/data/providers/mount/parsed/hpux.mount +17 -0
  136. data/test/data/providers/mount/parsed/linux.mount +5 -0
  137. data/test/data/providers/mount/parsed/solaris.mount +6 -0
  138. data/test/data/types/mount/linux.fstab +1 -0
  139. data/test/data/types/mount/solaris.fstab +1 -0
  140. metadata +18 -4
data/CHANGELOG CHANGED
@@ -1,5 +1,111 @@
1
+ 2.6.7
2
+ =====
3
+ 17f673d Updated CHANGELOG for 2.6.7rc1
4
+ 852fb97 (#5073) Download plugins even if you're filtering on tags
5
+ 4f34dbf Fix #5610: Prevent unnecessary RAL lookups
6
+ 9781032 Revert "Merge branch 'ticket/2.6.x/5605' of git://github.com/stschulte/puppet into 2.6.next"
7
+ 25926d1 (#6723) Fix withenv environment restoration bug
8
+ 093f162 (#6689) Remove extraneous include of Puppet::Util in InventoryActiveRecord
9
+ 4c19299 Remove extra trailing whitespace from lib/puppet/resource.rb
10
+ ff9e242 (#5428) More fully "stub" Puppet::Resource::Reference for use with storedconfigs
11
+ 0262633 (#6707) Fix typo in rest_authconfig.rb
12
+ 8858e40 (#6689) Make inventory_active_record terminus search quickly
13
+ 285c4cc (#5392) Give a better error when realizing a non-existant resource
14
+ cd5deda (#2645) Adding a less-stubby test to verify the "system" attribute's behavior
15
+ 531e258 maint: Remove serialization of InventoryFact values
16
+ 3489412 maint: Rename InventoryHost to InventoryNode
17
+ 4bd5493 Fixed #2645 - Added support for creating system users
18
+ a3f2357 maint: Remove spec run noise
19
+ 7764412 maint:Refactor of mount provider integration tests
20
+ 880d0c6 (#6338) Support searching on metadata in InventoryActiveRecord terminus
21
+ f836366 (#6338) Implement search for InventoryActiveRecord facts terminus
22
+ 8ce30c8 (#6338) Add an InventoryActiveRecord terminus for Facts
23
+ 1ef83cb Added integration tests for the mount provider
24
+ 64440e5 (#6513) Propagate the environment when doing variable lookup in settings
25
+ 92dffb2 (#6513) Adjust P::U::Settings test name to reflect what it tests
26
+ 5ef1031 (#6632) Adding a new mount no longer causes error with umount
27
+ bd5517d Adjust Darwin mount provider tests to pass on Linux
28
+ 9d2fceb Maint: Begin adding integration tests for the mount provider
29
+ 23d1c03 Maint: Added the ability to replace the behavior of Puppet::Util.execute with an arbitrary code block for ease in spec testing.
30
+ 455a891 (#5794) create reports directory when creating host specific directory
31
+ 1b1e803 (5724) Prep for deprecation of DESTDIR
32
+ f4a0af1 Refactoring duplicate code and logic in prep for DESTDIR deprecation.
33
+ 7a00d6b (#6606) Inline docs: Document all autorequire relationships
34
+ e3aec14 (#5148) Fix failing spec due to timezone
35
+ 8bd80a9 (#5148) Add support for PSON to facts
36
+ c3baa28 (#6338) Remove inventory indirection, and move to facts indirection
37
+ 6c53eb3 (#6445) Fix inline docs: puppet agent does not accept --mkusers
38
+ 4e29f43 (#6541) maint: whitespace cleanup on the file integration spec
39
+ b907ba3 (#6541) Fix content with checksum truncation bug
40
+ 422399b (#5466) Write specs for output of puppet resource
41
+ 8cc390c (#5466) Monkey patch Symbol so that you can sort them
42
+ 24eacb7 (#5466) Fixed puppet resource bug with trailing ,
43
+ 743e039 (#4922) Don't truncate remotely-sourced files on 404
44
+ bb69011 (#6338) Remove unused version control tags
45
+ e2a5085 Maint: Align tabs in a code block in the Augeas type.
46
+ 65a5496 (#6509) Inline docs: Fix erroneous code block in directoryservice provider for computer type
47
+ ea9f1f0 Maint: Rewrite comments about symlinks to reflect best practice.
48
+ 94f8ead (#6509) Inline docs: Fix broken lists in Launchd provider.
49
+ c80a77d (#6509) Inline docs: Fix broken code blocks in zpool type
50
+ 27863c3 (#6509) Inline docs: Fix code blocks in service type.
51
+ f4034f7 (#6509) Inline docs: fix broken code blocks in schedule.rb.
52
+ 6f6c4b5 (#6509) Inline docs: Fix broken code block in file type (content attribute)
53
+ a949a83 Revert "(#6309) Ensure the correct device is mounted when managing mounts"
54
+ 23a510a (#4914) Improved stubbing in mount/parsed_spec tests.
55
+ ac2262d (#3999) Allow disabling of default SELinux context detection for files
56
+ 23eb77d (#6322) --noop should not suppress error codes
57
+ 439115e (#6499) Make puppet respond identically to -h and --help
58
+ 23b7119 Maint: Add an assertion mechanism to Puppet
59
+ e3dfe41 (#6418) Recursive files shouldn't be audited
60
+ 0e9858f (#6407) Fix spec test hang with Mocha >= 0.9.11 in zlib testing
61
+ 309b932 (#5552) Display help when no subcommand is given.
62
+ de6a205 (#5552) Clean up subcommand handling inside puppet cert.
63
+ bb31c3d (#6376) Add test case for facts find request
64
+ 2ecf913 Revert "(#5935) Allow functions to accept negated values"
65
+ c57c508 (#4914) Improved parsed_spec for mount
66
+ ec33a09 (#4914) Remove mount specs
67
+ e854205 Remove pending tests from parsed mount provider
68
+ 6cb365a (#6309) Ensure the correct device is mounted when managing mounts
69
+ d1f1858 (#6376) Add support and testing for _search GET requests
70
+ 3b41d44 Clean up whitespace, and commented out code in parsed mount provider
71
+ a7cebf8 (#6337) Fix Ruby warning on 1.8.6 about "future compatibility"
72
+ 8a48560 (#5150) Make fact REST terminus configurable to connect to inventory service
73
+ e6870f6 (#5166) Inventory service is now searchable by timestamp.
74
+ 2d2f9ab Maint: backport timestamp accessor for facts from 2.7 branch
75
+ fa0ed63 Refactored Puppet::Node::Inventory::Yaml tests in preparation for adding freshness check
76
+ 67f24e4 Refactor Puppet::Node::Inventory::Yaml in preparation for adding freshness
77
+ 23fc4db (#5132) Provide a query REST interface for inventory
78
+ e3c59df (#5935) Allow functions to accept negated values
79
+ 7cb884e (#6346) Move the trap calls onto Signal so they're easier to stub
80
+ b5bae9f (#6331) Remove final special :trac: link from the file content property
81
+ 4d25d90 (#6331) Inline documentation: Fix rotted links pointing at the Trac wiki
82
+ b25d9e4 maint: make rspec exit with status 1 when there are failures
83
+ 5c26f68 (#5516) Rebuild parser.rb after merge.
84
+ e512e3e (#5977) fix spec test failure when new applications are introduced.
85
+ b5b5923 misc: ast_context has two arguments, not one.
86
+ 414e3a5 Fix #5516 - Hashes can't be used in selectors
87
+ c373b62 Fix #6269 - Hashes only work with two levels of access
88
+ 9090507 Fix #6267 - puppetdoc embedded links to puppet entities are not hyperlinked
89
+ b4a171e Fix #5720 - puppetdoc misses some class comments
90
+ cfa0c32 Fix #6281 - Make sure puppetdoc analyzes all files
91
+ 48bc7d0 Fix #6280 - puppetdoc crashing on string interpolation
92
+ 0b7faa6 (#6270) Fix formatting in split function's doc string
93
+ 637e139 (#6270) Fix formatting in regsubst function's doc string
94
+ e9ee621 (6130) Change header level on metaparameter reference
95
+ d6e4ffe (#4914) Specs for mounted? match new behaviour
96
+ f534470 (#4914) Add specs for modified mount provider
97
+ b753038 (#4914) Add specs for modified mount type
98
+ 9f40608 (#4914) Update property blocks
99
+ fd111f2 (#4914) Query property_hash for mountstate
100
+ 2884660 (#4914) Prefetch mountstate
101
+ ade951a (#4914) Join lines for better readability
102
+ 8b98526 (#5662) Fixed tests that didnt stub key_attributes
103
+ 02b3111 (#5605) Prefetch doesnt work with composite keys
104
+ 2a0c970 (#5662) Parsedfile doesnt work with mult keyattr
105
+ 35dd070 (#5661) Creating types dont work with >1 namevar
106
+
1
107
  2.6.6
2
- ========
108
+ =====
3
109
  d24e32a Update CHANGELOG and version for 2.6.6rc1
4
110
  7c2a980 (#6541) Fix content with checksum truncation bug
5
111
  63e911f (#6418) Recursive files shouldn't be audited
@@ -8,7 +8,7 @@ Queue Daemon).
8
8
  Currently this is only supported for "Storeconfigs" which is
9
9
  documented at:
10
10
 
11
- http://reductivelabs.com/trac/puppet/wiki/UsingStoredConfiguration
11
+ http://projects.puppetlabs.com/projects/1/wiki/Using_Stored_Configuration
12
12
 
13
13
  In the future this feature can be extended to any new puppet
14
14
  data which involves storage in a database.
data/Rakefile CHANGED
@@ -44,7 +44,7 @@ task :puppetpackages => [:create_gem, :package]
44
44
 
45
45
  RSpec::Core::RakeTask.new do |t|
46
46
  t.pattern ='spec/{unit,integration}/**/*.rb'
47
- t.fail_on_error = false
47
+ t.fail_on_error = true
48
48
  end
49
49
 
50
50
  desc "Run the unit tests"
@@ -62,5 +62,3 @@ status)
62
62
  fi
63
63
  esac
64
64
  exit 0
65
-
66
- # $Id$
@@ -58,5 +58,3 @@ status)
58
58
  fi
59
59
  esac
60
60
  exit 0
61
-
62
- # $Id$
@@ -1,7 +1,5 @@
1
1
  #!/bin/bash
2
2
 
3
- # $Id$
4
-
5
3
  script=$0
6
4
  path=`echo $script | sed 's/etc..*/bin/'`
7
5
 
@@ -12,6 +12,6 @@ templates/sample.erb
12
12
  Note the consistent naming of files for Puppet::Util::Autoload
13
13
 
14
14
  Reference Documents:
15
- http://reductivelabs.com/trac/puppet/wiki/ModuleOrganisation
15
+ http://docs.puppetlabs.com/guides/modules.html
16
16
  http://docs.puppetlabs.com/guides/custom_functions.html
17
- http://reductivelabs.com/trac/puppet/wiki/FunctionReference
17
+ http://docs.puppetlabs.com/references/latest/function.html
@@ -3,7 +3,7 @@
3
3
  # Script to clean up stored configs for (a) given host(s)
4
4
  #
5
5
  # Credits:
6
- # Script was taken from http://reductivelabs.com/trac/puppet/attachment/wiki/UsingStoredConfiguration/kill_node_in_storedconfigs_db.rb
6
+ # Script was taken from http://reductivelabs.com/trac/puppet/attachment/wiki/UsingStoredConfiguration/kill_node_in_storedconfigs_db.rb (link no longer valid),
7
7
  # which haven been initially posted by James Turnbull
8
8
  # duritong adapted and improved the script a bit.
9
9
 
data/install.rb CHANGED
@@ -300,34 +300,29 @@ def prepare_installation
300
300
  mandir = Config::CONFIG['mandir']
301
301
  end
302
302
 
303
- # To be deprecated once people move over to using --destdir option
304
- if (destdir = ENV['DESTDIR'])
305
- configdir = "#{destdir}#{configdir}"
306
- bindir = "#{destdir}#{bindir}"
307
- sbindir = "#{destdir}#{sbindir}"
308
- mandir = "#{destdir}#{mandir}"
309
- sitelibdir = "#{destdir}#{sitelibdir}"
310
-
311
- FileUtils.makedirs(configdir) if InstallOptions.configs
312
- FileUtils.makedirs(bindir)
313
- FileUtils.makedirs(sbindir)
314
- FileUtils.makedirs(mandir)
315
- FileUtils.makedirs(sitelibdir)
316
303
  # This is the new way forward
317
- elsif (destdir = InstallOptions.destdir)
318
- configdir = "#{destdir}#{configdir}"
319
- bindir = "#{destdir}#{bindir}"
320
- sbindir = "#{destdir}#{sbindir}"
321
- mandir = "#{destdir}#{mandir}"
322
- sitelibdir = "#{destdir}#{sitelibdir}"
323
-
324
- FileUtils.makedirs(configdir) if InstallOptions.configs
325
- FileUtils.makedirs(bindir)
326
- FileUtils.makedirs(sbindir)
327
- FileUtils.makedirs(mandir)
328
- FileUtils.makedirs(sitelibdir)
304
+ if not InstallOptions.destdir.nil?
305
+ destdir = InstallOptions.destdir
306
+ # To be deprecated once people move over to using --destdir option
307
+ elsif ENV['DESTDIR'] != nil?
308
+ destdir = ENV['DESTDIR']
309
+ warn "DESTDIR is deprecated. Use --destdir instead."
310
+ else
311
+ destdir = ''
329
312
  end
330
313
 
314
+ configdir = "#{destdir}#{configdir}"
315
+ bindir = "#{destdir}#{bindir}"
316
+ sbindir = "#{destdir}#{sbindir}"
317
+ mandir = "#{destdir}#{mandir}"
318
+ sitelibdir = "#{destdir}#{sitelibdir}"
319
+
320
+ FileUtils.makedirs(configdir) if InstallOptions.configs
321
+ FileUtils.makedirs(bindir)
322
+ FileUtils.makedirs(sbindir)
323
+ FileUtils.makedirs(mandir)
324
+ FileUtils.makedirs(sitelibdir)
325
+
331
326
  tmpdirs << bindir
332
327
 
333
328
  InstallOptions.tmp_dirs = tmpdirs.compact
@@ -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.6'
27
+ PUPPETVERSION = '2.6.7'
28
28
 
29
29
  def Puppet.version
30
30
  PUPPETVERSION
@@ -9,7 +9,7 @@ class Puppet::Application::Agent < Puppet::Application
9
9
 
10
10
  def preinit
11
11
  # Do an initial trap, so that cancels don't get a stack trace.
12
- trap(:INT) do
12
+ Signal.trap(:INT) do
13
13
  $stderr.puts "Cancelling startup"
14
14
  exit(0)
15
15
  end
@@ -119,7 +119,7 @@ class Puppet::Application::Agent < Puppet::Application
119
119
 
120
120
  if not report
121
121
  exit(1)
122
- elsif not Puppet[:noop] and options[:detailed_exitcodes] then
122
+ elsif options[:detailed_exitcodes] then
123
123
  exit(report.exit_status)
124
124
  else
125
125
  exit(0)
@@ -125,7 +125,7 @@ class Puppet::Application::Apply < Puppet::Application
125
125
  configurer = Puppet::Configurer.new
126
126
  report = configurer.run(:skip_plugin_download => true, :catalog => catalog)
127
127
 
128
- exit( Puppet[:noop] ? 0 : options[:detailed_exitcodes] ? report.exit_status : 0 )
128
+ exit( options[:detailed_exitcodes] ? report.exit_status : 0 )
129
129
  rescue => detail
130
130
  puts detail.backtrace if Puppet[:trace]
131
131
  $stderr.puts detail.message
@@ -143,7 +143,7 @@ class Puppet::Application::Apply < Puppet::Application
143
143
  client = nil
144
144
  server = nil
145
145
 
146
- trap(:INT) do
146
+ Signal.trap(:INT) do
147
147
  $stderr.puts "Exiting"
148
148
  exit(1)
149
149
  end
@@ -5,17 +5,19 @@ class Puppet::Application::Cert < Puppet::Application
5
5
  should_parse_config
6
6
  run_mode :master
7
7
 
8
- attr_accessor :cert_mode, :all, :ca, :digest, :signed
8
+ attr_accessor :all, :ca, :digest, :signed
9
9
 
10
- def find_mode(opt)
11
- require 'puppet/ssl/certificate_authority'
12
- modes = Puppet::SSL::CertificateAuthority::Interface::INTERFACE_METHODS
13
- tmp = opt.sub("--", '').to_sym
14
- @cert_mode = modes.include?(tmp) ? tmp : nil
10
+ def subcommand
11
+ @subcommand
12
+ end
13
+ def subcommand=(name)
14
+ # Handle the nasty, legacy mapping of "clean" to "destroy".
15
+ sub = name.to_sym
16
+ @subcommand = (sub == :clean ? :destroy : sub)
15
17
  end
16
18
 
17
19
  option("--clean", "-c") do
18
- @cert_mode = :destroy
20
+ self.subcommand = "destroy"
19
21
  end
20
22
 
21
23
  option("--all", "-a") do
@@ -37,7 +39,7 @@ class Puppet::Application::Cert < Puppet::Application
37
39
  require 'puppet/ssl/certificate_authority/interface'
38
40
  Puppet::SSL::CertificateAuthority::Interface::INTERFACE_METHODS.reject {|m| m == :destroy }.each do |method|
39
41
  option("--#{method}", "-#{method.to_s[0,1]}") do
40
- find_mode("--#{method}")
42
+ self.subcommand = method
41
43
  end
42
44
  end
43
45
 
@@ -54,8 +56,8 @@ class Puppet::Application::Cert < Puppet::Application
54
56
  hosts = command_line.args.collect { |h| h.downcase }
55
57
  end
56
58
  begin
57
- @ca.apply(:revoke, :to => hosts) if @cert_mode == :destroy
58
- @ca.apply(@cert_mode, :to => hosts, :digest => @digest)
59
+ @ca.apply(:revoke, :to => hosts) if subcommand == :destroy
60
+ @ca.apply(subcommand, :to => hosts, :digest => @digest)
59
61
  rescue => detail
60
62
  puts detail.backtrace if Puppet[:trace]
61
63
  puts detail.to_s
@@ -64,11 +66,12 @@ class Puppet::Application::Cert < Puppet::Application
64
66
  end
65
67
 
66
68
  def setup
69
+ require 'puppet/ssl/certificate_authority'
67
70
  exit(Puppet.settings.print_configs ? 0 : 1) if Puppet.settings.print_configs?
68
71
 
69
72
  Puppet::Util::Log.newdestination :console
70
73
 
71
- if [:generate, :destroy].include? @cert_mode
74
+ if [:generate, :destroy].include? subcommand
72
75
  Puppet::SSL::Host.ca_location = :local
73
76
  else
74
77
  Puppet::SSL::Host.ca_location = :only
@@ -82,4 +85,17 @@ class Puppet::Application::Cert < Puppet::Application
82
85
  exit(23)
83
86
  end
84
87
  end
88
+
89
+ def parse_options
90
+ # handle the bareword subcommand pattern.
91
+ result = super
92
+ unless self.subcommand then
93
+ if sub = self.command_line.args.shift then
94
+ self.subcommand = sub
95
+ else
96
+ help
97
+ end
98
+ end
99
+ result
100
+ end
85
101
  end
@@ -52,7 +52,7 @@ class Puppet::Application::Filebucket < Puppet::Application
52
52
  @client = nil
53
53
  @server = nil
54
54
 
55
- trap(:INT) do
55
+ Signal.trap(:INT) do
56
56
  $stderr.puts "Cancelling"
57
57
  exit(1)
58
58
  end
@@ -82,7 +82,7 @@ Licensed under the GNU General Public License version 2
82
82
  Puppet::Util::Log.newdestination(@report)
83
83
  Puppet::Util::Log.newdestination(:console) unless options[:logset]
84
84
 
85
- trap(:INT) do
85
+ Signal.trap(:INT) do
86
86
  $stderr.puts "Exiting"
87
87
  exit(1)
88
88
  end
@@ -151,7 +151,7 @@ class Puppet::Application::Kick < Puppet::Application
151
151
 
152
152
  def preinit
153
153
  [:INT, :TERM].each do |signal|
154
- trap(signal) do
154
+ Signal.trap(signal) do
155
155
  $stderr.puts "Cancelling"
156
156
  exit(1)
157
157
  end
@@ -195,7 +195,7 @@ class Puppet::Application::Kick < Puppet::Application
195
195
 
196
196
  # If we get a signal, then kill all of our children and get out.
197
197
  [:INT, :TERM].each do |signal|
198
- trap(signal) do
198
+ Signal.trap(signal) do
199
199
  Puppet.notice "Caught #{signal}; shutting down"
200
200
  @children.each do |pid, host|
201
201
  Process.kill("INT", pid)
@@ -26,7 +26,7 @@ class Puppet::Application::Master < Puppet::Application
26
26
  end
27
27
 
28
28
  def preinit
29
- trap(:INT) do
29
+ Signal.trap(:INT) do
30
30
  $stderr.puts "Cancelling startup"
31
31
  exit(0)
32
32
  end
@@ -15,13 +15,13 @@ class Puppet::Application::Queue < Puppet::Application
15
15
  # Do an initial trap, so that cancels don't get a stack trace.
16
16
 
17
17
  # This exits with exit code 1
18
- trap(:INT) do
18
+ Signal.trap(:INT) do
19
19
  $stderr.puts "Caught SIGINT; shutting down"
20
20
  exit(1)
21
21
  end
22
22
 
23
23
  # This is a normal shutdown, so code 0
24
- trap(:TERM) do
24
+ Signal.trap(:TERM) do
25
25
  $stderr.puts "Caught SIGTERM; shutting down"
26
26
  exit(0)
27
27
  end
@@ -50,6 +50,7 @@ class Puppet::Configurer::Downloader
50
50
 
51
51
  def catalog
52
52
  catalog = Puppet::Resource::Catalog.new
53
+ catalog.host_config = false
53
54
  catalog.add_resource(file)
54
55
  catalog
55
56
  end
@@ -9,7 +9,14 @@ module Puppet::Configurer::PluginHandler
9
9
  # Retrieve facts from the central server.
10
10
  def download_plugins
11
11
  return nil unless download_plugins?
12
- Puppet::Configurer::Downloader.new("plugin", Puppet[:plugindest], Puppet[:pluginsource], Puppet[:pluginsignore]).evaluate.each { |file| load_plugin(file) }
12
+ plugin_downloader = Puppet::Configurer::Downloader.new(
13
+ "plugin",
14
+ Puppet[:plugindest],
15
+ Puppet[:pluginsource],
16
+ Puppet[:pluginsignore]
17
+ )
18
+
19
+ plugin_downloader.evaluate.each { |file| load_plugin(file) }
13
20
  end
14
21
 
15
22
  def load_plugin(file)
@@ -95,7 +95,7 @@ class Puppet::Daemon
95
95
  # extended signals not supported under windows
96
96
  signals.update({:HUP => :restart, :USR1 => :reload, :USR2 => :reopen_logs }) unless Puppet.features.microsoft_windows?
97
97
  signals.each do |signal, method|
98
- trap(signal) do
98
+ Signal.trap(signal) do
99
99
  Puppet.notice "Caught #{signal}; calling #{method}"
100
100
  send(method)
101
101
  end