packer-config 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +36 -0
- data/.rubocop.yml +340 -0
- data/.travis.yml +6 -0
- data/Gemfile +17 -0
- data/LICENSE +176 -0
- data/README.md +107 -0
- data/Rakefile +47 -0
- data/TODO.md +8 -0
- data/lib/packer-config.rb +181 -0
- data/lib/packer/builder.rb +65 -0
- data/lib/packer/builders/all.rb +17 -0
- data/lib/packer/builders/amazon.rb +214 -0
- data/lib/packer/builders/docker.rb +47 -0
- data/lib/packer/builders/virtualbox.rb +169 -0
- data/lib/packer/dataobject.rb +128 -0
- data/lib/packer/envvar.rb +27 -0
- data/lib/packer/macro.rb +28 -0
- data/lib/packer/postprocessor.rb +77 -0
- data/lib/packer/postprocessors/all.rb +16 -0
- data/lib/packer/postprocessors/docker.rb +35 -0
- data/lib/packer/postprocessors/vagrant.rb +47 -0
- data/lib/packer/provisioner.rb +86 -0
- data/lib/packer/provisioners/all.rb +16 -0
- data/lib/packer/provisioners/file.rb +36 -0
- data/lib/packer/provisioners/shell.rb +60 -0
- data/packer-config.gemspec +46 -0
- data/spec/integration/README.md +14 -0
- data/spec/integration/builds/.gitignore +4 -0
- data/spec/integration/centos_vagrant_spec.rb +76 -0
- data/spec/integration/packer_cache/.gitignore +4 -0
- data/spec/integration/scripts/chef.sh +199 -0
- data/spec/integration/scripts/cleanup.sh +17 -0
- data/spec/integration/scripts/fix-slow-dns.sh +13 -0
- data/spec/integration/scripts/hello.sh +3 -0
- data/spec/integration/scripts/kickstart/centos-6.5-ks.cfg +71 -0
- data/spec/integration/scripts/minimize.sh +9 -0
- data/spec/integration/scripts/sshd.sh +6 -0
- data/spec/integration/scripts/vagrant.sh +10 -0
- data/spec/integration/scripts/vmtools.sh +39 -0
- data/spec/packer/builder_spec.rb +39 -0
- data/spec/packer/builders/amazon_spec.rb +88 -0
- data/spec/packer/builders/docker_spec.rb +25 -0
- data/spec/packer/builders/virtualbox_spec.rb +44 -0
- data/spec/packer/dataobject_spec.rb +239 -0
- data/spec/packer/envvar_spec.rb +38 -0
- data/spec/packer/macro_spec.rb +38 -0
- data/spec/packer/postprocessor_spec.rb +72 -0
- data/spec/packer/postprocessors/docker_import_spec.rb +27 -0
- data/spec/packer/postprocessors/docker_push_spec.rb +27 -0
- data/spec/packer/postprocessors/vagrant_spec.rb +27 -0
- data/spec/packer/provisioner_spec.rb +78 -0
- data/spec/packer/provisioners/file_spec.rb +63 -0
- data/spec/packer/provisioners/shell_spec.rb +116 -0
- data/spec/packer_config_spec.rb +197 -0
- data/spec/spec_helper.rb +19 -0
- data/spec/unit_helper.rb +15 -0
- metadata +220 -0
@@ -0,0 +1,199 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
# WARNING: REQUIRES /bin/sh
|
3
|
+
#
|
4
|
+
# - must run on /bin/sh on solaris 9
|
5
|
+
# - must run on /bin/sh on AIX 6.x
|
6
|
+
# - if you think you are a bash wizard, you probably do not understand
|
7
|
+
# this programming language. do not touch.
|
8
|
+
# - if you are under 40, get peer review from your elders.
|
9
|
+
#
|
10
|
+
# Author:: Julian C. Dunn (<jdunn@getchef.com>)
|
11
|
+
# Cribbed Code From:: Lamont Granquist, Seth Chisamore, Stephen Delano & Tyler Cloke
|
12
|
+
# Copyright:: Copyright (c) 2013, Chef Software, Inc.
|
13
|
+
# License:: Apache License, Version 2.0
|
14
|
+
#
|
15
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
16
|
+
# you may not use this file except in compliance with the License.
|
17
|
+
# You may obtain a copy of the License at
|
18
|
+
#
|
19
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
20
|
+
#
|
21
|
+
# Unless required by applicable law or agreed to in writing, software
|
22
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
23
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
24
|
+
# See the License for the specific language governing permissions and
|
25
|
+
# limitations under the License.
|
26
|
+
#
|
27
|
+
|
28
|
+
# Set $CHEF_VERSION inside Packer's template. Valid options are:
|
29
|
+
# 'provisionerless' -- build a box without Chef
|
30
|
+
# 'x.y.z' -- build a box with version x.y.z of Chef
|
31
|
+
# 'latest' -- build a box with the latest version of Chef
|
32
|
+
# 'prerelease' -- build a box with a prerelease version of Chef
|
33
|
+
|
34
|
+
chef_installer="/tmp/install-chef.sh"
|
35
|
+
chef_installer_url="https://www.getchef.com/chef/install.sh"
|
36
|
+
|
37
|
+
# Check whether a command exists - returns 0 if it does, 1 if it does not
|
38
|
+
exists() {
|
39
|
+
if command -v $1 >/dev/null 2>&1
|
40
|
+
then
|
41
|
+
return 0
|
42
|
+
else
|
43
|
+
return 1
|
44
|
+
fi
|
45
|
+
}
|
46
|
+
|
47
|
+
unable_to_retrieve_package() {
|
48
|
+
echo "Unable to retrieve install.sh!"
|
49
|
+
if test "x$stderr_results" != "x"; then
|
50
|
+
echo "\nDEBUG OUTPUT FOLLOWS:\n$stderr_results"
|
51
|
+
fi
|
52
|
+
exit 1
|
53
|
+
}
|
54
|
+
|
55
|
+
capture_tmp_stderr() {
|
56
|
+
# spool up /tmp/stderr from all the commands we called
|
57
|
+
if test -f "/tmp/stderr"; then
|
58
|
+
output=`cat /tmp/stderr`
|
59
|
+
stderr_results="${stderr_results}\nSTDERR from $1:\n\n$output\n"
|
60
|
+
rm /tmp/stderr
|
61
|
+
fi
|
62
|
+
}
|
63
|
+
|
64
|
+
# do_wget URL FILENAME
|
65
|
+
do_wget() {
|
66
|
+
echo "trying wget..."
|
67
|
+
wget -O "$2" "$1" 2>/tmp/stderr
|
68
|
+
rc=$?
|
69
|
+
# check for 404
|
70
|
+
grep "ERROR 404" /tmp/stderr 2>&1 >/dev/null
|
71
|
+
if test $? -eq 0; then
|
72
|
+
echo "ERROR 404"
|
73
|
+
unable_to_retrieve_package
|
74
|
+
fi
|
75
|
+
|
76
|
+
# check for bad return status or empty output
|
77
|
+
if test $rc -ne 0 || test ! -s "$2"; then
|
78
|
+
capture_tmp_stderr "wget"
|
79
|
+
return 1
|
80
|
+
fi
|
81
|
+
|
82
|
+
return 0
|
83
|
+
}
|
84
|
+
|
85
|
+
# do_curl URL FILENAME
|
86
|
+
do_curl() {
|
87
|
+
echo "trying curl..."
|
88
|
+
curl -sL -D /tmp/stderr "$1" > "$2"
|
89
|
+
rc=$?
|
90
|
+
# check for 404
|
91
|
+
grep "404 Not Found" /tmp/stderr 2>&1 >/dev/null
|
92
|
+
if test $? -eq 0; then
|
93
|
+
echo "ERROR 404"
|
94
|
+
unable_to_retrieve_package
|
95
|
+
fi
|
96
|
+
|
97
|
+
# check for bad return status or empty output
|
98
|
+
if test $rc -ne 0 || test ! -s "$2"; then
|
99
|
+
capture_tmp_stderr "curl"
|
100
|
+
return 1
|
101
|
+
fi
|
102
|
+
|
103
|
+
return 0
|
104
|
+
}
|
105
|
+
|
106
|
+
# do_fetch URL FILENAME
|
107
|
+
do_fetch() {
|
108
|
+
echo "trying fetch..."
|
109
|
+
fetch -o "$2" "$1" 2>/tmp/stderr
|
110
|
+
# check for bad return status
|
111
|
+
test $? -ne 0 && return 1
|
112
|
+
return 0
|
113
|
+
}
|
114
|
+
|
115
|
+
# do_curl URL FILENAME
|
116
|
+
do_perl() {
|
117
|
+
echo "trying perl..."
|
118
|
+
perl -e 'use LWP::Simple; getprint($ARGV[0]);' "$1" > "$2" 2>/tmp/stderr
|
119
|
+
rc=$?
|
120
|
+
# check for 404
|
121
|
+
grep "404 Not Found" /tmp/stderr 2>&1 >/dev/null
|
122
|
+
if test $? -eq 0; then
|
123
|
+
echo "ERROR 404"
|
124
|
+
unable_to_retrieve_package
|
125
|
+
fi
|
126
|
+
|
127
|
+
# check for bad return status or empty output
|
128
|
+
if test $rc -ne 0 || test ! -s "$2"; then
|
129
|
+
capture_tmp_stderr "perl"
|
130
|
+
return 1
|
131
|
+
fi
|
132
|
+
|
133
|
+
return 0
|
134
|
+
}
|
135
|
+
|
136
|
+
# do_curl URL FILENAME
|
137
|
+
do_python() {
|
138
|
+
echo "trying python..."
|
139
|
+
python -c "import sys,urllib2 ; sys.stdout.write(urllib2.urlopen(sys.argv[1]).read())" "$1" > "$2" 2>/tmp/stderr
|
140
|
+
rc=$?
|
141
|
+
# check for 404
|
142
|
+
grep "HTTP Error 404" /tmp/stderr 2>&1 >/dev/null
|
143
|
+
if test $? -eq 0; then
|
144
|
+
echo "ERROR 404"
|
145
|
+
unable_to_retrieve_package
|
146
|
+
fi
|
147
|
+
|
148
|
+
# check for bad return status or empty output
|
149
|
+
if test $rc -ne 0 || test ! -s "$2"; then
|
150
|
+
capture_tmp_stderr "python"
|
151
|
+
return 1
|
152
|
+
fi
|
153
|
+
return 0
|
154
|
+
}
|
155
|
+
|
156
|
+
do_download() {
|
157
|
+
echo "downloading $1"
|
158
|
+
echo " to file $2"
|
159
|
+
|
160
|
+
# we try all of these until we get success.
|
161
|
+
# perl, in particular may be present but LWP::Simple may not be installed
|
162
|
+
|
163
|
+
if exists wget; then
|
164
|
+
do_wget $1 $2 && return 0
|
165
|
+
fi
|
166
|
+
|
167
|
+
if exists curl; then
|
168
|
+
do_curl $1 $2 && return 0
|
169
|
+
fi
|
170
|
+
|
171
|
+
if exists fetch; then
|
172
|
+
do_fetch $1 $2 && return 0
|
173
|
+
fi
|
174
|
+
|
175
|
+
if exists perl; then
|
176
|
+
do_perl $1 $2 && return 0
|
177
|
+
fi
|
178
|
+
|
179
|
+
if exists python; then
|
180
|
+
do_python $1 $2 && return 0
|
181
|
+
fi
|
182
|
+
|
183
|
+
unable_to_retrieve_package
|
184
|
+
}
|
185
|
+
|
186
|
+
if [ x$CHEF_VERSION != x'provisionerless' ]; then
|
187
|
+
do_download "$chef_installer_url" "$chef_installer"
|
188
|
+
chmod +x $chef_installer
|
189
|
+
if [ x$CHEF_VERSION == x'latest' ]; then
|
190
|
+
$chef_installer
|
191
|
+
elif [ x$CHEF_VERSION == x'prerelease' ]; then
|
192
|
+
$chef_installer -p
|
193
|
+
else
|
194
|
+
$chef_installer -v $CHEF_VERSION
|
195
|
+
fi
|
196
|
+
rm -f $chef_installer
|
197
|
+
else
|
198
|
+
echo "Building a box without Chef"
|
199
|
+
fi
|
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/bin/bash -eux
|
2
|
+
|
3
|
+
# From: https://github.com/opscode/bento
|
4
|
+
|
5
|
+
# These were only needed for building VMware/Virtualbox extensions:
|
6
|
+
# yum -y remove gcc cpp kernel-devel kernel-headers perl
|
7
|
+
yum -y clean all
|
8
|
+
rm -rf VBoxGuestAdditions_*.iso VBoxGuestAdditions_*.iso.?
|
9
|
+
rm -f /tmp/chef*rpm
|
10
|
+
|
11
|
+
# clean up redhat interface persistence
|
12
|
+
rm -f /etc/udev/rules.d/70-persistent-net.rules
|
13
|
+
if [ -r /etc/sysconfig/network-scripts/ifcfg-eth0 ]; then
|
14
|
+
sed -i 's/^HWADDR.*$//' /etc/sysconfig/network-scripts/ifcfg-eth0
|
15
|
+
sed -i 's/^UUID.*$//' /etc/sysconfig/network-scripts/ifcfg-eth0
|
16
|
+
fi
|
17
|
+
|
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/bin/bash -eux
|
2
|
+
|
3
|
+
# From: https://github.com/opscode/bento
|
4
|
+
|
5
|
+
if [[ "$PACKER_BUILDER_TYPE" == virtualbox* ]]; then
|
6
|
+
## https://access.redhat.com/site/solutions/58625 (subscription required)
|
7
|
+
# add 'single-request-reopen' so it is included when /etc/resolv.conf is generated
|
8
|
+
echo 'RES_OPTIONS="single-request-reopen"' >> /etc/sysconfig/network
|
9
|
+
service network restart
|
10
|
+
echo 'Slow DNS fix applied (single-request-reopen)'
|
11
|
+
else
|
12
|
+
echo 'Slow DNS fix not required for this platform, skipping'
|
13
|
+
fi
|
@@ -0,0 +1,71 @@
|
|
1
|
+
install
|
2
|
+
cdrom
|
3
|
+
lang en_US.UTF-8
|
4
|
+
keyboard us
|
5
|
+
network --bootproto=dhcp
|
6
|
+
rootpw vagrant
|
7
|
+
firewall --disabled
|
8
|
+
selinux --permissive
|
9
|
+
timezone UTC
|
10
|
+
unsupported_hardware
|
11
|
+
bootloader --location=mbr
|
12
|
+
text
|
13
|
+
skipx
|
14
|
+
zerombr
|
15
|
+
clearpart --all --initlabel
|
16
|
+
autopart
|
17
|
+
auth --enableshadow --passalgo=sha512 --kickstart
|
18
|
+
firstboot --disabled
|
19
|
+
reboot
|
20
|
+
user --name=vagrant --plaintext --password vagrant
|
21
|
+
|
22
|
+
%packages --nobase --ignoremissing --excludedocs
|
23
|
+
# vagrant needs this to copy initial files via scp
|
24
|
+
openssh-clients
|
25
|
+
sudo
|
26
|
+
kernel-headers
|
27
|
+
kernel-devel
|
28
|
+
gcc
|
29
|
+
make
|
30
|
+
perl
|
31
|
+
curl
|
32
|
+
wget
|
33
|
+
nfs-utils
|
34
|
+
man
|
35
|
+
-fprintd-pam
|
36
|
+
-intltool
|
37
|
+
|
38
|
+
# unnecessary firmware
|
39
|
+
-aic94xx-firmware
|
40
|
+
-atmel-firmware
|
41
|
+
-b43-openfwwf
|
42
|
+
-bfa-firmware
|
43
|
+
-ipw2100-firmware
|
44
|
+
-ipw2200-firmware
|
45
|
+
-ivtv-firmware
|
46
|
+
-iwl100-firmware
|
47
|
+
-iwl1000-firmware
|
48
|
+
-iwl3945-firmware
|
49
|
+
-iwl4965-firmware
|
50
|
+
-iwl5000-firmware
|
51
|
+
-iwl5150-firmware
|
52
|
+
-iwl6000-firmware
|
53
|
+
-iwl6000g2a-firmware
|
54
|
+
-iwl6050-firmware
|
55
|
+
-libertas-usb8388-firmware
|
56
|
+
-ql2100-firmware
|
57
|
+
-ql2200-firmware
|
58
|
+
-ql23xx-firmware
|
59
|
+
-ql2400-firmware
|
60
|
+
-ql2500-firmware
|
61
|
+
-rt61pci-firmware
|
62
|
+
-rt73usb-firmware
|
63
|
+
-xorg-x11-drv-ati-firmware
|
64
|
+
-zd1211-firmware
|
65
|
+
|
66
|
+
%post
|
67
|
+
# update root certs
|
68
|
+
wget -O/etc/pki/tls/certs/ca-bundle.crt http://curl.haxx.se/ca/cacert.pem
|
69
|
+
# sudo
|
70
|
+
echo "%vagrant ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/vagrant
|
71
|
+
sed -i "s/^.*requiretty/#Defaults requiretty/" /etc/sudoers
|
@@ -0,0 +1,10 @@
|
|
1
|
+
#!/bin/bash -eux
|
2
|
+
|
3
|
+
# From: https://github.com/opscode/bento
|
4
|
+
|
5
|
+
mkdir /home/vagrant/.ssh
|
6
|
+
wget --no-check-certificate \
|
7
|
+
'https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub' \
|
8
|
+
-O /home/vagrant/.ssh/authorized_keys
|
9
|
+
chown -R vagrant /home/vagrant/.ssh
|
10
|
+
chmod -R go-rwsx /home/vagrant/.ssh
|
@@ -0,0 +1,39 @@
|
|
1
|
+
#!/bin/bash -eux
|
2
|
+
|
3
|
+
# From: https://github.com/opscode/bento
|
4
|
+
|
5
|
+
case "$PACKER_BUILDER_TYPE" in
|
6
|
+
|
7
|
+
virtualbox-iso|virtualbox-ovf)
|
8
|
+
mkdir /tmp/vbox
|
9
|
+
VER=$(cat /home/vagrant/.vbox_version)
|
10
|
+
if [ ! -f "/home/vagrant/VBoxGuestAdditions_$VER.iso" ]; then
|
11
|
+
wget "http://download.virtualbox.org/virtualbox/4.3.8/VBoxGuestAdditions_$VER.iso" --output-file="/home/vagrant/VBoxGuestAdditions_$VER.iso"
|
12
|
+
fi
|
13
|
+
mount -o loop /home/vagrant/VBoxGuestAdditions_$VER.iso /tmp/vbox
|
14
|
+
sh /tmp/vbox/VBoxLinuxAdditions.run
|
15
|
+
umount /tmp/vbox
|
16
|
+
rmdir /tmp/vbox
|
17
|
+
rm /home/vagrant/*.iso
|
18
|
+
chkconfig --add /etc/init.d/vboxadd
|
19
|
+
chkconfig --level 345 vboxadd on
|
20
|
+
;;
|
21
|
+
|
22
|
+
vmware-iso|vmware-ovf)
|
23
|
+
mkdir /tmp/vmfusion
|
24
|
+
mkdir /tmp/vmfusion-archive
|
25
|
+
mount -o loop /home/vagrant/linux.iso /tmp/vmfusion
|
26
|
+
tar xzf /tmp/vmfusion/VMwareTools-*.tar.gz -C /tmp/vmfusion-archive
|
27
|
+
/tmp/vmfusion-archive/vmware-tools-distrib/vmware-install.pl --default
|
28
|
+
umount /tmp/vmfusion
|
29
|
+
rm -rf /tmp/vmfusion
|
30
|
+
rm -rf /tmp/vmfusion-archive
|
31
|
+
rm /home/vagrant/*.iso
|
32
|
+
;;
|
33
|
+
|
34
|
+
*)
|
35
|
+
echo "Unknown Packer Builder Type >>$PACKER_BUILDER_TYPE<< selected."
|
36
|
+
echo "Known are virtualbox-iso|virtualbox-ovf|vmware-iso|vmware-ovf."
|
37
|
+
;;
|
38
|
+
|
39
|
+
esac
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# Encoding: utf-8
|
2
|
+
# Copyright 2014 Ian Chesal
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
require 'spec_helper'
|
16
|
+
|
17
|
+
RSpec.describe Packer::Builder do
|
18
|
+
VALID_BUILDER_TYPE = Packer::Builder::VIRTUALBOX_ISO
|
19
|
+
|
20
|
+
let(:builder) { Packer::Builder.new }
|
21
|
+
|
22
|
+
describe '.get_builder' do
|
23
|
+
it 'returns a builder' do
|
24
|
+
expect(Packer::Builder.get_builder(VALID_BUILDER_TYPE)).to be_a_kind_of(Packer::Builder)
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'raises an error when the builder type is not recognized' do
|
28
|
+
expect { Packer::Builder.get_builder('unknown-type') }.to raise_error
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe '#name' do
|
33
|
+
it 'lets you set a custom name on the builder instance' do
|
34
|
+
builder.name('fancy name')
|
35
|
+
expect(builder.data['name']).to eq('fancy name')
|
36
|
+
builder.data.delete('name')
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
# Encoding: utf-8
|
2
|
+
# Copyright 2014 Ian Chesal
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
require 'spec_helper'
|
16
|
+
|
17
|
+
RSpec.describe Packer::Builder::Amazon do
|
18
|
+
let(:builder) { Packer::Builder::Amazon.new }
|
19
|
+
let(:block_device_mappings) do
|
20
|
+
[{
|
21
|
+
"device_name" => "/dev/sdb",
|
22
|
+
"virtual_name" => "ephemeral0"
|
23
|
+
},
|
24
|
+
{
|
25
|
+
"device_name" => "/dev/sdc",
|
26
|
+
"virtual_name" => "ephemeral1"
|
27
|
+
}]
|
28
|
+
end
|
29
|
+
|
30
|
+
let(:tags) do
|
31
|
+
{
|
32
|
+
"a" => '1',
|
33
|
+
"b" => '2'
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
describe '#ami_block_device_mappings' do
|
38
|
+
it 'adds a block device mappings data structure' do
|
39
|
+
builder.ami_block_device_mappings(block_device_mappings)
|
40
|
+
expect(builder.data['ami_block_device_mappings']).to eq(block_device_mappings)
|
41
|
+
builder.data.delete('ami_block_device_mappings')
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe '#launch_block_device_mappings' do
|
46
|
+
it 'adds a block device mappings data structure' do
|
47
|
+
builder.launch_block_device_mappings(block_device_mappings)
|
48
|
+
expect(builder.data['launch_block_device_mappings']).to eq(block_device_mappings)
|
49
|
+
builder.data.delete('launch_block_device_mappings')
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe '#tags' do
|
54
|
+
it 'adds a hash of strings to the key' do
|
55
|
+
builder.tags(tags)
|
56
|
+
expect(builder.data['tags']).to eq(tags)
|
57
|
+
builder.data.delete('tags')
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
describe '#run_tags' do
|
62
|
+
it 'adds a hash of strings to the key' do
|
63
|
+
builder.run_tags(tags)
|
64
|
+
expect(builder.data['run_tags']).to eq(tags)
|
65
|
+
builder.data.delete('run_tags')
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
RSpec.describe Packer::Builder::Amazon::EBS do
|
71
|
+
let(:builder) { Packer::Builder.get_builder(Packer::Builder::AMAZON_EBS) }
|
72
|
+
|
73
|
+
describe '#initialize' do
|
74
|
+
it 'has a type of amazon-ebs' do
|
75
|
+
expect(builder.data['type']).to eq(Packer::Builder::AMAZON_EBS)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
RSpec.describe Packer::Builder::Amazon::Instance do
|
81
|
+
let(:builder) { Packer::Builder.get_builder(Packer::Builder::AMAZON_INSTANCE) }
|
82
|
+
|
83
|
+
describe '#initialize' do
|
84
|
+
it 'has a type of amazon-instance' do
|
85
|
+
expect(builder.data['type']).to eq(Packer::Builder::AMAZON_INSTANCE)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|