packer-config 1.6.2 → 1.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +3 -0
- data/.rubocop.yml +7 -1
- data/COPYRIGHT +2 -0
- data/README.md +6 -1
- data/RELEASENOTES.md +9 -0
- data/lib/packer/builder.rb +3 -0
- data/lib/packer/builders/all.rb +1 -0
- data/lib/packer/builders/qemu.rb +105 -0
- data/lib/packer/postprocessor.rb +7 -1
- data/lib/packer/postprocessors/all.rb +2 -0
- data/lib/packer/postprocessors/compress.rb +26 -0
- data/lib/packer/postprocessors/shell-local.rb +46 -0
- data/lib/packer/provisioners/chef/client.rb +4 -0
- data/lib/packer/runner.rb +8 -1
- data/lib/packer/version.rb +1 -1
- data/packer-config.gemspec +1 -1
- data/spec/packer/builders/qemu_spec.rb +29 -0
- data/spec/packer/postprocessors/shell_local_spec.rb +108 -0
- data/spec/packer/provisioners/chef/client_spec.rb +8 -0
- metadata +13 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01133b9d2fb0e22d4412694baed496349e7abfbd
|
4
|
+
data.tar.gz: c22b355228f0a5a40deb29caa81d1ee76d68ff25
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b955805634e3dc46e646193b12c521524d5971fc29bff2c97657381954ac0bf212f466e5212cef87f2586abdd44e9c8b4e5f3baedb42d28aecce625e9d2e8136
|
7
|
+
data.tar.gz: e6e8fea9c9c111b06573713d556e8965410a4816731ed3c9a803959f809df97ca5ceeb873a00a9342e0143f35baf8bcff39ae635be0fbc33fa9be00aeee0e7f2
|
data/.rspec
ADDED
data/.rubocop.yml
CHANGED
data/COPYRIGHT
CHANGED
@@ -7,6 +7,8 @@ Including, but not limited to:
|
|
7
7
|
Greg Poirier
|
8
8
|
Greg Diamond
|
9
9
|
Enzo Rivello
|
10
|
+
Edwin Biemond
|
11
|
+
Andrei Shiniti Nakagawa
|
10
12
|
|
11
13
|
For licensing information please see LICENSE. Copyright holders contributing to
|
12
14
|
this project agree to have their contributions licensed under the terms of the
|
data/README.md
CHANGED
@@ -37,6 +37,7 @@ The following [Packer builders](http://www.packer.io/docs/templates/builders.htm
|
|
37
37
|
* [virtualbox-iso](http://www.packer.io/docs/builders/virtualbox-iso.html)
|
38
38
|
* [vmware-vmx](https://www.packer.io/docs/builders/vmware-vmx)
|
39
39
|
* [vmware-iso](https://www.packer.io/docs/builders/vmware-iso)
|
40
|
+
* [qemu](https://www.packer.io/docs/builders/qemu.html)
|
40
41
|
* [null](https://www.packer.io/docs/builders/null.html)
|
41
42
|
|
42
43
|
[Communicators](https://www.packer.io/docs/templates/communicator.html) are supported as options on Builders in `packer-config`. The `none`, `ssh`, and `winrm` communicators are all available as is the `docker` communicator on the Docker-type builders. `packer-config` will raise an error if you try to use a Communicator type that isn't valid for the Builder.
|
@@ -47,6 +48,7 @@ The following [Packer provisioners](http://www.packer.io/docs/templates/provisio
|
|
47
48
|
|
48
49
|
* [file](http://www.packer.io/docs/provisioners/file.html)
|
49
50
|
* [shell](http://www.packer.io/docs/provisioners/shell.html)
|
51
|
+
* [shell-local](https://www.packer.io/docs/provisioners/shell-local.html)
|
50
52
|
* [ansible](https://www.packer.io/docs/provisioners/ansible-local.html)
|
51
53
|
* [chef-client](https://www.packer.io/docs/provisioners/chef-client.html)
|
52
54
|
* [chef-solo](https://www.packer.io/docs/provisioners/chef-solo.html)
|
@@ -64,6 +66,7 @@ The following [Packer post-processors](http://www.packer.io/docs/templates/post-
|
|
64
66
|
* [docker-save](http://www.packer.io/docs/post-processors/docker-save.html)
|
65
67
|
* [docker-tag](http://www.packer.io/docs/post-processors/docker-tag.html)
|
66
68
|
* [vagrant](http://www.packer.io/docs/post-processors/vagrant.html)
|
69
|
+
* [compress](https://www.packer.io/docs/post-processors/compress.html)
|
67
70
|
|
68
71
|
## Examples
|
69
72
|
|
@@ -147,7 +150,9 @@ I'm using Travis CI to build and test on every push to the public github reposit
|
|
147
150
|
|
148
151
|
### Branching in Git
|
149
152
|
|
150
|
-
We release off the `master` branch
|
153
|
+
We release off the `master` branch. Please open your pull requests against `develop`. We were using git-flow but I've fallen out of love with its style in favor of more ad hoc branching and just keeping `master` clean for releases.
|
154
|
+
|
155
|
+
**PLEASE OPEN ALL PULL REQUESTS AGAINST `develop` NOT `master`!**
|
151
156
|
|
152
157
|
### TODO Work
|
153
158
|
|
data/RELEASENOTES.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# packer-config Release Notes
|
2
2
|
|
3
|
+
## 1.6.3
|
4
|
+
|
5
|
+
* Add support for the shell-local provisioner (via [shinitiandrei])
|
6
|
+
* Add support for QEMU builder (via [biemond])
|
7
|
+
* Add support for the Compress post-processor (via [biemond])
|
8
|
+
* Add support for `-debug` in the packer command line call (via [diamond29])
|
9
|
+
|
3
10
|
## 1.6.2
|
4
11
|
|
5
12
|
* Updates for CVE-2017-8418
|
@@ -61,3 +68,5 @@
|
|
61
68
|
[ianchesal]: https://github.com/ianchesal
|
62
69
|
[diamond29]: https://github.com/diamond29
|
63
70
|
[enzor]: https://github.com/enzor
|
71
|
+
[biemond]: https://github.com/biemond
|
72
|
+
[shinitiandrei]: https://github.com/shinitiandrei
|
data/lib/packer/builder.rb
CHANGED
@@ -9,6 +9,7 @@ module Packer
|
|
9
9
|
VIRTUALBOX_ISO = 'virtualbox-iso'
|
10
10
|
VMWARE_VMX = 'vmware-vmx'
|
11
11
|
VMWARE_ISO = 'vmware-iso'
|
12
|
+
QEMU = 'qemu'
|
12
13
|
NULL = 'null'
|
13
14
|
|
14
15
|
VALID_BUILDER_TYPES = [
|
@@ -18,6 +19,7 @@ module Packer
|
|
18
19
|
VIRTUALBOX_ISO,
|
19
20
|
VMWARE_VMX,
|
20
21
|
VMWARE_ISO,
|
22
|
+
QEMU,
|
21
23
|
NULL
|
22
24
|
]
|
23
25
|
|
@@ -35,6 +37,7 @@ module Packer
|
|
35
37
|
VIRTUALBOX_ISO => Packer::Builder::VirtualBoxISO,
|
36
38
|
VMWARE_VMX => Packer::Builder::VMWareVMX,
|
37
39
|
VMWARE_ISO => Packer::Builder::VMWareISO,
|
40
|
+
QEMU => Packer::Builder::Qemu,
|
38
41
|
NULL => Packer::Builder::Null
|
39
42
|
}.fetch(type).new
|
40
43
|
end
|
data/lib/packer/builders/all.rb
CHANGED
@@ -0,0 +1,105 @@
|
|
1
|
+
# Encoding: utf-8
|
2
|
+
require 'packer/builder'
|
3
|
+
require 'packer/dataobject'
|
4
|
+
|
5
|
+
module Packer
|
6
|
+
class Builder < Packer::DataObject
|
7
|
+
class Qemu < Builder
|
8
|
+
def initialize
|
9
|
+
super
|
10
|
+
self.data['type'] = QEMU
|
11
|
+
self.add_required(
|
12
|
+
'iso_checksum',
|
13
|
+
'iso_checksum_type',
|
14
|
+
'iso_url',
|
15
|
+
'communicator'
|
16
|
+
)
|
17
|
+
self.communicators = %w(none ssh winrm)
|
18
|
+
end
|
19
|
+
|
20
|
+
def iso_checksum(checksum)
|
21
|
+
self.__add_string('iso_checksum', checksum)
|
22
|
+
end
|
23
|
+
|
24
|
+
def iso_checksum_type(type)
|
25
|
+
self.__add_string('iso_checksum_type', type)
|
26
|
+
end
|
27
|
+
|
28
|
+
def iso_url(url)
|
29
|
+
self.__add_string('iso_url', url, %w[iso_urls])
|
30
|
+
end
|
31
|
+
|
32
|
+
def boot_command(commands)
|
33
|
+
self.__add_array_of_strings('boot_command', commands)
|
34
|
+
end
|
35
|
+
|
36
|
+
def boot_wait(time)
|
37
|
+
self.__add_string('boot_wait',time)
|
38
|
+
end
|
39
|
+
|
40
|
+
def disk_size(megabytes)
|
41
|
+
self.__add_integer('disk_size', megabytes)
|
42
|
+
end
|
43
|
+
|
44
|
+
def accelerator(accelerator)
|
45
|
+
self.__add_string('accelerator', accelerator)
|
46
|
+
end
|
47
|
+
|
48
|
+
def format(format)
|
49
|
+
self.__add_string('format', format)
|
50
|
+
end
|
51
|
+
|
52
|
+
def net_device(net_device)
|
53
|
+
self.__add_string('net_device', net_device)
|
54
|
+
end
|
55
|
+
|
56
|
+
def floppy_files(files)
|
57
|
+
self.__add_array_of_strings('floppy_files', files)
|
58
|
+
end
|
59
|
+
|
60
|
+
def qemu_binary(qemu_binary)
|
61
|
+
self.__add_string('qemu_binary', qemu_binary)
|
62
|
+
end
|
63
|
+
|
64
|
+
def disk_interface(disk_interface)
|
65
|
+
self.__add_string('disk_interface', disk_interface)
|
66
|
+
end
|
67
|
+
|
68
|
+
def headless(bool)
|
69
|
+
self.__add_boolean('headless', bool)
|
70
|
+
end
|
71
|
+
|
72
|
+
def http_directory(directory)
|
73
|
+
self.__add_string('http_directory', directory)
|
74
|
+
end
|
75
|
+
|
76
|
+
def http_port_min(port_number)
|
77
|
+
self.__add_integer('http_port_min', port_number)
|
78
|
+
end
|
79
|
+
|
80
|
+
def http_port_max(port_number)
|
81
|
+
self.__add_integer('http_port_max', port_number)
|
82
|
+
end
|
83
|
+
|
84
|
+
def output_directory(directory)
|
85
|
+
self.__add_string('output_directory', directory)
|
86
|
+
end
|
87
|
+
|
88
|
+
def shutdown_command(command)
|
89
|
+
self.__add_string('shutdown_command', command)
|
90
|
+
end
|
91
|
+
|
92
|
+
def shutdown_timeout(time)
|
93
|
+
self.__add_string('shutdown_timeout', time)
|
94
|
+
end
|
95
|
+
|
96
|
+
def qemuargs(array_of_commands)
|
97
|
+
self.__add_array_of_array_of_strings('qemuargs', array_of_commands)
|
98
|
+
end
|
99
|
+
|
100
|
+
def vm_name(name)
|
101
|
+
self.__add_string('vm_name', name)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
data/lib/packer/postprocessor.rb
CHANGED
@@ -9,13 +9,17 @@ module Packer
|
|
9
9
|
DOCKER_SAVE = 'docker-save'
|
10
10
|
DOCKER_TAG = 'docker-tag'
|
11
11
|
VAGRANT = 'vagrant'
|
12
|
+
COMPRESS = 'compress'
|
13
|
+
SHELL_LOCAL = 'shell-local'
|
12
14
|
|
13
15
|
VALID_POST_PROCESSOR_TYPES = [
|
14
16
|
DOCKER_IMPORT,
|
15
17
|
DOCKER_PUSH,
|
16
18
|
DOCKER_SAVE,
|
17
19
|
DOCKER_TAG,
|
18
|
-
|
20
|
+
COMPRESS,
|
21
|
+
VAGRANT,
|
22
|
+
SHELL_LOCAL
|
19
23
|
]
|
20
24
|
|
21
25
|
class UnrecognizedPostProcessorTypeError < StandardError
|
@@ -30,6 +34,8 @@ module Packer
|
|
30
34
|
DOCKER_PUSH => Packer::PostProcessor::DockerPush,
|
31
35
|
DOCKER_SAVE => Packer::PostProcessor::DockerSave,
|
32
36
|
DOCKER_TAG => Packer::PostProcessor::DockerTag,
|
37
|
+
COMPRESS => Packer::PostProcessor::Compress,
|
38
|
+
SHELL_LOCAL => Packer::PostProcessor::ShellLocal,
|
33
39
|
VAGRANT => Packer::PostProcessor::Vagrant
|
34
40
|
}.fetch(type).new
|
35
41
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# Encoding: utf-8
|
2
|
+
require 'packer/postprocessor'
|
3
|
+
require 'packer/dataobject'
|
4
|
+
|
5
|
+
module Packer
|
6
|
+
class PostProcessor < Packer::DataObject
|
7
|
+
class Compress < PostProcessor
|
8
|
+
def initialize
|
9
|
+
super()
|
10
|
+
self.data['type'] = COMPRESS
|
11
|
+
end
|
12
|
+
|
13
|
+
def compression_level(level)
|
14
|
+
self.__add_integer('compression_level', level)
|
15
|
+
end
|
16
|
+
|
17
|
+
def keep_input_artifact(bool)
|
18
|
+
self.__add_boolean('keep_input_artifact', bool)
|
19
|
+
end
|
20
|
+
|
21
|
+
def output(file)
|
22
|
+
self.__add_string('output', file)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# Encoding: utf-8
|
2
|
+
require 'packer/postprocessor'
|
3
|
+
require 'packer/dataobject'
|
4
|
+
|
5
|
+
module Packer
|
6
|
+
class PostProcessor < Packer::DataObject
|
7
|
+
class ShellLocal < PostProcessor
|
8
|
+
def initialize
|
9
|
+
super
|
10
|
+
self.data['type'] = SHELL_LOCAL
|
11
|
+
self.add_required(['inline', 'script', 'scripts'])
|
12
|
+
end
|
13
|
+
def inline(commands)
|
14
|
+
self.__add_array_of_strings('inline', commands, %w[script scripts])
|
15
|
+
end
|
16
|
+
|
17
|
+
def script(filename)
|
18
|
+
self.__add_string('script', filename, %w[inline scripts])
|
19
|
+
end
|
20
|
+
|
21
|
+
def scripts(filenames)
|
22
|
+
self.__add_array_of_strings('scripts', filenames, %w[inline script])
|
23
|
+
end
|
24
|
+
|
25
|
+
def binary(bool)
|
26
|
+
self.__add_boolean('binary', bool, [])
|
27
|
+
end
|
28
|
+
|
29
|
+
def environment_vars(envpairs)
|
30
|
+
self.__add_array_of_strings('environment_vars', envpairs)
|
31
|
+
end
|
32
|
+
|
33
|
+
def execute_command(command)
|
34
|
+
self.__add_string('execute_command', command)
|
35
|
+
end
|
36
|
+
|
37
|
+
def inline_shebang(command)
|
38
|
+
self.__add_string('inline_shebang', command)
|
39
|
+
end
|
40
|
+
|
41
|
+
def remote_path(command)
|
42
|
+
self.__add_string('remote_path', command)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
data/lib/packer/runner.rb
CHANGED
@@ -8,10 +8,13 @@ module Packer
|
|
8
8
|
|
9
9
|
def self.run!(*args, quiet: false)
|
10
10
|
cmd = Shellwords.shelljoin(args.flatten)
|
11
|
+
|
12
|
+
debug = cmd.include? '-debug'
|
13
|
+
|
11
14
|
status = 0
|
12
15
|
stdout = ''
|
13
16
|
stderr = ''
|
14
|
-
if quiet
|
17
|
+
if quiet && !debug
|
15
18
|
# Run without streaming std* to any screen
|
16
19
|
stdout, stderr, status = Open3.capture3(cmd)
|
17
20
|
else
|
@@ -31,6 +34,10 @@ module Packer
|
|
31
34
|
end
|
32
35
|
end
|
33
36
|
|
37
|
+
Thread.new do
|
38
|
+
std_in.puts $stdin.gets while thread.alive?
|
39
|
+
end
|
40
|
+
|
34
41
|
thread.join # don't exit until the external process is done
|
35
42
|
status = thread.value
|
36
43
|
end
|
data/lib/packer/version.rb
CHANGED
data/packer-config.gemspec
CHANGED
@@ -6,7 +6,7 @@ require 'packer/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = 'packer-config'
|
8
8
|
spec.version = Packer::VERSION
|
9
|
-
spec.authors = ["Ian Chesal", "Fraser Cobb", "Greg Poirier", "Matasano Security", "Greg Diamond", "Enzo Rivello"]
|
9
|
+
spec.authors = ["Ian Chesal", "Fraser Cobb", "Greg Poirier", "Matasano Security", "Greg Diamond", "Enzo Rivello", "Edwin Biemond", "Andrei Shiniti Nakagawa"]
|
10
10
|
spec.email = %w(ian.chesal@gmail.com)
|
11
11
|
spec.summary = 'An object model to build packer.io configurations in Ruby.'
|
12
12
|
spec.description = <<-END
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# Encoding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
RSpec.describe Packer::Builder::Qemu do
|
5
|
+
let(:builder) { Packer::Builder.get_builder(Packer::Builder::QEMU) }
|
6
|
+
let(:in_commands_mixed) { [["command1", 1], ["command2", 2]] }
|
7
|
+
let(:out_commands_strings) { [["command1", "1"], ["command2", "2"]] }
|
8
|
+
|
9
|
+
it 'has a type of qemu' do
|
10
|
+
expect(builder.data['type']).to eq(Packer::Builder::QEMU)
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'requires iso_checksum, iso_checksum_type, iso_url, and communicator' do
|
14
|
+
expect { builder.validate }.to raise_error(Packer::DataObject::DataValidationError)
|
15
|
+
builder.iso_checksum '88197272b2a442402820fcc788a8cc7a'
|
16
|
+
builder.iso_checksum_type "MD5"
|
17
|
+
builder.iso_url 'path'
|
18
|
+
builder.communicator 'ssh'
|
19
|
+
expect { builder.validate }.not_to raise_error
|
20
|
+
end
|
21
|
+
|
22
|
+
describe '#qemuargs' do
|
23
|
+
it 'builds an array of arrays of strings' do
|
24
|
+
builder.qemuargs(in_commands_mixed)
|
25
|
+
expect( builder.data['qemuargs'] ).to eq(out_commands_strings)
|
26
|
+
builder.data.delete('qemuargs')
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,108 @@
|
|
1
|
+
# Encoding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
RSpec.describe Packer::PostProcessor::ShellLocal do
|
5
|
+
let(:postprocessor) do
|
6
|
+
Packer::PostProcessor.get_postprocessor(Packer::PostProcessor::SHELL_LOCAL)
|
7
|
+
end
|
8
|
+
|
9
|
+
let(:some_string) do
|
10
|
+
'some string'
|
11
|
+
end
|
12
|
+
|
13
|
+
let(:some_array_of_strings) do
|
14
|
+
%w[command1 command2]
|
15
|
+
end
|
16
|
+
|
17
|
+
let(:some_array_of_ints) do
|
18
|
+
[1, 2, 3]
|
19
|
+
end
|
20
|
+
|
21
|
+
describe '#initialize' do
|
22
|
+
it 'has a type of shell' do
|
23
|
+
expect(postprocessor.data['type']).to eq(Packer::PostProcessor::SHELL_LOCAL)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe '#inline' do
|
28
|
+
it 'accepts an array of commands' do
|
29
|
+
postprocessor.inline(some_array_of_strings)
|
30
|
+
expect(postprocessor.data['inline']).to eq(some_array_of_strings)
|
31
|
+
postprocessor.data.delete('inline')
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'raise an error if it is empty' do
|
35
|
+
expect { postprocessor.inline('') }.to raise_error
|
36
|
+
postprocessor.data.delete('inline')
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'converts all commands to strings' do
|
40
|
+
postprocessor.inline(some_array_of_ints)
|
41
|
+
expect(postprocessor.data['inline']).to eq(some_array_of_ints.map(&:to_s))
|
42
|
+
postprocessor.data.delete('inline')
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'raises an error if the commands argument cannot be made an Array' do
|
46
|
+
expect { postprocessor.inline(some_string) }.to raise_error
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'raises an error if #script or #scripts method was already called' do
|
50
|
+
postprocessor.data['script'] = 1
|
51
|
+
expect { postprocessor.inline(some_array_of_strings) }.to raise_error
|
52
|
+
postprocessor.data.delete('script')
|
53
|
+
postprocessor.data['scripts'] = 1
|
54
|
+
expect { postprocessor.inline(some_array_of_strings) }.to raise_error
|
55
|
+
postprocessor.data.delete('scripts')
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
describe '#script' do
|
60
|
+
it 'accepts a string' do
|
61
|
+
postprocessor.script(some_string)
|
62
|
+
expect(postprocessor.data['script']).to eq(some_string)
|
63
|
+
postprocessor.data.delete('script')
|
64
|
+
end
|
65
|
+
|
66
|
+
it 'converts any argument passed to a string' do
|
67
|
+
postprocessor.script(some_array_of_ints)
|
68
|
+
expect(postprocessor.data['script']).to eq(some_array_of_ints.to_s)
|
69
|
+
postprocessor.data.delete('script')
|
70
|
+
end
|
71
|
+
|
72
|
+
it 'raises an error if #inline or #scripts method was already called' do
|
73
|
+
postprocessor.data['inline'] = 1
|
74
|
+
expect { postprocessor.script(some_string) }.to raise_error
|
75
|
+
postprocessor.data.delete('inline')
|
76
|
+
postprocessor.data['scripts'] = 1
|
77
|
+
expect { postprocessor.script(some_string) }.to raise_error
|
78
|
+
postprocessor.data.delete('scripts')
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
describe '#scripts' do
|
83
|
+
it 'accepts an array of commands' do
|
84
|
+
postprocessor.scripts(some_array_of_strings)
|
85
|
+
expect(postprocessor.data['scripts']).to eq(some_array_of_strings)
|
86
|
+
postprocessor.data.delete('scripts')
|
87
|
+
end
|
88
|
+
|
89
|
+
it 'converts all commands to strings' do
|
90
|
+
postprocessor.scripts(some_array_of_ints)
|
91
|
+
expect(postprocessor.data['scripts']).to eq(some_array_of_ints.map(&:to_s))
|
92
|
+
postprocessor.data.delete('scripts')
|
93
|
+
end
|
94
|
+
|
95
|
+
it 'raises an error if the commands argument cannot be made an Array' do
|
96
|
+
expect { postprocessor.scripts(some_string) }.to raise_error
|
97
|
+
end
|
98
|
+
|
99
|
+
it 'raises an error if #inline or #script method was already called' do
|
100
|
+
postprocessor.data['script'] = 1
|
101
|
+
expect { postprocessor.scripts(some_array_of_strings) }.to raise_error
|
102
|
+
postprocessor.data.delete('scripts')
|
103
|
+
postprocessor.data['inline'] = 1
|
104
|
+
expect { postprocessor.scripts(some_array_of_strings) }.to raise_error
|
105
|
+
postprocessor.data.delete('scripts')
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
@@ -63,4 +63,12 @@ RSpec.describe Packer::Provisioner::Chef::Client do
|
|
63
63
|
expect { provisioner.run_list(some_string) }.to raise_error
|
64
64
|
end
|
65
65
|
end
|
66
|
+
|
67
|
+
describe '#client_key' do
|
68
|
+
it 'accepts a string' do
|
69
|
+
provisioner.client_key some_string
|
70
|
+
expect(provisioner.data['client_key']).to eq(some_string)
|
71
|
+
provisioner.data.delete('client_key')
|
72
|
+
end
|
73
|
+
end
|
66
74
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: packer-config
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ian Chesal
|
@@ -10,10 +10,12 @@ authors:
|
|
10
10
|
- Matasano Security
|
11
11
|
- Greg Diamond
|
12
12
|
- Enzo Rivello
|
13
|
+
- Edwin Biemond
|
14
|
+
- Andrei Shiniti Nakagawa
|
13
15
|
autorequire:
|
14
16
|
bindir: bin
|
15
17
|
cert_chain: []
|
16
|
-
date: 2018-08-
|
18
|
+
date: 2018-08-04 00:00:00.000000000 Z
|
17
19
|
dependencies: []
|
18
20
|
description: |
|
19
21
|
Building the Packer JSON configurations in raw JSON can be quite an adventure.
|
@@ -29,6 +31,7 @@ extensions: []
|
|
29
31
|
extra_rdoc_files: []
|
30
32
|
files:
|
31
33
|
- ".gitignore"
|
34
|
+
- ".rspec"
|
32
35
|
- ".rubocop.yml"
|
33
36
|
- ".rubocop_todo.yml"
|
34
37
|
- ".travis.yml"
|
@@ -45,6 +48,7 @@ files:
|
|
45
48
|
- lib/packer/builders/amazon.rb
|
46
49
|
- lib/packer/builders/docker.rb
|
47
50
|
- lib/packer/builders/null.rb
|
51
|
+
- lib/packer/builders/qemu.rb
|
48
52
|
- lib/packer/builders/virtualbox.rb
|
49
53
|
- lib/packer/builders/vmware_iso.rb
|
50
54
|
- lib/packer/builders/vmware_vmx.rb
|
@@ -53,7 +57,9 @@ files:
|
|
53
57
|
- lib/packer/macro.rb
|
54
58
|
- lib/packer/postprocessor.rb
|
55
59
|
- lib/packer/postprocessors/all.rb
|
60
|
+
- lib/packer/postprocessors/compress.rb
|
56
61
|
- lib/packer/postprocessors/docker.rb
|
62
|
+
- lib/packer/postprocessors/shell-local.rb
|
57
63
|
- lib/packer/postprocessors/vagrant.rb
|
58
64
|
- lib/packer/provisioner.rb
|
59
65
|
- lib/packer/provisioners/all.rb
|
@@ -88,6 +94,7 @@ files:
|
|
88
94
|
- spec/packer/builders/amazon_spec.rb
|
89
95
|
- spec/packer/builders/docker_spec.rb
|
90
96
|
- spec/packer/builders/null_spec.rb
|
97
|
+
- spec/packer/builders/qemu_spec.rb
|
91
98
|
- spec/packer/builders/virtualbox_spec.rb
|
92
99
|
- spec/packer/builders/vmware_iso_spec.rb
|
93
100
|
- spec/packer/builders/vmware_vmx_spec.rb
|
@@ -99,6 +106,7 @@ files:
|
|
99
106
|
- spec/packer/postprocessors/docker_push_spec.rb
|
100
107
|
- spec/packer/postprocessors/docker_save_spec.rb
|
101
108
|
- spec/packer/postprocessors/docker_tag_spec.rb
|
109
|
+
- spec/packer/postprocessors/shell_local_spec.rb
|
102
110
|
- spec/packer/postprocessors/vagrant_spec.rb
|
103
111
|
- spec/packer/provisioner_spec.rb
|
104
112
|
- spec/packer/provisioners/ansible_spec.rb
|
@@ -140,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
140
148
|
version: '0'
|
141
149
|
requirements: []
|
142
150
|
rubyforge_project:
|
143
|
-
rubygems_version: 2.
|
151
|
+
rubygems_version: 2.6.13
|
144
152
|
signing_key:
|
145
153
|
specification_version: 4
|
146
154
|
summary: An object model to build packer.io configurations in Ruby.
|
@@ -162,6 +170,7 @@ test_files:
|
|
162
170
|
- spec/packer/builders/amazon_spec.rb
|
163
171
|
- spec/packer/builders/docker_spec.rb
|
164
172
|
- spec/packer/builders/null_spec.rb
|
173
|
+
- spec/packer/builders/qemu_spec.rb
|
165
174
|
- spec/packer/builders/virtualbox_spec.rb
|
166
175
|
- spec/packer/builders/vmware_iso_spec.rb
|
167
176
|
- spec/packer/builders/vmware_vmx_spec.rb
|
@@ -173,6 +182,7 @@ test_files:
|
|
173
182
|
- spec/packer/postprocessors/docker_push_spec.rb
|
174
183
|
- spec/packer/postprocessors/docker_save_spec.rb
|
175
184
|
- spec/packer/postprocessors/docker_tag_spec.rb
|
185
|
+
- spec/packer/postprocessors/shell_local_spec.rb
|
176
186
|
- spec/packer/postprocessors/vagrant_spec.rb
|
177
187
|
- spec/packer/provisioner_spec.rb
|
178
188
|
- spec/packer/provisioners/ansible_spec.rb
|