puppet 0.25.3 → 0.25.4

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of puppet might be problematic. Click here for more details.

data/CHANGELOG CHANGED
@@ -1,3 +1,30 @@
1
+ 0.25.4
2
+ ======
3
+ 0025e13 Partial reversion of patch for #3088 to fix #3104 (Exception misreported)
4
+ bfc9e45 Updated CHANGELOG for 0.25.4rc3
5
+
6
+ 0.25.4rc3
7
+ =========
8
+ a91c476 Fix for #3088 (catching Exception also traps SystemExit)
9
+ 1a263e2 Fix for #3089 (timestamp may now be a time object, not a string)
10
+ 75634b7 Fix for #3093 (also need to be able to call pkgget_with_cat on class)
11
+ 94e269c Uncommeniting the fix for #3001
12
+ 9636b93 Updated CHANGELOG for 0.24.5rc2
13
+ d4319a5 Minimal fix for #3001 (failing to fetch metadata on dangling symlink)
14
+ cdcbdc7 Fixing #2914 - pre/post hooks now work for transactions
15
+ 67216aa Fix for #3075 (sshkey host_aliases ignored)
16
+ e4462c0 Updated version and CHANGELOG for 0.25.4
17
+
18
+ 0.25.4rc2
19
+ =========
20
+ d4319a5 Minimal fix for #3001 (failing to fetch metadata on dangling symlink)
21
+ cdcbdc7 Fixing #2914 - pre/post hooks now work for transactions
22
+ 67216aa Fix for #3075 (sshkey host_aliases ignored)
23
+ e4462c0 Updated version and CHANGELOG for 0.25.4
24
+ 441879f Revert "Fix #2845 Cron entries using "special" parameter lose their title when changed"
25
+ f7e1435 Updated rake task to fix gem build issue
26
+ 49013f0 Updated version and CHANGELOG for 0.25.3
27
+
1
28
  0.25.3
2
29
  ======
3
30
  f8c1b08 Reversion of pipe IO patch for testing on #3025
@@ -7,10 +34,6 @@ c99f394 Fix #2845 Cron entries using "special" parameter lose their title when
7
34
  dd22b71 Replaced ugly gem creation task with slightly less ugly task
8
35
  d0efcc6 Added tasks directory to Rakefile and gem task file lists
9
36
  8a6d66e Added puppetpackages task description
10
-
11
- 0.25.2
12
- ======
13
-
14
37
  eada68a Updated CHANGELOG for 0.25.2
15
38
  6111ba8 Fix for temporary file security whole
16
39
  e7d98cc Fix for #2999 (absent package handling on solaris)
@@ -19,9 +42,6 @@ cbc2ef0 Partial rollback of refinements to fix for #2994
19
42
  fd631b9 Do not close stdout or stderr in execute.
20
43
  f878fe8 Update Red Hat spec file for 0.25.2
21
44
  4394c48 Updated CHANGELOG for 0.25.2rc3
22
-
23
- 0.25.2rc3
24
- =========
25
45
  13cbf04 ReFix 2675 ending slash in directory should get stripped off
26
46
  5c6f07b Use a pipe instead of a temp file for command output.
27
47
  7e64393 Additional fix for #2994 (followed symlinks do not have checksums)
@@ -174,45 +194,6 @@ b8470b8 Fix #2757 & CSR 92 (symlinks in recursively managed dirs)
174
194
  eca338c Fix for #2772 (webrick test failures)
175
195
  b1c57e9 Al Hoang's patch for #2781, removing obsolete when/: syntax
176
196
  50e9c98 Follow-on for #2724 - Adding an external node classifier
