puppet 2.7.8 → 2.7.9

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 (98) hide show
  1. data/CHANGELOG +6 -0
  2. data/README_DEVELOPER.md +63 -0
  3. data/conf/redhat/puppet.spec +4 -1
  4. data/ext/puppetstoredconfigclean.rb +39 -27
  5. data/lib/puppet.rb +1 -1
  6. data/lib/puppet/application/agent.rb +33 -25
  7. data/lib/puppet/application/apply.rb +15 -1
  8. data/lib/puppet/application/module.rb +3 -0
  9. data/lib/puppet/defaults.rb +4 -0
  10. data/lib/puppet/face/module.rb +12 -0
  11. data/lib/puppet/face/module/build.rb +31 -0
  12. data/lib/puppet/face/module/changes.rb +38 -0
  13. data/lib/puppet/face/module/clean.rb +30 -0
  14. data/lib/puppet/face/module/generate.rb +40 -0
  15. data/lib/puppet/face/module/install.rb +83 -0
  16. data/lib/puppet/face/module/search.rb +66 -0
  17. data/lib/puppet/indirector/exec.rb +1 -1
  18. data/lib/puppet/module_tool.rb +97 -0
  19. data/lib/puppet/module_tool/applications.rb +12 -0
  20. data/lib/puppet/module_tool/applications/application.rb +83 -0
  21. data/lib/puppet/module_tool/applications/builder.rb +91 -0
  22. data/lib/puppet/module_tool/applications/checksummer.rb +47 -0
  23. data/lib/puppet/module_tool/applications/cleaner.rb +16 -0
  24. data/lib/puppet/module_tool/applications/generator.rb +141 -0
  25. data/lib/puppet/module_tool/applications/installer.rb +89 -0
  26. data/lib/puppet/module_tool/applications/searcher.rb +40 -0
  27. data/lib/puppet/module_tool/applications/unpacker.rb +70 -0
  28. data/lib/puppet/module_tool/cache.rb +56 -0
  29. data/lib/puppet/module_tool/checksums.rb +52 -0
  30. data/lib/puppet/module_tool/contents_description.rb +82 -0
  31. data/lib/puppet/module_tool/dependency.rb +24 -0
  32. data/lib/puppet/module_tool/metadata.rb +141 -0
  33. data/lib/puppet/module_tool/modulefile.rb +75 -0
  34. data/lib/puppet/module_tool/repository.rb +79 -0
  35. data/lib/puppet/module_tool/skeleton.rb +34 -0
  36. data/lib/puppet/module_tool/skeleton/templates/generator/Modulefile.erb +11 -0
  37. data/lib/puppet/module_tool/skeleton/templates/generator/README.erb +16 -0
  38. data/lib/puppet/module_tool/skeleton/templates/generator/manifests/init.pp.erb +41 -0
  39. data/lib/puppet/module_tool/skeleton/templates/generator/metadata.json +12 -0
  40. data/lib/puppet/module_tool/skeleton/templates/generator/spec/spec_helper.rb +17 -0
  41. data/lib/puppet/module_tool/skeleton/templates/generator/tests/init.pp.erb +11 -0
  42. data/lib/puppet/module_tool/utils.rb +5 -0
  43. data/lib/puppet/module_tool/utils/interrogation.rb +25 -0
  44. data/lib/puppet/network/http/api/v1.rb +2 -1
  45. data/lib/puppet/parser/functions/create_resources.rb +19 -4
  46. data/lib/puppet/rails.rb +1 -1
  47. data/lib/puppet/rails/database/schema.rb +1 -1
  48. data/lib/puppet/ssl/host.rb +16 -8
  49. data/lib/puppet/transaction.rb +1 -1
  50. data/lib/puppet/type/file.rb +7 -2
  51. data/lib/puppet/type/file/ctime.rb +1 -1
  52. data/lib/puppet/type/file/mtime.rb +1 -1
  53. data/lib/puppet/type/file/type.rb +1 -1
  54. data/lib/puppet/util/queue/stomp.rb +19 -6
  55. data/lib/puppet/util/zaml.rb +39 -5
  56. data/spec/fixtures/releases/jamtur01-apache/Modulefile +2 -0
  57. data/spec/fixtures/releases/jamtur01-apache/files/httpd +24 -0
  58. data/spec/fixtures/releases/jamtur01-apache/files/test.vhost +18 -0
  59. data/spec/fixtures/releases/jamtur01-apache/lib/puppet/provider/a2mod/debian.rb +21 -0
  60. data/spec/fixtures/releases/jamtur01-apache/lib/puppet/type/a2mod.rb +12 -0
  61. data/spec/fixtures/releases/jamtur01-apache/manifests/dev.pp +5 -0
  62. data/spec/fixtures/releases/jamtur01-apache/manifests/init.pp +34 -0
  63. data/spec/fixtures/releases/jamtur01-apache/manifests/params.pp +17 -0
  64. data/spec/fixtures/releases/jamtur01-apache/manifests/php.pp +5 -0
  65. data/spec/fixtures/releases/jamtur01-apache/manifests/ssl.pp +15 -0
  66. data/spec/fixtures/releases/jamtur01-apache/manifests/vhost.pp +15 -0
  67. data/spec/fixtures/releases/jamtur01-apache/metadata.json +1 -0
  68. data/spec/fixtures/releases/jamtur01-apache/templates/vhost-default.conf.erb +20 -0
  69. data/spec/fixtures/releases/jamtur01-apache/tests/apache.pp +1 -0
  70. data/spec/fixtures/releases/jamtur01-apache/tests/dev.pp +1 -0
  71. data/spec/fixtures/releases/jamtur01-apache/tests/init.pp +1 -0
  72. data/spec/fixtures/releases/jamtur01-apache/tests/php.pp +1 -0
  73. data/spec/fixtures/releases/jamtur01-apache/tests/ssl.pp +1 -0
  74. data/spec/fixtures/releases/jamtur01-apache/tests/vhost.pp +2 -0
  75. data/spec/integration/module_tool_spec.rb +477 -0
  76. data/spec/integration/util/windows/security_spec.rb +1 -1
  77. data/spec/unit/application/agent_spec.rb +26 -0
  78. data/spec/unit/application/apply_spec.rb +12 -1
  79. data/spec/unit/face/module/build_spec.rb +30 -0
  80. data/spec/unit/face/module/changes_spec.rb +30 -0
  81. data/spec/unit/face/module/clean_spec.rb +30 -0
  82. data/spec/unit/face/module/generate_spec.rb +30 -0
  83. data/spec/unit/face/module/install_spec.rb +75 -0
  84. data/spec/unit/face/module/search_spec.rb +40 -0
  85. data/spec/unit/face/module_spec.rb +3 -0
  86. data/spec/unit/file_bucket/dipper_spec.rb +1 -1
  87. data/spec/unit/module_tool/application_spec.rb +29 -0
  88. data/spec/unit/module_tool/metadata_spec.rb +11 -0
  89. data/spec/unit/module_tool/repository_spec.rb +52 -0
  90. data/spec/unit/module_tool_spec.rb +38 -0
  91. data/spec/unit/network/http/api/v1_spec.rb +4 -0
  92. data/spec/unit/parser/functions/create_resources_spec.rb +21 -4
  93. data/spec/unit/rails_spec.rb +89 -158
  94. data/spec/unit/ssl/host_spec.rb +10 -33
  95. data/spec/unit/type/file_spec.rb +30 -0
  96. data/spec/unit/util/queue/stomp_spec.rb +9 -4
  97. data/spec/unit/util/zaml_spec.rb +37 -0
  98. metadata +77 -11
