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
@@ -0,0 +1,40 @@
1
+ Puppet::Face.define(:module, '1.0.0') do
2
+ action(:generate) do
3
+ summary "Generate boilerplate for a new module."
4
+ description <<-EOT
5
+ Generate boilerplate for a new module by creating a directory
6
+ pre-populated with a directory structure and files recommended for
7
+ Puppet best practices.
8
+ EOT
9
+
10
+ returns "Array of Pathname objects representing paths of generated files."
11
+
12
+ examples <<-EOT
13
+ Generate a new module in the current directory:
14
+
15
+ $ puppet module generate puppetlabs-ssh
16
+ notice: Generating module at /Users/kelseyhightower/puppetlabs-ssh
17
+ puppetlabs-ssh
18
+ puppetlabs-ssh/tests
19
+ puppetlabs-ssh/tests/init.pp
20
+ puppetlabs-ssh/spec
21
+ puppetlabs-ssh/spec/spec_helper.rb
22
+ puppetlabs-ssh/spec/spec.opts
23
+ puppetlabs-ssh/README
24
+ puppetlabs-ssh/Modulefile
25
+ puppetlabs-ssh/metadata.json
26
+ puppetlabs-ssh/manifests
27
+ puppetlabs-ssh/manifests/init.pp
28
+ EOT
29
+
30
+ arguments "<name>"
31
+
32
+ when_invoked do |name, options|
33
+ Puppet::Module::Tool::Applications::Generator.run(name, options)
34
+ end
35
+
36
+ when_rendering :console do |return_value|
37
+ return_value.map {|f| f.to_s }.join("\n")
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,83 @@
1
+ Puppet::Face.define(:module, '1.0.0') do
2
+ action(:install) do
3
+ summary "Install a module from a repository or release archive."
4
+ description <<-EOT
5
+ Install a module from a release archive file on-disk or by downloading
6
+ one from a repository. Unpack the archive into the install directory
7
+ specified by the --install-dir option, which defaults to
8
+ #{Puppet.settings[:modulepath].split(File::PATH_SEPARATOR).first}
9
+ EOT
10
+
11
+ returns "Pathname object representing the path to the installed module."
12
+
13
+ examples <<-EOT
14
+ Install a module from the default repository:
15
+
16
+ $ puppet module install puppetlabs/vcsrepo
17
+ notice: Installing puppetlabs-vcsrepo-0.0.4.tar.gz to /etc/puppet/modules/vcsrepo
18
+ /etc/puppet/modules/vcsrepo
19
+
20
+ Install a specific module version from a repository:
21
+
22
+ $ puppet module install puppetlabs/vcsrepo -v 0.0.4
23
+ notice: Installing puppetlabs-vcsrepo-0.0.4.tar.gz to /etc/puppet/modules/vcsrepo
24
+ /etc/puppet/modules/vcsrepo
25
+
26
+ Install a module into a specific directory:
27
+
28
+ $ puppet module install puppetlabs/vcsrepo --install-dir=/usr/share/puppet/modules
29
+ notice: Installing puppetlabs-vcsrepo-0.0.4.tar.gz to /usr/share/puppet/modules/vcsrepo
30
+ /usr/share/puppet/modules/vcsrepo
31
+
32
+ Install a module from a release archive:
33
+
34
+ $ puppet module install puppetlabs-vcsrepo-0.0.4.tar.gz
35
+ notice: Installing puppetlabs-vcsrepo-0.0.4.tar.gz to /etc/puppet/modules/vcsrepo
36
+ /etc/puppet/modules/vcsrepo
37
+ EOT
38
+
39
+ arguments "<name>"
40
+
41
+ option "--force", "-f" do
42
+ summary "Force overwrite of existing module, if any."
43
+ description <<-EOT
44
+ Force overwrite of existing module, if any.
45
+ EOT
46
+ end
47
+
48
+ option "--install-dir=", "-i=" do
49
+ default_to { Puppet.settings[:modulepath].split(File::PATH_SEPARATOR).first }
50
+ summary "The directory into which modules are installed."
51
+ description <<-EOT
52
+ The directory into which modules are installed, defaults to the first
53
+ directory in the modulepath.
54
+ EOT
55
+ end
56
+
57
+ option "--module-repository=", "-r=" do
58
+ default_to { Puppet.settings[:module_repository] }
59
+ summary "Module repository to use."
60
+ description <<-EOT
61
+ Module repository to use.
62
+ EOT
63
+ end
64
+
65
+ option "--version=", "-v=" do
66
+ summary "Module version to install."
67
+ description <<-EOT
68
+ Module version to install, can be a requirement string, eg '>= 1.0.3',
69
+ defaults to latest version.
70
+ EOT
71
+ end
72
+
73
+ when_invoked do |name, options|
74
+ Puppet::Module::Tool::Applications::Installer.run(name, options)
75
+ end
76
+
77
+ when_rendering :console do |return_value|
78
+ # Get the string representation of the Pathname object and print it to
79
+ # the console.
80
+ return_value.to_s
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,66 @@
1
+ Puppet::Face.define(:module, '1.0.0') do
2
+ action(:search) do
3
+ summary "Search a repository for a module."
4
+ description <<-EOT
5
+ Search a repository for modules whose names match a specific substring.
6
+ EOT
7
+
8
+ returns "Array of module metadata hashes"
9
+
10
+ examples <<-EOT
11
+ Search the default repository for a module:
12
+
13
+ $ puppet module search puppetlabs
14
+ notice: Searching http://forge.puppetlabs.com
15
+ notice: 24 found.
16
+ puppetlabs/apache (0.0.3)
17
+ puppetlabs/collectd (0.0.1)
18
+ puppetlabs/ruby (0.0.1)
19
+ puppetlabs/vcsrepo (0.0.4)
20
+ puppetlabs/gcc (0.0.3)
21
+ puppetlabs/passenger (0.0.2)
22
+ puppetlabs/DeveloperBootstrap (0.0.5)
23
+ jeffmccune/tomcat (1.0.1)
24
+ puppetlabs/motd (1.0.0)
25
+ puppetlabs/lvm (0.1.0)
26
+ puppetlabs/rabbitmq (1.0.4)
27
+ puppetlabs/prosvc_repo (1.0.1)
28
+ puppetlabs/stdlib (2.2.0)
29
+ puppetlabs/java (0.1.5)
30
+ puppetlabs/activemq (0.1.6)
31
+ puppetlabs/mcollective (0.1.8)
32
+ puppetlabs/git (0.0.2)
33
+ puppetlabs/ntp (0.0.4)
34
+ puppetlabs/nginx (0.0.1)
35
+ puppetlabs/cloud_provisioner (0.6.0rc1)
36
+ puppetlabs/mrepo (0.1.1)
37
+ puppetlabs/f5 (0.1.0)
38
+ puppetlabs/firewall (0.0.3)
39
+ puppetlabs/bprobe (0.0.3)
40
+ EOT
41
+
42
+ arguments "<term>"
43
+
44
+ option "--module-repository=", "-r=" do
45
+ default_to { Puppet.settings[:module_repository] }
46
+ summary "Module repository to use."
47
+ description <<-EOT
48
+ Module repository to use.
49
+ EOT
50
+ end
51
+
52
+ when_invoked do |term, options|
53
+ Puppet.notice "Searching #{options[:module_repository]}"
54
+ Puppet::Module::Tool::Applications::Searcher.run(term, options)
55
+ end
56
+
57
+ when_rendering :console do |return_value|
58
+ Puppet.notice "#{return_value.size} found."
59
+ return_value.map do |match|
60
+ # We reference the full_name here when referring to the full_module_name,
61
+ # because full_name is what is returned from the forge API call.
62
+ "#{match['full_name']} (#{match['version']})"
63
+ end.join("\n")
64
+ end
65
+ end
66
+ end
@@ -39,7 +39,7 @@ class Puppet::Indirector::Exec < Puppet::Indirector::Terminus
39
39
  end
40
40
 
41
41
  if output =~ /\A\s*\Z/ # all whitespace
42
- Puppet.debug "Empty response for #{name} from exec #{self.name} terminus"
42
+ Puppet.debug "Empty response for #{name} from #{self.name} terminus"
43
43
  return nil
44
44
  else
45
45
  return output
@@ -0,0 +1,97 @@
1
+ # Load standard libraries
2
+ require 'pathname'
3
+ require 'fileutils'
4
+ require 'puppet/module_tool/utils'
5
+
6
+ # Define tool
7
+ module Puppet
8
+ class Module
9
+ module Tool
10
+
11
+ # Directory names that should not be checksummed.
12
+ ARTIFACTS = ['pkg', /^\./, /^~/, /^#/, 'coverage']
13
+ FULL_MODULE_NAME_PATTERN = /\A([^-\/|.]+)[-|\/](.+)\z/
14
+ REPOSITORY_URL = Puppet.settings[:module_repository]
15
+
16
+ # Is this a directory that shouldn't be checksummed?
17
+ #
18
+ # TODO: Should this be part of Checksums?
19
+ # TODO: Rename this method to reflect it's purpose?
20
+ # TODO: Shouldn't this be used when building packages too?
21
+ def self.artifact?(path)
22
+ case File.basename(path)
23
+ when *ARTIFACTS
24
+ true
25
+ else
26
+ false
27
+ end
28
+ end
29
+
30
+ # Return the +username+ and +modname+ for a given +full_module_name+, or raise an
31
+ # ArgumentError if the argument isn't parseable.
32
+ def self.username_and_modname_from(full_module_name)
33
+ if matcher = full_module_name.match(FULL_MODULE_NAME_PATTERN)
34
+ return matcher.captures
35
+ else
36
+ raise ArgumentError, "Not a valid full name: #{full_module_name}"
37
+ end
38
+ end
39
+
40
+ # Read HTTP proxy configurationm from Puppet's config file, or the
41
+ # http_proxy environment variable.
42
+ def self.http_proxy_env
43
+ proxy_env = ENV["http_proxy"] || ENV["HTTP_PROXY"] || nil
44
+ begin
45
+ return URI.parse(proxy_env) if proxy_env
46
+ rescue URI::InvalidURIError
47
+ return nil
48
+ end
49
+ return nil
50
+ end
51
+
52
+ def self.http_proxy_host
53
+ env = http_proxy_env
54
+
55
+ if env and env.host then
56
+ return env.host
57
+ end
58
+
59
+ if Puppet.settings[:http_proxy_host] == 'none'
60
+ return nil
61
+ end
62
+
63
+ return Puppet.settings[:http_proxy_host]
64
+ end
65
+
66
+ def self.http_proxy_port
67
+ env = http_proxy_env
68
+
69
+ if env and env.port then
70
+ return env.port
71
+ end
72
+
73
+ return Puppet.settings[:http_proxy_port]
74
+ end
75
+
76
+ def self.find_module_root(path)
77
+ for dir in [path, Dir.pwd].compact
78
+ if File.exist?(File.join(dir, 'Modulefile'))
79
+ return dir
80
+ end
81
+ end
82
+ raise ArgumentError, "Could not find a valid module at #{path ? path.inspect : 'current directory'}"
83
+ end
84
+ end
85
+ end
86
+ end
87
+
88
+ # Load remaining libraries
89
+ require 'puppet/module_tool/applications'
90
+ require 'puppet/module_tool/cache'
91
+ require 'puppet/module_tool/checksums'
92
+ require 'puppet/module_tool/contents_description'
93
+ require 'puppet/module_tool/dependency'
94
+ require 'puppet/module_tool/metadata'
95
+ require 'puppet/module_tool/modulefile'
96
+ require 'puppet/module_tool/repository'
97
+ require 'puppet/module_tool/skeleton'
@@ -0,0 +1,12 @@
1
+ module Puppet::Module::Tool
2
+ module Applications
3
+ require 'puppet/module_tool/applications/application'
4
+ require 'puppet/module_tool/applications/builder'
5
+ require 'puppet/module_tool/applications/checksummer'
6
+ require 'puppet/module_tool/applications/cleaner'
7
+ require 'puppet/module_tool/applications/generator'
8
+ require 'puppet/module_tool/applications/installer'
9
+ require 'puppet/module_tool/applications/searcher'
10
+ require 'puppet/module_tool/applications/unpacker'
11
+ end
12
+ end
@@ -0,0 +1,83 @@
1
+ require 'net/http'
2
+ require 'semver'
3
+
4
+ module Puppet::Module::Tool
5
+ module Applications
6
+ class Application
7
+ include Utils::Interrogation
8
+
9
+ def self.run(*args)
10
+ new(*args).run
11
+ end
12
+
13
+ attr_accessor :options
14
+
15
+ def initialize(options = {})
16
+ @options = options
17
+ end
18
+
19
+ def repository
20
+ @repository ||= Repository.new(@options[:module_repository])
21
+ end
22
+
23
+ def run
24
+ raise NotImplementedError, "Should be implemented in child classes."
25
+ end
26
+
27
+ def discuss(response, success, failure)
28
+ case response
29
+ when Net::HTTPOK, Net::HTTPCreated
30
+ Puppet.notice success
31
+ else
32
+ errors = PSON.parse(response.body)['error'] rescue "HTTP #{response.code}, #{response.body}"
33
+ Puppet.warning "#{failure} (#{errors})"
34
+ end
35
+ end
36
+
37
+ def metadata(require_modulefile = false)
38
+ unless @metadata
39
+ unless @path
40
+ raise ArgumentError, "Could not determine module path"
41
+ end
42
+ @metadata = Puppet::Module::Tool::Metadata.new
43
+ contents = ContentsDescription.new(@path)
44
+ contents.annotate(@metadata)
45
+ checksums = Checksums.new(@path)
46
+ checksums.annotate(@metadata)
47
+ modulefile_path = File.join(@path, 'Modulefile')
48
+ if File.file?(modulefile_path)
49
+ Puppet::Module::Tool::ModulefileReader.evaluate(@metadata, modulefile_path)
50
+ elsif require_modulefile
51
+ raise ArgumentError, "No Modulefile found."
52
+ end
53
+ end
54
+ @metadata
55
+ end
56
+
57
+ def load_modulefile!
58
+ @metadata = nil
59
+ metadata(true)
60
+ end
61
+
62
+ # Use to extract and validate a module name and version from a
63
+ # filename
64
+ # Note: Must have @filename set to use this
65
+ def parse_filename!
66
+ @release_name = File.basename(@filename,'.tar.gz')
67
+ match = /^(.*?)-(.*?)-(\d+\.\d+\.\d+.*?)$/.match(@release_name)
68
+ if match then
69
+ @username, @module_name, @version = match.captures
70
+ else
71
+ raise ArgumentError, "Could not parse filename to obtain the username, module name and version. (#{@release_name})"
72
+ end
73
+ @full_module_name = [@username, @module_name].join('-')
74
+ unless @username && @module_name
75
+ raise ArgumentError, "Username and Module name not provided"
76
+ end
77
+ unless SemVer.valid?(@version)
78
+ raise ArgumentError, "Invalid version format: #{@version} (Semantic Versions are acceptable: http://semver.org)"
79
+ end
80
+ end
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,91 @@
1
+ require 'fileutils'
2
+
3
+ module Puppet::Module::Tool
4
+ module Applications
5
+ class Builder < Application
6
+
7
+ def initialize(path, options = {})
8
+ @path = File.expand_path(Puppet::Module::Tool.find_module_root(path))
9
+ @pkg_path = File.join(@path, 'pkg')
10
+ super(options)
11
+ end
12
+
13
+ def run
14
+ load_modulefile!
15
+ create_directory
16
+ copy_contents
17
+ add_metadata
18
+ Puppet.notice "Building #{@path} for release"
19
+ tar
20
+ gzip
21
+ relative = Pathname.new(File.join(@pkg_path, filename('tar.gz'))).relative_path_from(Pathname.new(Dir.pwd))
22
+
23
+ # Return the Pathname object representing the path to the release
24
+ # archive just created. This return value is used by the module_tool
25
+ # face build action, and displayed to on the console using the to_s
26
+ # method.
27
+ #
28
+ # Example return value:
29
+ #
30
+ # <Pathname:puppetlabs-apache/pkg/puppetlabs-apache-0.0.1.tar.gz>
31
+ #
32
+ relative
33
+ end
34
+
35
+ private
36
+
37
+ def filename(ext)
38
+ ext.sub!(/^\./, '')
39
+ "#{metadata.release_name}.#{ext}"
40
+ end
41
+
42
+ def tar
43
+ tar_name = filename('tar')
44
+ Dir.chdir(@pkg_path) do
45
+ FileUtils.rm tar_name rescue nil
46
+ unless system "tar -cf #{tar_name} #{metadata.release_name}"
47
+ raise RuntimeError, "Could not create #{tar_name}"
48
+ end
49
+ end
50
+ end
51
+
52
+ def gzip
53
+ Dir.chdir(@pkg_path) do
54
+ FileUtils.rm filename('tar.gz') rescue nil
55
+ unless system "gzip #{filename('tar')}"
56
+ raise RuntimeError, "Could not compress #{filename('tar')}"
57
+ end
58
+ end
59
+ end
60
+
61
+ def create_directory
62
+ FileUtils.mkdir(@pkg_path) rescue nil
63
+ if File.directory?(build_path)
64
+ FileUtils.rm_rf(build_path)
65
+ end
66
+ FileUtils.mkdir(build_path)
67
+ end
68
+
69
+ def copy_contents
70
+ Dir[File.join(@path, '*')].each do |path|
71
+ case File.basename(path)
72
+ when *Puppet::Module::Tool::ARTIFACTS
73
+ next
74
+ else
75
+ FileUtils.cp_r path, build_path
76
+ end
77
+ end
78
+ end
79
+
80
+ def add_metadata
81
+ File.open(File.join(build_path, 'metadata.json'), 'w') do |f|
82
+ f.write(PSON.pretty_generate(metadata))
83
+ end
84
+ end
85
+
86
+ def build_path
87
+ @build_path ||= File.join(@pkg_path, metadata.release_name)
88
+ end
89
+ end
90
+ end
91
+ end