177
- 2f0b1e5 Updated CHANGELOG
178
- 20e5222 Fixing #2689 - file owner warnings are reduced
179
- 09fb3f7 Fixing #2752 - "require" loads "include"
180
- 6846c32 Fixing some recently broken Scope tests
181
- 0043392 Fixed typo in lib/puppet/indirector/ldap.rb
182
- 6b254eb Fix #2753 - Do not "global allow" plugins/modules mount if some rules have been parsed
183
- ff3a7bc Re-fixed #2750 - Stop disabling the CRL or checking for a disabled CRL
184
- 594c774 Revised partial fix for #2661 and related issues
185
- 73d04c6 Bug #2534 Raise error if property appears twice
186
- 7517572 Bug #1908 cron environment should allow empty vals
187
- febe707 Bug #1742 Invalid params to --color outputs 'nil'
188
- d383ab8 Use notice() in the versioncmp() docs
189
- 9dff716 conf/redhat/*.init: Use -p option to killproc
190
- f47a70f Ticket #2665: Regexp exception on ++ in package names
191
- b6e4ef3 Fixed #2750 - Set :cacrl to nil instead of 'false' in puppetd
192
- 2b57e06 Fix #2691 - Collection AR request should not include params if querying with tags
193
- e8bce7a Workaround #2668 - Compress facts so that the request size limit triggers less often
194
- e2ce790 Fixed #2737 - The zone provider needs to get acquainted with OpenSolaris
195
- aea1e5f Update Red Hat spec file for 0.25.1
196
- fbdded7 Ticket #2685 (Type error in ssh_authorized_keys)
197
- 4d9f76a Fix for #2745 fakedata tests not working
198
- b4bcfe9 Fix for #2736, target doesn't work for ssh_authorized_keys
199
- ae528f6 Ticket #2734 PSON/JSON not serializing classes of a catalog
200
- f59f805 Bug #1900 Parsing of quoted $ in stdin
201
- 6ba122f Fixing #2735 - node classes are immed. added to classlist
202
- bca3b70 Bundling of pure ruby json lib as "pson"
203
- ce46be5 Proposed alternative solution for #2664 (REGEX / DIV lexing)
204
- b0518c3 Fix for #2681 (duplicate resource)
205
- 8a73082 Fix #2707 config_version fails more helpfully
206
- 54ded1b Fixes #1719, this avoids calling the external binary *which* everytime we are looking for a binary
207
- 4c3c279 Updated required Facter version in README
208
- fcce46a Fixed #2702 - Set :outputdir to "doc" if not specified
209
- 3940dfb Fixed #2674 - createpackage.sh: problem finding install.rb
210
- 3b548f4 Fix #2699 - Use --masterport for PUPPET_PORT variable
211
- a75bf50 This updates the portage provider in three ways:
212
- ad86e9e Fixes #2688. Macauthorization provider now handles booleans internally correctly.
213
- d891f7a Ticket #2676 (a typo)
214
- bfba2cd Fix #2672 - Make sure nodenames keep their underscores when used as classname
215
- db67e5f Added rcov exclusion to Rakefile
216
197
 
217
198
  0.25.1
218
199
  ======
@@ -258,6 +239,9 @@ ad86e9e Fixes #2688. Macauthorization provider now handles booleans internally
258
239
  d891f7a Ticket #2676 (a typo)
259
240
  bfba2cd Fix #2672 - Make sure nodenames keep their underscores when used as classname
260
241
  db67e5f Added rcov exclusion to Rakefile
242
+
243
+ 0.25.1rc1
244
+ =========
261
245
  6912a7e Incremented version to 0.25.1
262
246
  fd322da Fixes #1538 - Fixes the yumrepo backtrace in noop mode.
263
247
  6551e86 Fix #2664 - Mathematic expressions mis-lexed as Regex
@@ -503,138 +487,6 @@ a6816ff Set ENV['PATH'] to an empty string if non-existent
503
487
  603b9cf Change the diff default output to "unified"
504
488
  9bc9b5c Added missing colon to suntab
505
489
  0f2d70d Fixed #2087 and refactored the code that gets the smf service state
506
- 3f070c1 Using the logging utilities to clean up module warnings
507
- feb7f89 Fixing #1064 - Deprecating module 'plugins' directories
508
- ccf4e69 Removing deprecated :pluginpath setting
509
- 4036de9 Fixing #2094 - filebucket failures are clearer now
510
- ed876e0 Refactoring part of the file/filebucket integration
511
- bd81c25 Adding tests for file/backup behaviour
512
- c45ebfa Fixed pi binary so --meta option works and updated documentation
513
- d2080a5 Fixing #2323 - Modules use environments correctly
514
- b9e632f Fixed #2102 - Rails feature update fixed for Debian and Ubuntu
515
- 1c4ef61 Fixed #2052 - Added -e option to puppet --help output
516
- d332333 Fix #2333 - Make sure lexer skip whitespace on non-token
517
- 5fbf63c Updated split function and add split function unit tests (courtesy of Thomas Bellman)
518
- a585bdd * provider/augeas: strip whitespace and ignore blank lines
519
- a94d2de Fixed pi tests
520
- 5f7455e Fixed #2222 - Cleanup pi binary options and --help output
521
- 134ae3e Fixing #2329 - puppetqd tests now pass
522
- de55e19 Cleaning up scope tests a bit
523
- e4ae870 Fixing #2336 - qualified variables only throw warnings
524
- 607b01e Fix #2246 - take2: make sure we run the rails tag query only when needed
525
- 06b919d Fix collector specs which were not working
526
- 2945f8d Make sure overriding a tag also produces a tag
527
- e142ca6 Removed a unit test which tested munging which is no longer done in the type
528
- d8ee6cf Clearn up a parsing error reported by the tests
529
- 446557f vim: several improvements + cleanup
530
- 9152678 Fixed #2229 - Red Hat init script error
531
- b5a8c4d Fix #1907 (or sort) - 'require' puppet function
532
- 74730df #2332: Remove trailing slashes from path commands in the plugin
533
- 1a89455 Changing the preferred serialization format to json
534
- 0de70b7 Switching Queueing to using JSON instead of YAML
535
- 7b33b6d Adding JSON support to Catalogs
536
- c0bd0aa Providing JSON support to the Resource class
537
- c16fd1b Adding a JSON utility module for providing Ruby compat
538
- f059c51 Adding JSON support to Puppet::Relationship
539
- 7f322b3 Adding a JSON format
540
- 7666597 Allowing formats to specify the individual method names to use
541
- d40068f Allowing formats to specify the methods they require
542
- 024ccf5 Adding a "json" feature
543
- c8b382d Fix some tests who were missing some actions
544
- f9516d4 Make sure virtual and rails query use tags when tag are searched
545
- b5855ec Make sure resources are tagged with the user tag on the server
546
- d69fffb Fix #2246 - Array tagged resources can't be collected or exported
547
- 6ce0d1e Partial fix for #2329
548
- 4f2c066 Removed extra whitespace from end of lines
549
- 97e6975 Changed indentation to be more consistent with style guide (4 spaces per level)
550
- 41ce18c Changed tabs to spaces without interfering with indentation or alignment
551
- f3b4092 Fix #2308 - Mongrel should use X-Forwarded-For
552
- 7b0413e Fixes Bug #2324 - Puppetd fails to start without rails
553
- 48d5e8c Enhance versioncmp documentation
554
- ef56ba5 * provider/augeas: minor spec test cleanup
555
- d322329 * provider/augeas: allow escaped whitespace and brackets in paths
556
- 9735c50 * provider/augeas: match comparison uses '==' and '!=' again
557
- dbfa61b * provider/augeas (process_match): no match results in empty array
558
- 386923e * provider/augeas: remove useless checks for nil
559
- 171669a * provider/augeas: simplify evaluation in process_get/match
560
- 51cc752 * provider/augeas (open_augeas): use Augeas flag names, not ints
561
- 4951cdf * provider/augeas: ensure Augeas connection is always closed
562
- 0d5a24d * provider/augeas: minor code cleanup
563
- cea7bb5 * provider/augeas (parse_commands): use split to split string into lines
564
- 95bd826 * provider/augeas: remove trailing whitespace (no functional change)
565
- 7c5125b Brought in lutters parse_commands patch and integrated it into the type. This includes reworking the get and match commands as well. This change introduces a few small changes. These are:
566
- 6ce8154 Removed --no-chain-reply-to in rake mail_patches task
567
- 4ef7bba Removing --no-thread from the mail_patches rake target
568
- 508934b Fixing a bunch of warnings
569
- fb0ed7a Fixing tests broken by a recent fix to Cacher
570
- 650029e Always providing a value for 'exported' on Rails resources
571
- f1dba91 Fixing #2230 - exported resources work again
572
- 5522eb8 Disabling the catalog cache, so puppetqd is compatible with storeconfigs
573
- abbb282 Fixing the rails feature to be compatible with 2.1+
574
- 907b39b Using Message acknowledgement in queueing
575
- 42247f0 Fixing #2315 - ca --generate works again
576
- d7be033 Fix #2220 - Make sure stat is refreshed while managing Files
577
- e4d5966 Added puppet branding to format patch command
578
- 00d5139 vim: Remove another mention of 'site' from syntax
579
- 9067abd vim: Highlight parameters with 'plusignment' operator
580
- 736b0e4 vim: Highlight strings in single quotes
581
- ce01c95 vim: Clean up syntax spacing
582
- 3af2dbf JRuby OpenSSL implementation is more strict than real ruby one and requires certificate serial number to be strictly positive.
583
- 62534a1 Logging when a cached catalog is used.
584
- ff5c44f Changing Puppet::Cacher::Expirer#expired? method name
585
- e3d4c8e Fixing #2240 - external node failures now log output
586
- bc1445b Fixing #2237 - client_yaml dir is always created by puppetd
587
- e0c19f9 Fixing #2228 - --logdest works again in puppetd and puppetmasterd
588
- ab34cf6 Fixing puppetmasterd tests when missing rack
589
- 9d5d0a0 Fixing the Agent so puppetrun actually works server-side
590
- b0ef08b Fixing #2248 - --no-client correctly leaves off client
591
- b83b159 Fixing #2243 - puppetrun works again
592
- 3d2189f Fixed #2304 - Added naggen script to directly generate nagios configuration files from a StoreConfigs Rails database
593
- 700ad5b Sync conf/redhat/puppet.spec with Fedora/EPEL
594
- 3ec3f91 Fixed #2280 - Detailed exit codes fix
595
- f98d49f Fixing #2253 - pluginsync failures propagate correctly
596
- d860a2f Fixing a transaction test that had some broken plumbing
597
- a728757 Refactoring resource generation slightly
598
- 6e824d8 Adding a Spec lib directory and moving tmpfile to it
599
- 1d69dbf Extracting a method from eval_resource in Transaction
600
- 7650fb2 Not trying to load files that get removed in pluginsyncing
601
- 3995e70 Fix #2300 - Update ssh_authorized_key documentation
602
- cb4a4d3 Changed version to allow Rake to work. Minor edit to Rakefile
603
- 99f666f enable maillist on centos, redhat, fedora
604
- e13befa Fixing #2288 - fixing the tests broken by my attr_ttl code
605
- a406d58 Fix for #2234: test fails with old Rack version
606
- c189b46 Fixing #2273 - file purging works more intuitively
607
- 138f19f Caching whether named autoloaded files are missing
608
- 415553e Adding caching of file metadata to the autoloader
609
- d489a2b Adding modulepath caching to the Autoloader
610
- 5f1c228 Adding caching to the Environment class
611
- 047ab78 Adding TTL support to attribute caching
612
- 6a413d2 Fixed #2666 - Broken docstring formatting
613
- 469604f Deprecating factsync - pluginsync should be used instead
614
- d39c485 Added spec and unit tests to the Rakefile files list and fixed CI rake tasks
615
- e1a7f84 Added install.rb to Rakefile package task
616
- e180a91 Fixed #2271 - Fix to puppetd documentation
617
- 4bf2980 Protecting Stomp client against internal failures
618
- f4cb8f3 Adding some usability bits to puppetqd
619
- a18298a Refactoring the stomp client and tests a bit
620
- 2771918 Relying on threads rather than sleeping for puppetqd
621
- 07ff4be Fixing #2250 - Missing templates throw a helpful error
622
- 7ce42da Fixing #2273 - CA location is set correctly in puppetca
623
- e1779c7 RackXMLRPC: buffer request contents in memory, as a real string.
624
- fb957cc Modules now can find their own paths
625
- c608409 Moving file-searching code out of Puppet::Module
626
- 83ba0e5 Fixing #2234 - fixing all of the tests broken by my bindaddress fix
627
- 4f3a67f Fixing #2221 - pluginsignore should work again
628
- 2d580c2 Fix snippets tests failing because of activated storeconfigs
629
- 8c718c9 Fix failing test: file.close! and file.path ordering fix
630
- 17f2c7d Confine stomp tests to Stomp enabled systems
631
- 6a80b76 Fix some master failing tests
632
- 172422f Fix bug #2124 - ssh_authorized_key always changes target if target is not defined
633
- f945b66 Fixing #2265 - rack is loaded with features rather than manually
634
- 5aef915 Added .git to pluginsignore default list of ignores
635
- 6db5e8d Cleanup of the Puppet Rakefile and removal of the requirement for the Reductive Build Library
636
- 5cc4910 Fix #1409 once again, including test
637
- a6af5bf Added split function
638
490
 
639
491
  0.25.0beta2
640
492
  ===========
@@ -770,6 +622,9 @@ f945b66 Fixing #2265 - rack is loaded with features rather than manually
770
622
  6db5e8d Cleanup of the Puppet Rakefile and removal of the requirement for the Reductive Build Library
771
623
  5cc4910 Fix #1409 once again, including test
772
624
  a6af5bf Added split function
625
+
626
+ 0.25.0beta1
627
+ ===========
773
628
  2dd55fc Fixing #2200 - puppetqd expects Daemon to be a class
774
629
  c016062 Removing unneeded test stubs
775
630
  1a2e1bc Fixing #2195 - the Server class handles bindaddress
data/ext/puppetlast CHANGED
@@ -12,5 +12,5 @@ Puppet[:name] = "puppetmasterd"
12
12
  Puppet::Node::Facts.terminus_class = :yaml
13
13
 
14
14
  Puppet::Node::Facts.search("*").sort { |a,b| a.name <=> b.name }.each do |node|
15
- puts "#{node.name} #{node.expired? ? 'cached expired, ' : ''}checked in #{((Time.now - Time.parse(node.values[:_timestamp])) / 60).floor} minutes ago"
15
+ puts "#{node.name} #{node.expired? ? 'cached expired, ' : ''}checked in #{((Time.now - Time.parse(node.values[:_timestamp].to_s)) / 60).floor} minutes ago"
16
16
  end
data/lib/puppet.rb CHANGED
@@ -24,7 +24,7 @@ require 'puppet/util/suidmanager'
24
24
  # it's also a place to find top-level commands like 'debug'
25
25
 
26
26
  module Puppet
27
- PUPPETVERSION = '0.25.3'
27
+ PUPPETVERSION = '0.25.4'
28
28
 
29
29
  def Puppet.version
30
30
  return PUPPETVERSION
data/lib/puppet/agent.rb CHANGED
@@ -51,6 +51,8 @@ class Puppet::Agent
51
51
  with_client do |client|
52
52
  begin
53
53
  sync.synchronize { lock { client.run(*args) } }
54
+ rescue SystemExit,NoMemoryError
55
+ raise
54
56
  rescue Exception => detail
55
57
  puts detail.backtrace if Puppet[:trace]
56
58
  Puppet.err "Could not run %s: %s" % [client_class, detail]
@@ -122,6 +124,8 @@ class Puppet::Agent
122
124
  def with_client
123
125
  begin
124
126
  @client = client_class.new
127
+ rescue SystemExit,NoMemoryError
128
+ raise
125
129
  rescue Exception => detail
126
130
  puts detail.backtrace if Puppet[:trace]
127
131
  Puppet.err "Could not create instance of %s: %s" % [client_class, detail]
@@ -1,5 +1,6 @@
1
1
  require 'puppet'
2
2
  require 'puppet/application'
3
+ require 'puppet/configurer'
3
4
  require 'puppet/network/handler'
4
5
  require 'puppet/network/client'
5
6
 
@@ -124,9 +125,14 @@ Puppet::Application.new(:puppet) do
124
125
 
125
126
  catalog.retrieval_duration = Time.now - starttime
126
127
 
128
+ configurer = Puppet::Configurer.new
129
+ configurer.execute_prerun_command
130
+
127
131
  # And apply it
128
132
  transaction = catalog.apply
129
133
 
134
+ configurer.execute_postrun_command
135
+
130
136
  status = 0
131
137
  if not Puppet[:noop] and options[:detailed_exitcodes] then
132
138
  transaction.generate_report
@@ -135,9 +141,7 @@ Puppet::Application.new(:puppet) do
135
141
  end
136
142
  exit(status)
137
143
  rescue => detail
138
- if Puppet[:trace]
139
- puts detail.backtrace
140
- end
144
+ puts detail.backtrace if Puppet[:trace]
141
145
  if detail.is_a?(XMLRPC::FaultException)
142
146
  $stderr.puts detail.message
143
147
  else
@@ -5,6 +5,8 @@ require 'puppet/network/http_pool'
5
5
  require 'puppet/util'
6
6
 
7
7
  class Puppet::Configurer
8
+ class CommandHookError < RuntimeError; end
9
+
8
10
  require 'puppet/configurer/fact_handler'
9
11
  require 'puppet/configurer/plugin_handler'
10
12
 
@@ -39,6 +41,14 @@ class Puppet::Configurer
39
41
  @catalog = nil
40
42
  end
41
43
 
44
+ def execute_postrun_command
45
+ execute_from_setting(:postrun_command)
46
+ end
47
+
48
+ def execute_prerun_command
49
+ execute_from_setting(:prerun_command)
50
+ end
51
+
42
52
  # Initialize and load storage
43
53
  def dostorage
44
54
  begin
@@ -75,6 +85,8 @@ class Puppet::Configurer
75
85
  download_plugins()
76
86
 
77
87
  download_fact_plugins()
88
+
89
+ execute_prerun_command
78
90
  end
79
91
 
80
92
  # Get the remote catalog, yo. Returns nil if no catalog can be found.
@@ -93,6 +105,8 @@ class Puppet::Configurer
93
105
  duration = thinmark do
94
106
  result = catalog_class.find(name, fact_options.merge(:ignore_cache => true))
95
107
  end
108
+ rescue SystemExit,NoMemoryError
109
+ raise
96
110
  rescue Exception => detail
97
111
  puts detail.backtrace if Puppet[:trace]
98
112
  Puppet.err "Could not retrieve catalog from remote server: %s" % detail
@@ -136,6 +150,8 @@ class Puppet::Configurer
136
150
  def run(options = {})
137
151
  begin
138
152
  prepare()
153
+ rescue SystemExit,NoMemoryError
154
+ raise
139
155
  rescue Exception => detail
140
156
  puts detail.backtrace if Puppet[:trace]
141
157
  Puppet.err "Failed to prepare catalog: %s" % detail
@@ -160,6 +176,8 @@ class Puppet::Configurer
160
176
  # Now close all of our existing http connections, since there's no
161
177
  # reason to leave them lying open.
162
178
  Puppet::Network::HttpPool.clear_http_instances
179
+ ensure
180
+ execute_postrun_command
163
181
  end
164
182
 
165
183
  private
@@ -180,4 +198,14 @@ class Puppet::Configurer
180
198
 
181
199
  return timeout
182
200
  end
201
+
202
+ def execute_from_setting(setting)
203
+ return if (command = Puppet[setting]) == ""
204
+
205
+ begin
206
+ Puppet::Util.execute([command])
207
+ rescue => detail
208
+ raise CommandHookError, "Could not run command from #{setting}: #{detail}"
209
+ end
210
+ end
183
211
  end
@@ -17,6 +17,8 @@ module Puppet::Configurer::FactHandler
17
17
  begin
18
18
  reload_facter()
19
19
  Puppet::Node::Facts.find(Puppet[:certname])
20
+ rescue SystemExit,NoMemoryError
21
+ raise
20
22
  rescue Exception => detail
21
23
  puts detail.backtrace if Puppet[:trace]
22
24
  raise Puppet::Error, "Could not retrieve local facts: %s" % detail
@@ -19,6 +19,8 @@ module Puppet::Configurer::PluginHandler
19
19
  begin
20
20
  Puppet.info "Loading downloaded plugin %s" % file
21
21
  load file
22
+ rescue SystemExit,NoMemoryError
23
+ raise
22
24
  rescue Exception => detail
23
25
  Puppet.err "Could not load downloaded file %s: %s" % [file, detail]
24
26
  end
@@ -199,7 +199,12 @@ module Puppet
199
199
  reports, allowing you to correlate changes on your hosts to the source version on the server."],
200
200
  :zlib => [true,
201
201
  "Boolean; whether to use the zlib library",
202
- ]
202
+ ],
203
+ :prerun_command => ["", "A command to run before every agent run. If this command returns a non-zero
204
+ return code, the entire Puppet run will fail."],
205
+ :postrun_command => ["", "A command to run after every agent run. If this command returns a non-zero
206
+ return code, the entire Puppet run will be considered to have failed, even though it might have
207
+ performed work during the normal run."]
203
208
  )
204
209
 
205
210
  hostname = Facter["hostname"].value
@@ -25,7 +25,7 @@ class Puppet::FileServing::Mount::File < Puppet::FileServing::Mount
25
25
 
26
26
  file = ::File.join(full_path, relative_path)
27
27
 
28
- if ! FileTest.exist?(file)
28
+ if !(FileTest.exist?(file) or FileTest.symlink?(file))
29
29
  Puppet.info("File does not exist or is not accessible: #{file}")
30
30
  return nil
31
31
  end
@@ -29,6 +29,8 @@ class Puppet::Node::Facts::Facter < Puppet::Indirector::Code
29
29
  Timeout::timeout(self.timeout) do
30
30
  load file
31
31
  end
32
+ rescue SystemExit,NoMemoryError
33
+ raise
32
34
  rescue Exception => detail
33
35
  Puppet.warning "Could not load fact file %s: %s" % [fqfile, detail]
34
36
  end
@@ -40,6 +40,8 @@ class Puppet::Indirector::Ldap < Puppet::Indirector::Terminus
40
40
  found = true
41
41
  yield entry
42
42
  end
43
+ rescue SystemExit,NoMemoryError
44
+ raise
43
45
  rescue Exception => detail
44
46
  if count == 0
45
47
  # Try reconnecting to ldap if we get an exception and we haven't yet retried.
@@ -66,6 +66,8 @@ module Puppet::Network::HTTP::Handler
66
66
  check_authorization(indirection_request)
67
67
 
68
68
  send("do_%s" % indirection_request.method, indirection_request, request, response)
69
+ rescue SystemExit,NoMemoryError
70
+ raise
69
71
  rescue Exception => e
70
72
  return do_exception(response, e)
71
73
  end
@@ -144,6 +144,8 @@ module Puppet::Network
144
144
  Puppet.debug "Calling %s.%s" % [namespace, method]
145
145
  begin
146
146
  call("%s.%s" % [namespace, method.to_s],*args)
147
+ rescue SystemExit,NoMemoryError
148
+ raise
147
149
  rescue Exception => detail
148
150
  retry if self.class.error_handler(detail).execute(self, detail, namespace, method) == :retry
149
151
  end
@@ -254,6 +254,8 @@ Puppet::Type.type(:augeas).provide(:augeas) do
254
254
  when "get"; return_value = process_get(cmd_array)
255
255
  when "match"; return_value = process_match(cmd_array)
256
256
  end
257
+ rescue SystemExit,NoMemoryError
258
+ raise
257
259
  rescue Exception => e
258
260
  fail("Error sending command '#{command}' with params #{cmd_array[1..-1].inspect}/#{e.message}")
259
261
  end
@@ -335,6 +337,8 @@ Puppet::Type.type(:augeas).provide(:augeas) do
335
337
  aug.insert(path, label, before)
336
338
  else fail("Command '#{command}' is not supported")
337
339
  end
340
+ rescue SystemExit,NoMemoryError
341
+ raise
338
342
  rescue Exception => e
339
343
  fail("Error sending command '#{command}' with params #{cmd_array.inspect}/#{e.message}")
340
344
  end
@@ -27,13 +27,18 @@ Puppet::Type.type(:cron).provide(:crontab,
27
27
 
28
28
  text_line :environment, :match => %r{^\w+=}
29
29
 
30
- crontab = record_line :crontab, :fields => %w{special minute hour monthday month weekday command},
31
- :match => %r{^\s*(?:@(\w+)|(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+))\s+(.+)$},
32
- :optional => %w{special minute hour weekday month monthday}, :absent => "*"
30
+ record_line :freebsd_special, :fields => %w{special command},
31
+ :match => %r{^@(\w+)\s+(.+)$}, :pre_gen => proc { |record|
32
+ record[:special] = "@" + record[:special]
33
+ }
34
+
35
+ crontab = record_line :crontab, :fields => %w{minute hour monthday month weekday command},
36
+ :match => %r{^\s*(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(.+)$},
37
+ :optional => %w{minute hour weekday month monthday}, :absent => "*"
33
38
 
34
39
  class << crontab
35
40
  def numeric_fields
36
- fields - [:command, :special]
41
+ fields - [:command]
37
42
  end
38
43
  # Do some post-processing of the parsed record. Basically just
39
44
  # split the numeric fields on ','.
@@ -11,7 +11,7 @@ Puppet::Type.type(:package).provide :blastwave, :parent => :sun, :source => :sun
11
11
  commands :pkgget => pkgget
12
12
 
13
13
  def pkgget_with_cat(*args)
14
- withenv(:PAGER => "/usr/bin/cat") { pkgget(*args) }
14
+ Puppet::Util::Execution::withenv(:PAGER => "/usr/bin/cat") { pkgget(*args) }
15
15
  end
16
16
 
17
17
  def self.extended(mod)
@@ -41,7 +41,7 @@ Puppet::Type.type(:package).provide :blastwave, :parent => :sun, :source => :sun
41
41
  command << hash[:justme]
42
42
  end
43
43
 
44
- output = pkgget_with_cat command
44
+ output = Puppet::Util::Execution::withenv(:PAGER => "/usr/bin/cat") { pkgget command }
45
45
 
46
46
  list = output.split("\n").collect do |line|
47
47
  next if line =~ /^#/
@@ -21,14 +21,14 @@ Puppet::Type.type(:sshkey).provide(:parsed,
21
21
  :post_parse => proc { |hash|
22
22
  names = hash[:name].split(",", -1)
23
23
  hash[:name] = names.shift
24
- hash[:alias] = names
24
+ hash[:host_aliases] = names
25
25
  },
26
26
  :pre_gen => proc { |hash|
27
- if hash[:alias]
28
- names = [hash[:name], hash[:alias]].flatten
27
+ if hash[:host_aliases]
28
+ names = [hash[:name], hash[:host_aliases]].flatten
29
29
 
30
- hash[:name] = [hash[:name], hash[:alias]].flatten.join(",")
31
- hash.delete(:alias)
30
+ hash[:name] = [hash[:name], hash[:host_aliases]].flatten.join(",")
31
+ hash.delete(:host_aliases)
32
32
  end
33
33
  }
34
34
  end
@@ -220,6 +220,8 @@ class Puppet::SSL::Host
220
220
  return if certificate
221
221
  generate
222
222
  return if certificate
223
+ rescue SystemExit,NoMemoryError
224
+ raise
223
225
  rescue Exception => detail
224
226
  Puppet.err "Could not request certificate: %s" % detail.to_s
225
227
  if time < 1
@@ -86,6 +86,8 @@ class Puppet::Util::Autoload
86
86
  name = symbolize(name)
87
87
  loaded name, file
88
88
  return true
89
+ rescue SystemExit,NoMemoryError
90
+ raise
89
91
  rescue Exception => detail
90
92
  # I have no idea what's going on here, but different versions
91
93
  # of ruby are raising different errors on missing files.
@@ -123,6 +125,8 @@ class Puppet::Util::Autoload
123
125
  begin
124
126
  Kernel.require file
125
127
  loaded(name, file)
128
+ rescue SystemExit,NoMemoryError
129
+ raise
126
130
  rescue Exception => detail
127
131
  if Puppet[:trace]
128
132
  puts detail.backtrace
@@ -83,6 +83,8 @@ class Puppet::Util::Feature
83
83
 
84
84
  begin
85
85
  require lib
86
+ rescue SystemExit,NoMemoryError
87
+ raise
86
88
  rescue Exception
87
89
  Puppet.debug "Failed to load library '%s' for feature '%s'" % [lib, name]
88
90
  return false
@@ -215,4 +215,12 @@ describe "Puppet defaults" do
215
215
  Puppet.settings[:report_server].should == "report_server"
216
216
  end
217
217
  end
218
+
219
+ it "should have a 'prerun_command' that defaults to the empty string" do
220
+ Puppet.settings[:prerun_command].should == ""
221
+ end
222
+
223
+ it "should have a 'postrun_command' that defaults to the empty string" do
224
+ Puppet.settings[:postrun_command].should == ""
225
+ end
218
226
  end
@@ -173,6 +173,9 @@ describe "Puppet" do
173
173
  describe "the main command" do
174
174
  before :each do
175
175
  Puppet.stubs(:[])
176
+ Puppet.settings.stubs(:use)
177
+ Puppet.stubs(:[]).with(:prerun_command).returns ""
178
+ Puppet.stubs(:[]).with(:postrun_command).returns ""
176
179
  Puppet.stubs(:[]).with(:trace).returns(true)
177
180
 
178
181
  @puppet.options.stubs(:[])
@@ -277,6 +280,16 @@ describe "Puppet" do
277
280
  @puppet.main
278
281
  end
279
282
 
283
+ it "should call the prerun and postrun commands on a Configurer instance" do
284
+ configurer = stub 'configurer'
285
+
286
+ Puppet::Configurer.expects(:new).returns configurer
287
+ configurer.expects(:execute_prerun_command)
288
+ configurer.expects(:execute_postrun_command)
289
+
290
+ @puppet.main
291
+ end
292
+
280
293
  it "should apply the catalog" do
281
294
  @catalog.expects(:apply)
282
295
 
@@ -7,6 +7,11 @@ require File.dirname(__FILE__) + '/../spec_helper'
7
7
  require 'puppet/configurer'
8
8
 
9
9
  describe Puppet::Configurer do
10
+ before do
11
+ Puppet.settings.stubs(:use).returns(true)
12
+ @agent = Puppet::Configurer.new
13
+ end
14
+
10
15
  it "should include the Plugin Handler module" do
11
16
  Puppet::Configurer.ancestors.should be_include(Puppet::Configurer::PluginHandler)
12
17
  end
@@ -19,6 +24,52 @@ describe Puppet::Configurer do
19
24
  Puppet.settings.expects(:value).with(:puppetdlockfile).returns("/my/lock")
20
25
  Puppet::Configurer.lockfile_path.should == "/my/lock"
21
26
  end
27
+
28
+ describe "when executing a pre-run hook" do
29
+ it "should do nothing if the hook is set to an empty string" do
30
+ Puppet.settings[:prerun_command] = ""
31
+ Puppet::Util.expects(:exec).never
32
+
33
+ @agent.execute_prerun_command
34
+ end
35
+
36
+ it "should execute any pre-run command provided via the 'prerun_command' setting" do
37
+ Puppet.settings[:prerun_command] = "/my/command"
38
+ Puppet::Util.expects(:execute).with { |args| args[0] == "/my/command" }
39
+
40
+ @agent.execute_prerun_command
41
+ end
42
+
43
+ it "should fail if the command fails" do
44
+ Puppet.settings[:prerun_command] = "/my/command"
45
+ Puppet::Util.expects(:execute).raises Puppet::ExecutionFailure
46
+
47
+ lambda { @agent.execute_prerun_command }.should raise_error(Puppet::Configurer::CommandHookError)
48
+ end
49
+ end
50
+
51
+ describe "when executing a post-run hook" do
52
+ it "should do nothing if the hook is set to an empty string" do
53
+ Puppet.settings[:postrun_command] = ""
54
+ Puppet::Util.expects(:exec).never
55
+
56
+ @agent.execute_postrun_command
57
+ end
58
+
59
+ it "should execute any post-run command provided via the 'postrun_command' setting" do
60
+ Puppet.settings[:postrun_command] = "/my/command"
61
+ Puppet::Util.expects(:execute).with { |args| args[0] == "/my/command" }
62
+
63
+ @agent.execute_postrun_command
64
+ end
65
+
66
+ it "should fail if the command fails" do
67
+ Puppet.settings[:postrun_command] = "/my/command"
68
+ Puppet::Util.expects(:execute).raises Puppet::ExecutionFailure
69
+
70
+ lambda { @agent.execute_postrun_command }.should raise_error(Puppet::Configurer::CommandHookError)
71
+ end
72
+ end
22
73
  end
23
74
 
24
75
  describe Puppet::Configurer, "when executing a catalog run" do
@@ -74,6 +125,12 @@ describe Puppet::Configurer, "when executing a catalog run" do
74
125
  catalog.expects(:apply).never # because we're not yielding
75
126
  @agent.run
76
127
  end
128
+
129
+ it "should execute post-run hooks after the run" do
130
+ @agent.expects(:execute_postrun_command)
131
+
132
+ @agent.run
133
+ end
77
134
  end
78
135
 
79
136
  describe Puppet::Configurer, "when retrieving a catalog" do
@@ -213,6 +270,9 @@ describe Puppet::Configurer, "when preparing for a run" do
213
270
  Puppet.settings.stubs(:use).returns(true)
214
271
  @agent = Puppet::Configurer.new
215
272
  @agent.stubs(:dostorage)
273
+ @agent.stubs(:download_fact_plugins)
274
+ @agent.stubs(:download_plugins)
275
+ @agent.stubs(:execute_prerun_command)
216
276
  @facts = {"one" => "two", "three" => "four"}
217
277
  end
218
278
 
@@ -223,16 +283,19 @@ describe Puppet::Configurer, "when preparing for a run" do
223
283
  end
224
284
 
225
285
  it "should download fact plugins" do
226
- @agent.stubs(:dostorage)
227
286
  @agent.expects(:download_fact_plugins)
228
287
 
229
288
  @agent.prepare
230
289
  end
231
290
 
232
291
  it "should download plugins" do
233
- @agent.stubs(:dostorage)
234
292
  @agent.expects(:download_plugins)
235
293
 
236
294
  @agent.prepare
237
295
  end
296
+
297
+ it "should perform the pre-run commands" do
298
+ @agent.expects(:execute_prerun_command)
299
+ @agent.prepare
300
+ end
238
301
  end
@@ -8,12 +8,31 @@ describe provider_class do
8
8
  before do
9
9
  @sshkey_class = Puppet::Type.type(:sshkey)
10
10
  @provider_class = @sshkey_class.provider(:parsed)
11
+ @key = 'AAAAB3NzaC1yc2EAAAABIwAAAQEAzwHhxXvIrtfIwrudFqc8yQcIfMudrgpnuh1F3AV6d2BrLgu/yQE7W5UyJMUjfj427sQudRwKW45O0Jsnr33F4mUw+GIMlAAmp9g24/OcrTiB8ZUKIjoPy/cO4coxGi8/NECtRzpD/ZUPFh6OEpyOwJPMb7/EC2Az6Otw4StHdXUYw22zHazBcPFnv6zCgPx1hA7QlQDWTu4YcL0WmTYQCtMUb3FUqrcFtzGDD0ytosgwSd+JyN5vj5UwIABjnNOHPZ62EY1OFixnfqX/+dUwrFSs5tPgBF/KkC6R7tmbUfnBON6RrGEmu+ajOTOLy23qUZB4CQ53V7nyAWhzqSK+hw=='
11
12
  end
12
13
 
13
- it "should not drop an empty alias" do
14
- line = 'test,alias, ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAzwHhxXvIrtfIwrudFqc8yQcIfMudrgpnuh1F3AV6d2BrLgu/yQE7W5UyJMUjfj427sQudRwKW45O0Jsnr33F4mUw+GIMlAAmp9g24/OcrTiB8ZUKIjoPy/cO4coxGi8/NECtRzpD/ZUPFh6OEpyOwJPMb7/EC2Az6Otw4StHdXUYw22zHazBcPFnv6zCgPx1hA7QlQDWTu4YcL0WmTYQCtMUb3FUqrcFtzGDD0ytosgwSd+JyN5vj5UwIABjnNOHPZ62EY1OFixnfqX/+dUwrFSs5tPgBF/KkC6R7tmbUfnBON6RrGEmu+ajOTOLy23qUZB4CQ53V7nyAWhzqSK+hw=='
15
- parsed = @provider_class.parse_line(line)
16
- parsed[:alias].should == ["alias",""]
14
+ it "should parse the name from the first field" do
15
+ @provider_class.parse_line('test ssh-rsa '+@key)[:name].should == "test"
16
+ end
17
+
18
+ it "should parse the first component of the first field as the name" do
19
+ @provider_class.parse_line('test,alias ssh-rsa '+@key)[:name].should == "test"
20
+ end
21
+
22
+ it "should parse host_aliases from the remaining components of the first field" do
23
+ @provider_class.parse_line('test,alias ssh-rsa '+@key)[:host_aliases].should == ["alias"]
24
+ end
25
+
26
+ it "should parse multiple host_aliases" do
27
+ @provider_class.parse_line('test,alias1,alias2,alias3 ssh-rsa '+@key)[:host_aliases].should == ["alias1","alias2","alias3"]
28
+ end
29
+
30
+ it "should not drop an empty host_alias" do
31
+ @provider_class.parse_line('test,alias, ssh-rsa '+@key)[:host_aliases].should == ["alias",""]
32
+ end
33
+
34
+ it "should recognise when there are no host aliases" do
35
+ @provider_class.parse_line('test ssh-rsa '+@key)[:host_aliases].should == []
17
36
  end
18
37
 
19
38
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.25.3
4
+ version: 0.25.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Reductive Labs
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-13 00:00:00 +11:00
12
+ date: 2010-01-29 00:00:00 +11:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -958,7 +958,6 @@ files:
958
958
  - spec/unit/provider/zone/solaris.rb
959
959
  - spec/unit/provider/mount/parsed.rb
960
960
  - spec/unit/provider/zfs/solaris.rb
961
- - spec/unit/provider/cron/crontab.rb
962
961
  - spec/unit/provider/mount.rb
963
962
  - spec/unit/provider/selboolean.rb
964
963
  - spec/unit/provider/selmodule-example.pp
@@ -1,21 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- Dir.chdir(File.dirname(__FILE__)) { (s = lambda { |f| File.exist?(f) ? require(f) : Dir.chdir("..") { s.call(f) } }).call("spec/spec_helper.rb") }
4
-
5
- describe Puppet::Type.type(:cron).provider(:crontab) do
6
- before :each do
7
- @cron_type = Puppet::Type.type(:cron)
8
- @provider = @cron_type.provider(:crontab)
9
- end
10
-
11
- it "should round-trip the name as a comment for @special events" do
12
- parse = @provider.parse <<-CRON
13
- # Puppet Name: test
14
- @reboot /bin/echo > /tmp/puppet.txt
15
- CRON
16
- prefetch = @provider.prefetch_hook(parse)
17
-
18
- @provider.to_line(prefetch[0]).should =~ /Puppet Name: test/
19
- end
20
-
21
- end