image_builder 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/image_builder +5 -3
- data/lib/image_builder/backends/packer.rb +11 -2
- data/lib/image_builder/version.rb +1 -1
- data/spec/packer_backend_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96842bdb280ceb1345d0460a65f20e56c4da1418
|
4
|
+
data.tar.gz: 5ee2bec8bc030c77b64808ca126bda0badde54a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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(
|
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
|
69
|
-
shellout = Mixlib::ShellOut.new(cmd, env: { 'PATH' => @@default_path.join(':') }, input: to_json, timeout:
|
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
|
data/spec/packer_backend_spec.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2014-11-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|