image_builder 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 96fdbf490de1409c12b7a35690ec161016076e46
4
- data.tar.gz: 4cf8e63dd9fc03672579739c72ee8e6a95571718
3
+ metadata.gz: 96842bdb280ceb1345d0460a65f20e56c4da1418
4
+ data.tar.gz: 5ee2bec8bc030c77b64808ca126bda0badde54a5
5
5
  SHA512:
6
- metadata.gz: 4a69a23cb0a72a8cb509511c4848f79b8534222e67252384d5d43ec5a4eac99cab99001d99ddf5d80655b5ffa06a4501aefd47a58c44a0b8ee3d76713e6b0766
7
- data.tar.gz: 8bc8a87b2541b9e78c51bed13ddad2f0227e267ebefd53ba41aca9cd4157cdb492ee1acacc1143c8022cd0be5537c24da79c1038ebe684bbbea18ae359f199f5
6
+ metadata.gz: de9101f19def2a6d0cb1042ec529577c4ce0b61418821a07b59b38f4ce024d0f66eabfbd66e6d79fdbc0925ca121ff394eeb650eed65fabc17c013945606b8b5
7
+ data.tar.gz: 10ed91b79e82a86c51d6dd944d7547ab8c8bb4a0e4f7da5f528d07ca4b0d4d42a2299c9800398b8d8bccacf95c403850fd7c6717ae8624bbb81aef3a2a1e43da
data/bin/image_builder CHANGED
@@ -105,9 +105,11 @@ def create_builders(attrs, options)
105
105
  end
106
106
  # rubocop:enable Metrics/MethodLength
107
107
 
108
- def run_packer(builders, provisioners, postprocessors, path = nil)
108
+ def run_packer(builders, provisioners, postprocessors, path = nil, debug = false)
109
109
  ImageBuilder::Backends::Packer.packer_path(path) unless path.nil? || path.strip.empty?
110
110
  packer = ImageBuilder::Backends::Packer.new
111
+ opts = ['-machine-readable']
112
+ opts << '-debug' if debug
111
113
 
112
114
  builders.each do |b|
113
115
  packer.add_builder(b)
@@ -121,7 +123,7 @@ def run_packer(builders, provisioners, postprocessors, path = nil)
121
123
  packer.add_post_processor(p)
122
124
  end
123
125
 
124
- packer.build(['-machine-readable'])
126
+ packer.build(opts)
125
127
  end
126
128
 
127
129
  def convert_tags(tag_opt)
@@ -228,7 +230,7 @@ Commander.configure do
228
230
  provisioners = [dir_prov, sec_prov, chef_client_prov, ss_file_prov, ss_shell_prov, cleanup_prov].compact
229
231
 
230
232
  # run packer
231
- run_packer(builders, provisioners, [vagrant].compact, options.p_packer_path)
233
+ run_packer(builders, provisioners, [vagrant].compact, options.p_packer_path, options.d_debug)
232
234
  end
233
235
  end
234
236
  end
@@ -64,9 +64,18 @@ module ImageBuilder
64
64
  cmd = [@@packer_exe, 'build'].concat(args)
65
65
  cmd << '-'
66
66
 
67
+ if args.include?('-debug')
68
+ json_obj = JSON.parse(to_json)
69
+
70
+ puts "DEBUG: PACKER_EXE = #{@@packer_exe}"
71
+ puts "DEBUG: PATH = #{@@default_path}"
72
+ puts 'DEBUG: PACKER_JSON ='
73
+ puts JSON.pretty_generate(json_obj)
74
+ end
75
+
67
76
  # Some provisioners may take a long time to run without giving output (applying OS updates via Chef
68
- # to CentOS6 comes to mind), so extend the timeout to an hour.
69
- shellout = Mixlib::ShellOut.new(cmd, env: { 'PATH' => @@default_path.join(':') }, input: to_json, timeout: 3600)
77
+ # to CentOS6, and AMI copying, comes to mind), so extend the timeout to 1.5 hours.
78
+ shellout = Mixlib::ShellOut.new(cmd, env: { 'PATH' => @@default_path.join(':') }, input: to_json, timeout: 5400)
70
79
  shellout.live_stdout = STDOUT
71
80
  shellout.live_stderr = STDERR
72
81
  shellout.run_command
@@ -1,4 +1,4 @@
1
1
  # Generic top-level module comment
2
2
  module ImageBuilder
3
- VERSION = '0.0.1'
3
+ VERSION = '0.0.2'
4
4
  end
@@ -140,6 +140,6 @@ describe ImageBuilder::Backends::Packer do
140
140
  @obj.add_builder(ImageBuilder::Builders::Null.new)
141
141
  @obj.add_provisioner(prov)
142
142
 
143
- expect { @obj.build }.to_not raise_error
143
+ expect { @obj.build(['-debug']) }.to_not raise_error
144
144
  end
145
145
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: image_builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Morris
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-19 00:00:00.000000000 Z
11
+ date: 2014-11-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler