packer-config 1.0.0 → 1.1.0
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 +4 -4
- data/.gitignore +2 -1
- data/COPYRIGHT +1 -0
- data/RELEASENOTES.md +3 -0
- data/Rakefile +1 -31
- data/lib/packer-config.rb +1 -2
- data/lib/packer/builder.rb +3 -0
- data/lib/packer/builders/all.rb +1 -0
- data/lib/packer/builders/vmware_vmx.rb +110 -0
- data/lib/packer/version.rb +3 -0
- data/packer-config.gemspec +7 -4
- data/spec/integration/scripts/kickstart/{centos-6.5-ks.cfg → centos-6.6-ks.cfg} +0 -0
- data/spec/packer/builders/vmware_vmx_spec.rb +29 -0
- data/tasks/clean.rake +16 -0
- data/tasks/rspec.rake +12 -0
- data/tasks/rubocop.rake +3 -0
- data/tasks/rubygems.rake +2 -0
- metadata +28 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 148517d2535b585d2b88e40901b6f5c5e393b715
|
4
|
+
data.tar.gz: 04f60d496b44cfb03181914a6657a789be35a8f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c45a724bbd36bcb1746e91e15e5499452970c1474e347c71307035cd571d0446cfaa4ca04df27915f4ecaa0985254f479fd34fb177719f28dfe73f5a11502589
|
7
|
+
data.tar.gz: ffacf9de4ecd57ff523123cf29ba7a03dc07106aba1b21f259c55942a986972300e44a6930a97f5b31bce9abb246e2b990718690b75b560123b35ac688857260
|
data/.gitignore
CHANGED
@@ -7,6 +7,7 @@
|
|
7
7
|
/pkg/
|
8
8
|
/spec/reports/
|
9
9
|
/spec/integration/*.json
|
10
|
+
spec/integration/centos-6.*-x86_64-virtualbox
|
10
11
|
/test/tmp/
|
11
12
|
/test/version_tmp/
|
12
13
|
/tmp/
|
@@ -34,4 +35,4 @@ Gemfile.lock
|
|
34
35
|
.ruby-gemset
|
35
36
|
|
36
37
|
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
37
|
-
.rvmrc
|
38
|
+
.rvmrc
|
data/COPYRIGHT
CHANGED
data/RELEASENOTES.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# packer-config Release Notes
|
2
2
|
|
3
|
+
## 1.1.0
|
4
|
+
* Thanks to [grepory](https://github.com/grepory) we have a `vmware-vmx` builder
|
5
|
+
|
3
6
|
## 1.0.0
|
4
7
|
* A 1.0.0 release because...why not? You're either working or you're not and this is working so let's drop the `0.x.x` pretense and tango.
|
5
8
|
* Thanks to [frasercobb](https://github.com/frasercobb) we have `puppet-server` and `puppet-masterless` provisioner interfaces
|
data/Rakefile
CHANGED
@@ -1,33 +1,3 @@
|
|
1
1
|
# Encoding: utf-8
|
2
|
-
|
3
|
-
require 'rspec/core/rake_task'
|
4
|
-
require 'fileutils'
|
5
|
-
|
6
|
-
RuboCop::RakeTask.new(:lint)
|
7
|
-
|
2
|
+
Dir.glob('tasks/**/*.rake').each(&method(:import))
|
8
3
|
task :default => [:lint, 'test:spec']
|
9
|
-
|
10
|
-
task :build => [:lint, 'test:spec', :clean] do
|
11
|
-
`gem build packer-config.gemspec`
|
12
|
-
end
|
13
|
-
|
14
|
-
namespace :test do
|
15
|
-
RSpec::Core::RakeTask.new(:spec) do |t|
|
16
|
-
t.pattern = Dir['spec/**/*_spec.rb'].reject{ |f| f['/integration'] }
|
17
|
-
end
|
18
|
-
|
19
|
-
RSpec::Core::RakeTask.new(:integration) do |t|
|
20
|
-
t.pattern = "spec/integration/**/*_spec.rb"
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
CLEAN = FileList['deployment_dir/**/*'].exclude('*.txt')
|
25
|
-
|
26
|
-
task :clean do
|
27
|
-
FileList['spec/integration/packer_cache/*'].each do |f|
|
28
|
-
FileUtils.rm_f(f)
|
29
|
-
end
|
30
|
-
Dir.glob('spec/integration/builds/*').select {|f| File.directory? f}.each do |d|
|
31
|
-
FileUtils.rm_rf(d)
|
32
|
-
end
|
33
|
-
end
|
data/lib/packer-config.rb
CHANGED
@@ -7,11 +7,10 @@ require 'packer/provisioner'
|
|
7
7
|
require 'packer/postprocessor'
|
8
8
|
require 'packer/macro'
|
9
9
|
require 'packer/envvar'
|
10
|
+
require 'packer/version'
|
10
11
|
|
11
12
|
module Packer
|
12
13
|
class Config < Packer::DataObject
|
13
|
-
VERSION = '1.0.0'
|
14
|
-
|
15
14
|
attr_accessor :builders
|
16
15
|
attr_accessor :postprocessors
|
17
16
|
attr_accessor :provisioners
|
data/lib/packer/builder.rb
CHANGED
@@ -7,6 +7,7 @@ module Packer
|
|
7
7
|
AMAZON_INSTANCE = 'amazon-instance'
|
8
8
|
DOCKER = 'docker'
|
9
9
|
VIRTUALBOX_ISO = 'virtualbox-iso'
|
10
|
+
VMWARE_VMX = 'vmware-vmx'
|
10
11
|
NULL = 'null'
|
11
12
|
|
12
13
|
VALID_BUILDER_TYPES = [
|
@@ -14,6 +15,7 @@ module Packer
|
|
14
15
|
AMAZON_INSTANCE,
|
15
16
|
DOCKER,
|
16
17
|
VIRTUALBOX_ISO,
|
18
|
+
VMWARE_VMX,
|
17
19
|
NULL
|
18
20
|
]
|
19
21
|
|
@@ -29,6 +31,7 @@ module Packer
|
|
29
31
|
AMAZON_INSTANCE => Packer::Builder::Amazon::Instance,
|
30
32
|
DOCKER => Packer::Builder::Docker,
|
31
33
|
VIRTUALBOX_ISO => Packer::Builder::VirtualBoxISO,
|
34
|
+
VMWARE_VMX => Packer::Builder::VMWareVMX,
|
32
35
|
NULL => Packer::Builder::Null
|
33
36
|
}.fetch(type).new
|
34
37
|
end
|
data/lib/packer/builders/all.rb
CHANGED
@@ -0,0 +1,110 @@
|
|
1
|
+
module Packer
|
2
|
+
class Builder
|
3
|
+
class VMWareVMX < Builder
|
4
|
+
def initialize
|
5
|
+
super
|
6
|
+
data['type'] = VMWARE_VMX
|
7
|
+
add_required(
|
8
|
+
'source_path',
|
9
|
+
'ssh_username'
|
10
|
+
)
|
11
|
+
end
|
12
|
+
|
13
|
+
def source_path(path)
|
14
|
+
__add_string('source_path', path)
|
15
|
+
end
|
16
|
+
|
17
|
+
def ssh_username(username)
|
18
|
+
__add_string('ssh_username', username)
|
19
|
+
end
|
20
|
+
|
21
|
+
def ssh_password(password)
|
22
|
+
__add_string('ssh_password', password)
|
23
|
+
end
|
24
|
+
|
25
|
+
def boot_command(commands)
|
26
|
+
__add_array_of_strings('boot_command', commands)
|
27
|
+
end
|
28
|
+
|
29
|
+
def boot_wait(wait)
|
30
|
+
__add_string('boot_wait', wait)
|
31
|
+
end
|
32
|
+
|
33
|
+
def floppy_files(files)
|
34
|
+
__add_array_of_strings('floppy_files', files)
|
35
|
+
end
|
36
|
+
|
37
|
+
def fusion_app_path(app_path)
|
38
|
+
__add_string('fusion_app_path', app_path)
|
39
|
+
end
|
40
|
+
|
41
|
+
def headless(bool)
|
42
|
+
__add_boolean('headless', bool)
|
43
|
+
end
|
44
|
+
|
45
|
+
def http_directory(path)
|
46
|
+
__add_string('http_directory', path)
|
47
|
+
end
|
48
|
+
|
49
|
+
def http_port_min(port)
|
50
|
+
__add_integer('http_port_min', port)
|
51
|
+
end
|
52
|
+
|
53
|
+
def http_port_max(port)
|
54
|
+
__add_integer('http_port_max', port)
|
55
|
+
end
|
56
|
+
|
57
|
+
def output_directory(path)
|
58
|
+
__add_string('output_directory', path)
|
59
|
+
end
|
60
|
+
|
61
|
+
def shutdown_command(command)
|
62
|
+
__add_string('shutdown_command', command)
|
63
|
+
end
|
64
|
+
|
65
|
+
def shutdown_timeout(timeout)
|
66
|
+
__add_string('shutdown_timeout', timeout)
|
67
|
+
end
|
68
|
+
|
69
|
+
def skip_compaction(bool)
|
70
|
+
__add_boolean('skip_compaction', bool)
|
71
|
+
end
|
72
|
+
|
73
|
+
def ssh_key_path(path)
|
74
|
+
__add_string('ssh_key_path', path)
|
75
|
+
end
|
76
|
+
|
77
|
+
def ssh_port(port)
|
78
|
+
__add_integer('ssh_port', port)
|
79
|
+
end
|
80
|
+
|
81
|
+
def ssh_skip_request_pty(bool)
|
82
|
+
__add_boolean('ssh_skip_request_pty', bool)
|
83
|
+
end
|
84
|
+
|
85
|
+
def ssh_wait_timeout(timeout)
|
86
|
+
__add_string('ssh_wait_timeout', timeout)
|
87
|
+
end
|
88
|
+
|
89
|
+
def vm_name(name)
|
90
|
+
__add_string('vm_name', name)
|
91
|
+
end
|
92
|
+
|
93
|
+
def vmx_data(data_hash)
|
94
|
+
__add_hash('vmx_data', data_hash)
|
95
|
+
end
|
96
|
+
|
97
|
+
def vmx_data_post(data_hash)
|
98
|
+
__add_hash('vmx_data_post', data_hash)
|
99
|
+
end
|
100
|
+
|
101
|
+
def vnc_port_min(port)
|
102
|
+
__add_integer('vnc_port_min', port)
|
103
|
+
end
|
104
|
+
|
105
|
+
def vnc_port_max(port)
|
106
|
+
__add_integer('vnc_port_max', port)
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
data/packer-config.gemspec
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
# Encoding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'packer/version'
|
5
|
+
|
2
6
|
Gem::Specification.new do |spec|
|
3
7
|
spec.name = "packer-config"
|
4
|
-
spec.version =
|
5
|
-
# For deploying alpha versions via Travis CI
|
6
|
-
spec.version = "#{spec.version}-alpha-#{ENV['TRAVIS_BUILD_NUMBER']}" if ENV['TRAVIS']
|
8
|
+
spec.version = Packer::VERSION
|
7
9
|
spec.authors = ["Ian Chesal", "Fraser Cobb"]
|
8
10
|
spec.email = ["ian.chesal@gmail.com"]
|
9
11
|
spec.summary = 'An object model to build packer.io configurations in Ruby.'
|
@@ -24,10 +26,11 @@ END
|
|
24
26
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
25
27
|
spec.require_paths = ["lib"]
|
26
28
|
|
27
|
-
spec.add_development_dependency "bundler", "~> 1.
|
29
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
28
30
|
spec.add_development_dependency "rake", "~> 10.3"
|
29
31
|
spec.add_development_dependency "rspec", "~> 3.0"
|
30
32
|
spec.add_development_dependency "rspec-mocks", "~> 3.0"
|
31
33
|
spec.add_development_dependency "fakefs", "~> 0.5"
|
32
34
|
spec.add_development_dependency "rubocop", "~> 0.24"
|
35
|
+
spec.add_development_dependency "rubygems-tasks", "~> 0.2"
|
33
36
|
end
|
File without changes
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# Encoding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
RSpec.describe Packer::Builder::VMWareVMX do
|
5
|
+
let(:builder) { Packer::Builder.get_builder(Packer::Builder::VMWARE_VMX) }
|
6
|
+
|
7
|
+
describe '#initialize' do
|
8
|
+
it 'has a type of VMWare VMX' do
|
9
|
+
expect(builder.data['type']).to eq(Packer::Builder::VMWARE_VMX)
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'requires source_path' do
|
13
|
+
expect { builder.validate }.to raise_error(Packer::DataObject::DataValidationError)
|
14
|
+
builder.source_path 'path'
|
15
|
+
builder.ssh_username 'user'
|
16
|
+
expect { builder.validate }.not_to raise_error
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe '#vmx_data' do
|
21
|
+
it 'adds a hash of arbitrary data' do
|
22
|
+
builder.vmx_data(
|
23
|
+
key1: 'value1',
|
24
|
+
key2: 'value2'
|
25
|
+
)
|
26
|
+
expect(builder.data['vmx_data'].keys.length).to eq(2)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/tasks/clean.rake
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
CLEAN = FileList['deployment_dir/**/*'].exclude('*.txt')
|
4
|
+
|
5
|
+
task :clean do
|
6
|
+
FileList['spec/integration/packer_cache/*'].each do |f|
|
7
|
+
FileUtils.rm_f(f)
|
8
|
+
end
|
9
|
+
Dir.glob('spec/integration/builds/*').select {|f| File.directory? f}.each do |d|
|
10
|
+
FileUtils.rm_rf(d)
|
11
|
+
end
|
12
|
+
Dir.glob('spec/integration/*.json').select {|f| File.file? f}.each do |d|
|
13
|
+
FileUtils.rm_f(d)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
data/tasks/rspec.rake
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'rspec/core/rake_task'
|
2
|
+
|
3
|
+
namespace :test do
|
4
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
5
|
+
t.pattern = Dir['spec/**/*_spec.rb'].reject{ |f| f['/integration'] }
|
6
|
+
end
|
7
|
+
|
8
|
+
RSpec::Core::RakeTask.new(:integration) do |t|
|
9
|
+
t.pattern = "spec/integration/**/*_spec.rb"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
data/tasks/rubocop.rake
ADDED
data/tasks/rubygems.rake
ADDED
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.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ian Chesal
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-04-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -17,14 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: '1.
|
20
|
+
version: '1.7'
|
21
21
|
type: :development
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: '1.
|
27
|
+
version: '1.7'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: rake
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -95,6 +95,20 @@ dependencies:
|
|
95
95
|
- - "~>"
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: '0.24'
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: rubygems-tasks
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - "~>"
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0.2'
|
105
|
+
type: :development
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - "~>"
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0.2'
|
98
112
|
description: |
|
99
113
|
Building the Packer JSON configurations in raw JSON can be quite an adventure.
|
100
114
|
There's limited facilities for variable expansion and absolutely no support for
|
@@ -125,6 +139,7 @@ files:
|
|
125
139
|
- lib/packer/builders/docker.rb
|
126
140
|
- lib/packer/builders/null.rb
|
127
141
|
- lib/packer/builders/virtualbox.rb
|
142
|
+
- lib/packer/builders/vmware_vmx.rb
|
128
143
|
- lib/packer/dataobject.rb
|
129
144
|
- lib/packer/envvar.rb
|
130
145
|
- lib/packer/macro.rb
|
@@ -143,6 +158,7 @@ files:
|
|
143
158
|
- lib/packer/provisioners/salt.rb
|
144
159
|
- lib/packer/provisioners/shell.rb
|
145
160
|
- lib/packer/runner.rb
|
161
|
+
- lib/packer/version.rb
|
146
162
|
- packer-config.gemspec
|
147
163
|
- spec/integration/README.md
|
148
164
|
- spec/integration/builds/.gitignore
|
@@ -152,7 +168,7 @@ files:
|
|
152
168
|
- spec/integration/scripts/cleanup.sh
|
153
169
|
- spec/integration/scripts/fix-slow-dns.sh
|
154
170
|
- spec/integration/scripts/hello.sh
|
155
|
-
- spec/integration/scripts/kickstart/centos-6.
|
171
|
+
- spec/integration/scripts/kickstart/centos-6.6-ks.cfg
|
156
172
|
- spec/integration/scripts/minimize.sh
|
157
173
|
- spec/integration/scripts/sshd.sh
|
158
174
|
- spec/integration/scripts/vagrant.sh
|
@@ -162,6 +178,7 @@ files:
|
|
162
178
|
- spec/packer/builders/docker_spec.rb
|
163
179
|
- spec/packer/builders/null_spec.rb
|
164
180
|
- spec/packer/builders/virtualbox_spec.rb
|
181
|
+
- spec/packer/builders/vmware_vmx_spec.rb
|
165
182
|
- spec/packer/dataobject_spec.rb
|
166
183
|
- spec/packer/envvar_spec.rb
|
167
184
|
- spec/packer/macro_spec.rb
|
@@ -182,6 +199,10 @@ files:
|
|
182
199
|
- spec/packer_config_spec.rb
|
183
200
|
- spec/spec_helper.rb
|
184
201
|
- spec/unit_helper.rb
|
202
|
+
- tasks/clean.rake
|
203
|
+
- tasks/rspec.rake
|
204
|
+
- tasks/rubocop.rake
|
205
|
+
- tasks/rubygems.rake
|
185
206
|
homepage: https://github.com/ianchesal/packer-config
|
186
207
|
licenses:
|
187
208
|
- Apache 2.0
|
@@ -215,7 +236,7 @@ test_files:
|
|
215
236
|
- spec/integration/scripts/cleanup.sh
|
216
237
|
- spec/integration/scripts/fix-slow-dns.sh
|
217
238
|
- spec/integration/scripts/hello.sh
|
218
|
-
- spec/integration/scripts/kickstart/centos-6.
|
239
|
+
- spec/integration/scripts/kickstart/centos-6.6-ks.cfg
|
219
240
|
- spec/integration/scripts/minimize.sh
|
220
241
|
- spec/integration/scripts/sshd.sh
|
221
242
|
- spec/integration/scripts/vagrant.sh
|
@@ -225,6 +246,7 @@ test_files:
|
|
225
246
|
- spec/packer/builders/docker_spec.rb
|
226
247
|
- spec/packer/builders/null_spec.rb
|
227
248
|
- spec/packer/builders/virtualbox_spec.rb
|
249
|
+
- spec/packer/builders/vmware_vmx_spec.rb
|
228
250
|
- spec/packer/dataobject_spec.rb
|
229
251
|
- spec/packer/envvar_spec.rb
|
230
252
|
- spec/packer/macro_spec.rb
|