image_builder 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c076dc7e5e4320113bec0ce82b53fcec8002ae27
|
4
|
+
data.tar.gz: 9bd05d5459f560cc94e16019e8e72e9a0538197f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c42e8773beedd7438cc73339eadf0b2688d838b8689a3ed41cf2eb5afe2a32d2da43e2777bfb1b2b4901a8ee5d01b5d76345827ca02b3ce746f264ad1fed07ae
|
7
|
+
data.tar.gz: 6c905f1c8247edd709d4d972896e4a89f0173f2eff53ecc61a7ef23103951f59d54793555e2686b9b1acca475218affe58571b75234e36d933cb3ec5a5b01000
|
data/bin/image_builder
CHANGED
@@ -34,6 +34,7 @@ end
|
|
34
34
|
def create_chef_client_provisioner(knife_file, chef_attrs, options)
|
35
35
|
chef_client_prov = ImageBuilder::Provisioners::Chef::Client.from_file(knife_file)
|
36
36
|
chef_client_prov.chef_environment = chef_attrs['amibakery']['build']['chef_env']
|
37
|
+
chef_client_prov.chef_version = options.chef_version
|
37
38
|
chef_client_prov.node_name = "#{prog_name}_{{uuid}}"
|
38
39
|
chef_client_prov.run_list = options.r_run_list
|
39
40
|
chef_client_prov.json = JSON.parse(options.j_json) # Placeholder for custom json used to pass in build-specific data
|
@@ -176,6 +177,7 @@ Commander.configure do
|
|
176
177
|
c.option '--ami-description DESC', String, 'A description of the ami'
|
177
178
|
c.option '--cleanup-run-list RUN_LIST', Array, 'A run-list used to clean up the provisioned node before AMI creation'
|
178
179
|
c.option '--[no-]vagrant-box', 'Create a Vagrant box defintion after the build completes'
|
180
|
+
c.option '--chef-version', String, 'chef-client version to download and install. If not given, will download the latest version'
|
179
181
|
|
180
182
|
c.action do |_args, options|
|
181
183
|
options.default vagrant_box: false
|
@@ -7,6 +7,7 @@ module ImageBuilder
|
|
7
7
|
module Chef
|
8
8
|
# Generic class doc comment
|
9
9
|
class Base < ImageBuilder::Provisioners::Base
|
10
|
+
attr_accessor :chef_version
|
10
11
|
attr_accessor :cookbook_paths
|
11
12
|
attr_accessor :config_template
|
12
13
|
attr_accessor :encrypted_data_bag_secret_path
|
@@ -59,6 +60,9 @@ module ImageBuilder
|
|
59
60
|
def packer_hash
|
60
61
|
hash = { type: @type }
|
61
62
|
|
63
|
+
@install_command = 'curl -L https://www.opscode.com/chef/install.sh | ' \
|
64
|
+
'{{if .Sudo}}sudo{{end}} bash -s -- -v ' + @chef_version unless @chef_version.nil? && @install_command.nil?
|
65
|
+
|
62
66
|
attr_to_hash(hash, :config_template)
|
63
67
|
attr_to_hash(hash, :execute_command)
|
64
68
|
attr_to_hash(hash, :install_command)
|
@@ -29,4 +29,17 @@ describe ImageBuilder::Provisioners::Chef::Client do
|
|
29
29
|
it 'implements packer_hash()' do
|
30
30
|
expect(@obj.respond_to? :packer_hash).to be true
|
31
31
|
end
|
32
|
+
|
33
|
+
it 'behaves correctly when no chef version given' do
|
34
|
+
expect(@obj.packer_hash.key? :install_command).to be false
|
35
|
+
expect(@obj.packer_hash[:install_command]).to be_nil
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'honors setting a chef version for install' do
|
39
|
+
version = '11.16'
|
40
|
+
@obj.chef_version = version
|
41
|
+
expect(@obj.packer_hash.key? :install_command).to be true
|
42
|
+
expect(@obj.packer_hash[:install_command]).to match(/\s+-v\s+#{version}/)
|
43
|
+
expect(@obj.install_command).to match(/\s+-v\s+#{version}/)
|
44
|
+
end
|
32
45
|
end
|
@@ -25,4 +25,17 @@ describe ImageBuilder::Provisioners::Chef::Solo do
|
|
25
25
|
it 'implements packer_hash()' do
|
26
26
|
expect(@obj.respond_to? :packer_hash).to be true
|
27
27
|
end
|
28
|
+
|
29
|
+
it 'behaves correctly when no chef version given' do
|
30
|
+
expect(@obj.packer_hash.key? :install_command).to be false
|
31
|
+
expect(@obj.packer_hash[:install_command]).to be_nil
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'honors setting a chef version for install' do
|
35
|
+
version = '11.14'
|
36
|
+
@obj.chef_version = version
|
37
|
+
expect(@obj.packer_hash.key? :install_command).to be true
|
38
|
+
expect(@obj.packer_hash[:install_command]).to match(/\s+-v\s+#{version}/)
|
39
|
+
expect(@obj.install_command).to match(/\s+-v\s+#{version}/)
|
40
|
+
end
|
28
41
|
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.
|
4
|
+
version: 0.0.9
|
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-12-
|
11
|
+
date: 2014-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|