data/CHANGELOG CHANGED
@@ -1,3 +1,9 @@
1
+ 2.7.9
2
+ ===
3
+ da11dc7 Fix Ruby 1.8.5-incompatible code in FileBucket::Dipper spec
4
+ 737c2f6 Fix Ruby 1.8.5-incompatible code in Transaction#eval_generate
5
+ 042925d Fix Ruby 1.8.5-incompatible code in spec setup
6
+
1
7
  2.7.8
2
8
  ===
3
9
  3eff60a Readying for 2.7.8rc release
@@ -0,0 +1,63 @@
1
+ # Developer README #
2
+
3
+ This file is intended to provide a place for developers and contributors to
4
+ document what other developers need to know about changes made to Puppet.
5
+
6
+ # UTF-8 Handling #
7
+
8
+ As Ruby 1.9 becomes more commonly used with Puppet, developers should be aware
9
+ of major changes to the way Strings and Regexp objects are handled.
10
+ Specifically, every instance of these two classes will have an encoding
11
+ attribute determined in a number of ways.
12
+
13
+ * If the source file has an encoding specified in the magic comment at the
14
+ top, the instance will take on that encoding.
15
+ * Otherwise, the encoding will be determined by the LC\_LANG or LANG
16
+ environment variables.
17
+ * Otherwise, the encoding will default to ASCII-8BIT
18
+
19
+ ## References ##
20
+
21
+ Excellent information about the differences between encodings in Ruby 1.8 and
22
+ Ruby 1.9 is published in this blog series:
23
+ [Understanding M17n](http://links.puppetlabs.com/understanding_m17n)
24
+
25
+ ## Encodings of Regexp and String instances ##
26
+
27
+ In general, please be aware that Ruby 1.9 regular expressions need to be
28
+ compatible with the encoding of a string being used to match them. If they are
29
+ not compatible you can expect to receive and error such as:
30
+
31
+ Encoding::CompatibilityError: incompatible encoding regexp match (ASCII-8BIT
32
+ regexp with UTF-8 string)
33
+
34
+ In addition, some escape sequences were valid in Ruby 1.8 are no longer valid
35
+ in 1.9 if the regular expression is not marked as an ASCII-8BIT object. You
36
+ may expect errors like this in this situation:
37
+
38
+ SyntaxError: (irb):7: invalid multibyte escape: /\xFF/
39
+
40
+ This error is particularly common when serializing a string to other
41
+ representations like JSON or YAML. To resolve the problem you can explicitly
42
+ mark the regular expression as ASCII-8BIT using the /n flag:
43
+
44
+ "a" =~ /\342\230\203/n
45
+
46
+ Finally, any time you're thinking of a string as an array of bytes rather than
47
+ an array of characters, common when escaping a string, you should work with
48
+ everything in ASCII-8BIT. Changing the encoding will not change the data
49
+ itself and allow the Regexp and the String to deal with bytes rather than
50
+ characters.
51
+
52
+ Puppet provides a monkey patch to String which returns an encoding suitable for
53
+ byte manipulations:
54
+
55
+ # Example of how to escape non ASCII printable characters for YAML.
56
+ >> snowman = "☃"
57
+ >> snowman.to_ascii8bit.gsub(/([\x80-\xFF])/n) { |x| "\\x#{x.unpack("C")[0].to_s(16)} }
58
+ => "\\xe2\\x98\\x83"
59
+
60
+ If the Regexp is not marked as ASCII-8BIT using /n, then you can expect the
61
+ SyntaxError, invalid multibyte escape as mentioned above.
62
+
63
+ EOF
@@ -5,7 +5,7 @@
5
5
  %global confdir conf/redhat
6
6
 
7
7
  Name: puppet
8
- Version: 2.7.8
8
+ Version: 2.7.9
9
9
  #Release: 0.1rc1%{?dist}
10
10
  Release: 1%{?dist}
11
11
  Summary: A network tool for managing many disparate systems
@@ -285,6 +285,9 @@ fi
285
285
  rm -rf %{buildroot}
286
286
 
287
287
  %changelog
288
+ * Fri Dec 9 2011 Matthaus Litteken <matthaus@puppetlabs.com> - 2.7.9-1
289
+ - Update for 2.7.9
290
+
288
291
  * Thu Dec 8 2011 Matthaus Litteken <matthaus@puppetlabs.com> - 2.7.8-1
289
292
  - Update for 2.7.8
290
293
 
@@ -8,7 +8,10 @@
8
8
  # duritong adapted and improved the script a bit.
9
9
 
10
10
  require 'getoptlong'
11
- config = '/etc/puppet/puppet.conf'
11
+ require 'puppet'
12
+ require 'puppet/rails'
13
+
14
+ config = Puppet[:config]
12
15
 
13
16
  def printusage(error_code)
14
17
  puts "Usage: #{$0} [ list of hostnames as stored in hosts table ]"
@@ -17,14 +20,11 @@ def printusage(error_code)
17
20
  exit(error_code)
18
21
  end
19
22
 
20
-
21
- opts = GetoptLong.new(
22
-
23
- [ "--config", "-c", GetoptLong::REQUIRED_ARGUMENT ],
24
- [ "--help", "-h", GetoptLong::NO_ARGUMENT ],
25
- [ "--usage", "-u", GetoptLong::NO_ARGUMENT ],
26
-
27
- [ "--version", "-v", GetoptLong::NO_ARGUMENT ]
23
+ opts = GetoptLong.new(
24
+ [ "--config", "-c", GetoptLong::REQUIRED_ARGUMENT ],
25
+ [ "--help", "-h", GetoptLong::NO_ARGUMENT ],
26
+ [ "--usage", "-u", GetoptLong::NO_ARGUMENT ],
27
+ [ "--version", "-v", GetoptLong::NO_ARGUMENT ]
28
28
  )
29
29
 
30
30
  begin
@@ -51,24 +51,35 @@ end
51
51
 
52
52
  printusage(1) unless ARGV.size > 0
53
53
 
54
- require 'puppet/rails'
55
- Puppet[:config] = config
56
- Puppet.parse_config
57
- pm_conf = Puppet.settings.instance_variable_get(:@values)[:master]
54
+ if config != Puppet[:config]
55
+ Puppet[:config]=config
56
+ Puppet.settings.parse
57
+ end
58
58
 
59
- adapter = pm_conf[:dbadapter]
60
- args = {:adapter => adapter, :log_level => pm_conf[:rails_loglevel]}
59
+ master = Puppet.settings.instance_variable_get(:@values)[:master]
60
+ main = Puppet.settings.instance_variable_get(:@values)[:main]
61
+ db_config = main.merge(master)
62
+
63
+ # get default values
64
+ [:master, :main, :rails].each do |section|
65
+ Puppet.settings.params(section).each do |key|
66
+ db_config[key] ||= Puppet[key]
67
+ end
68
+ end
69
+
70
+ adapter = db_config[:dbadapter]
71
+ args = {:adapter => adapter, :log_level => db_config[:rails_loglevel]}
61
72
 
62
73
  case adapter
63
74
  when "sqlite3"
64
- args[:dbfile] = pm_conf[:dblocation]
65
- when "mysql", "postgresql"
66
- args[:host] = pm_conf[:dbserver] unless pm_conf[:dbserver].to_s.empty?
67
- args[:username] = pm_conf[:dbuser] unless pm_conf[:dbuser].to_s.empty?
68
- args[:password] = pm_conf[:dbpassword] unless pm_conf[:dbpassword].to_s.empty?
69
- args[:database] = pm_conf[:dbname] unless pm_conf[:dbname].to_s.empty?
70
- args[:port] = pm_conf[:dbport] unless pm_conf[:dbport].to_s.empty?
71
- socket = pm_conf[:dbsocket]
75
+ args[:dbfile] = db_config[:dblocation]
76
+ when "mysql", "mysql2", "postgresql"
77
+ args[:host] = db_config[:dbserver] unless db_config[:dbserver].to_s.empty?
78
+ args[:username] = db_config[:dbuser] unless db_config[:dbuser].to_s.empty?
79
+ args[:password] = db_config[:dbpassword] unless db_config[:dbpassword].to_s.empty?
80
+ args[:database] = db_config[:dbname] unless db_config[:dbname].to_s.empty?
81
+ args[:port] = db_config[:dbport] unless db_config[:dbport].to_s.empty?
82
+ socket = db_config[:dbsocket]
72
83
  args[:socket] = socket unless socket.to_s.empty?
73
84
  else
74
85
  raise ArgumentError, "Invalid db adapter #{adapter}"
@@ -78,14 +89,15 @@ args[:database] = "puppet" unless not args[:database].to_s.empty?
78
89
 
79
90
  ActiveRecord::Base.establish_connection(args)
80
91
 
81
- ARGV.each { |hostname|
92
+ ARGV.each do |hostname|
82
93
  if @host = Puppet::Rails::Host.find_by_name(hostname.strip)
83
- print "Killing #{hostname}..."
94
+ print "Removing #{hostname} from storedconfig..."
84
95
  $stdout.flush
85
96
  @host.destroy
86
97
  puts "done."
87
98
  else
88
- puts "Can't find host #{hostname}."
99
+ puts "Error: Can't find host #{hostname}."
89
100
  end
90
- }
101
+ end
102
+
91
103
  exit 0
@@ -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.7.8'
27
+ PUPPETVERSION = '2.7.9'
28
28
 
29
29
  def Puppet.version
30
30
  PUPPETVERSION
@@ -416,6 +416,35 @@ Copyright (c) 2011 Puppet Labs, LLC Licensed under the Apache 2.0 License
416
416
  cert = @host.wait_for_cert(waitforcert) unless options[:fingerprint]
417
417
  end
418
418
 
419
+ def setup_agent
420
+ # We need tomake the client either way, we just don't start it
421
+ # if --no-client is set.
422
+ require 'puppet/agent'
423
+ require 'puppet/configurer'
424
+ @agent = Puppet::Agent.new(Puppet::Configurer)
425
+
426
+ enable_disable_client(@agent) if options[:enable] or options[:disable]
427
+
428
+ @daemon.agent = agent if options[:client]
429
+
430
+ # It'd be nice to daemonize later, but we have to daemonize before the
431
+ # waitforcert happens.
432
+ @daemon.daemonize if Puppet[:daemonize]
433
+
434
+ setup_host
435
+
436
+ @objects = []
437
+
438
+ # This has to go after the certs are dealt with.
439
+ if Puppet[:listen]
440
+ unless Puppet[:onetime]
441
+ setup_listen
442
+ else
443
+ Puppet.notice "Ignoring --listen on onetime run"
444
+ end
445
+ end
446
+ end
447
+
419
448
  def setup
420
449
  setup_test if options[:test]
421
450
 
@@ -460,31 +489,10 @@ Copyright (c) 2011 Puppet Labs, LLC Licensed under the Apache 2.0 License
460
489
 
461
490
  Puppet::Resource::Catalog.indirection.cache_class = :yaml
462
491
 
463
- # We need tomake the client either way, we just don't start it
464
- # if --no-client is set.
465
- require 'puppet/agent'
466
- require 'puppet/configurer'
467
- @agent = Puppet::Agent.new(Puppet::Configurer)
468
-
469
- enable_disable_client(@agent) if options[:enable] or options[:disable]
470
-
471
- @daemon.agent = agent if options[:client]
472
-
473
- # It'd be nice to daemonize later, but we have to daemonize before the
474
- # waitforcert happens.
475
- @daemon.daemonize if Puppet[:daemonize]
476
-
477
- setup_host
478
-
479
- @objects = []
480
-
481
- # This has to go after the certs are dealt with.
482
- if Puppet[:listen]
483
- unless Puppet[:onetime]
484
- setup_listen
485
- else
486
- Puppet.notice "Ignoring --listen on onetime run"
487
- end
492
+ unless options[:fingerprint]
493
+ setup_agent
494
+ else
495
+ setup_host
488
496
  end
489
497
  end
490
498
  end
@@ -14,6 +14,14 @@ class Puppet::Application::Apply < Puppet::Application
14
14
  option("--detailed-exitcodes")
15
15
 
16
16
  option("--apply catalog", "-a catalog") do |arg|
17
+ Puppet.warning <<EOM
18
+ --apply is deprecated and will be removed in the future. Please
19
+ use 'puppet apply --catalog <catalog>'.
20
+ EOM
21
+ options[:catalog] = arg
22
+ end
23
+
24
+ option("--catalog catalog", "-c catalog") do |arg|
17
25
  options[:catalog] = arg
18
26
  end
19
27
 
@@ -46,7 +54,7 @@ USAGE
46
54
  -----
47
55
  puppet apply [-h|--help] [-V|--version] [-d|--debug] [-v|--verbose]
48
56
  [-e|--execute] [--detailed-exitcodes] [-l|--logdest <file>]
49
- [--apply <catalog>] <file>
57
+ [--apply <catalog>] [--catalog <catalog>] <file>
50
58
 
51
59
 
52
60
  DESCRIPTION
@@ -106,6 +114,11 @@ configuration options can also be generated by running puppet with
106
114
  Print extra information.
107
115
 
108
116
  * --apply:
117
+ Apply a JSON catalog (such as one generated with 'puppet master --compile'). You can
118
+ either specify a JSON file or pipe in JSON from standard input. Deprecated, please
119
+ use --catalog instead.
120
+
121
+ * --catalog:
109
122
  Apply a JSON catalog (such as one generated with 'puppet master --compile'). You can
110
123
  either specify a JSON file or pipe in JSON from standard input.
111
124
 
@@ -114,6 +127,7 @@ EXAMPLE
114
127
  -------
115
128
  $ puppet apply -l /tmp/manifest.log manifest.pp
116
129
  $ puppet apply --modulepath=/root/dev/modules -e "include ntpd::server"
130
+ $ puppet apply --catalog catalog.json
117
131
 
118
132
 
119
133
  AUTHOR
@@ -0,0 +1,3 @@
1
+ require 'puppet/application/face_base'
2
+
3
+ class Puppet::Application::Module < Puppet::Application::FaceBase; end
@@ -199,6 +199,10 @@ module Puppet
199
199
  essentially means that you can't have any code outside of a node, class, or definition other
200
200
  than in the site manifest."]
201
201
  )
202
+ Puppet.setdefaults(:module_tool,
203
+ :module_repository => ['http://forge.puppetlabs.com', "The module repository"],
204
+ :module_working_dir => ['$vardir/puppet-module', "The directory into which module tool data is stored"]
205
+ )
202
206
 
203
207
  hostname = Facter["hostname"].value
204
208
  domain = Facter["domain"].value
@@ -0,0 +1,12 @@
1
+ require 'puppet/face'
2
+ require 'puppet/module_tool'
3
+
4
+ Puppet::Face.define(:module, '1.0.0') do
5
+ copyright "Puppet Labs", 2011
6
+ license "Apache 2 license; see COPYING"
7
+
8
+ summary "Creates, installs and searches for modules on the Puppet Forge."
9
+ description <<-EOT
10
+ Creates, installs and searches for modules on the Puppet Forge.
11
+ EOT
12
+ end
@@ -0,0 +1,31 @@
1
+ Puppet::Face.define(:module, '1.0.0') do
2
+ action(:build) do
3
+ summary "Build a module release package."
4
+ description <<-EOT
5
+ Build a module release archive file by processing the Modulefile in the
6
+ module directory. The release archive file will be stored in the pkg
7
+ directory of the module directory.
8
+ EOT
9
+
10
+ returns "Pathname object representing the path to the release archive."
11
+
12
+ examples <<-EOT
13
+ Build a module release:
14
+
15
+ $ puppet module build puppetlabs-apache
16
+ notice: Building /Users/kelseyhightower/puppetlabs-apache for release
17
+ puppetlabs-apache/pkg/puppetlabs-apache-0.0.1.tar.gz
18
+ EOT
19
+
20
+ arguments "<path>"
21
+
22
+ when_invoked do |path, options|
23
+ Puppet::Module::Tool::Applications::Builder.run(path, options)
24
+ end
25
+
26
+ when_rendering :console do |return_value|
27
+ # Get the string representation of the Pathname object.
28
+ return_value.to_s
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,38 @@
1
+ Puppet::Face.define(:module, '1.0.0') do
2
+ action(:changes) do
3
+ summary "Show modified files of an installed module."
4
+ description <<-EOT
5
+ Show files that have been modified after installation of a given module
6
+ by comparing the on-disk md5 checksum of each file against the module's
7
+ metadata.
8
+ EOT
9
+
10
+ returns "Array of strings representing paths of modified files."
11
+
12
+ examples <<-EOT
13
+ Show modified files of an installed module:
14
+
15
+ $ puppet module changes /etc/puppet/modules/vcsrepo/
16
+ warning: 1 files modified
17
+ lib/puppet/provider/vcsrepo.rb
18
+ EOT
19
+
20
+ arguments "<path>"
21
+
22
+ when_invoked do |path, options|
23
+ root_path = Puppet::Module::Tool.find_module_root(path)
24
+ Puppet::Module::Tool::Applications::Checksummer.run(root_path, options)
25
+ end
26
+
27
+ when_rendering :console do |return_value|
28
+ if return_value.empty?
29
+ Puppet.notice "No modified files"
30
+ else
31
+ Puppet.warning "#{return_value.size} files modified"
32
+ end
33
+ return_value.map do |changed_file|
34
+ "#{changed_file}"
35
+ end.join("\n")
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,30 @@
1
+ Puppet::Face.define(:module, '1.0.0') do
2
+ action(:clean) do
3
+ summary "Clean the module download cache."
4
+ description <<-EOT
5
+ Clean the module download cache.
6
+ EOT
7
+
8
+ returns <<-EOT
9
+ Return a status Hash:
10
+
11
+ { :status => "success", :msg => "Cleaned module cache." }
12
+ EOT
13
+
14
+ examples <<-EOT
15
+ Clean the module download cache:
16
+
17
+ $ puppet module clean
18
+ Cleaned module cache.
19
+ EOT
20
+
21
+ when_invoked do |options|
22
+ Puppet::Module::Tool::Applications::Cleaner.run(options)
23
+ end
24
+
25
+ when_rendering :console do |return_value|
26
+ # Print the status message to the console.
27
+ return_value[:msg]
28
+ end
29
+ end
30
+ end