packer-config 1.2.0 → 1.3.0

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: 0f326683585a01902ddd9d38a88269cb0d95655b
4
- data.tar.gz: 5488b3e8d5c0c397d28c74d36db2220e7c80357b
3
+ metadata.gz: c8de1334da3aa16a57f01bff48f08a13e33d2c67
4
+ data.tar.gz: 76290e07c81e05952d0f85078895bddd13e259e1
5
5
  SHA512:
6
- metadata.gz: a4cd9a12a2e6451b72e0cbd8920500d18956c7faa74a097e31929d7202db35a4dc2549cbedbd52f2c93786c36394c0bd4361e27513cf8d38d9e5a8a3897213fa
7
- data.tar.gz: af76bc9e7d325e3eae01a5c7eefd597ff06d28a1ede9298dcdd659ab1c748e46fad023f4787cd72d98ef6fc016adb0c692f54fda0376872e55e7b2a0afcc2074
6
+ metadata.gz: 21ca6ae91b5bdff076db92049dad808bc2c8306de246e3d7c094f916ba92b1bb8e2cba9db12de47b5e3646f82205046fd115ba8321a77f39519127fe50289d44
7
+ data.tar.gz: 2a2cebc0f3cb6d359704092cb691405db9a6427b10c51709239c2f7bd2b46338437cdfa211285188a84db3d717d290d430433b68957f5d38637d758ef0fffcf2
data/README.md CHANGED
@@ -21,6 +21,8 @@ Bonus: you can really go to town with templates when it's all done it Ruby.
21
21
 
22
22
  ## Use
23
23
 
24
+ require 'packer-config'
25
+
24
26
  ### Builders
25
27
 
26
28
  The following [Packer builders](http://www.packer.io/docs/templates/builders.html) are currently implemented:
@@ -29,6 +31,8 @@ The following [Packer builders](http://www.packer.io/docs/templates/builders.htm
29
31
  * [amazon-instance](http://www.packer.io/docs/builders/amazon-instance.html)
30
32
  * [docker](http://www.packer.io/docs/builders/docker.html)
31
33
  * [virtualbox-iso](http://www.packer.io/docs/builders/virtualbox-iso.html)
34
+ * [vmware-vmx](https://www.packer.io/docs/builders/vmware-vmx)
35
+ * [vmware-iso](https://www.packer.io/docs/builders/vmware-iso)
32
36
  * [null](https://www.packer.io/docs/builders/null.html)
33
37
 
34
38
  ### Provisioners
@@ -137,6 +141,8 @@ I'm using Travis CI to build and test on every push to the public github reposit
137
141
 
138
142
  I'm using [git-flow](http://nvie.com/posts/a-successful-git-branching-model/) for development in git via github. I've loved the branching model git-flow proposed from day one and the addon to git makes it very intuitive and easy to follow. I generally don't push my `feature/*` branches to the public repository; I do keep `development` and `master` up to date here though.
139
143
 
144
+ **PLEASE OPEN PULL REQUESTS AGAINST `develop` AND NOT `master`! THANK YOU!**
145
+
140
146
  ### TODO Work
141
147
 
142
148
  Please see [TODO.md](TODO.md) for the short list of big things I thought worth writing down.
data/RELEASENOTES.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # packer-config Release Notes
2
2
 
3
+ ## 1.3.0
4
+
5
+ * Add support for vmware-vmx building (via [tduehr][])
6
+
3
7
  ## 1.2.0
4
8
 
5
9
  * Add support for docker-save post-processor (via [frasercobb][])
@@ -22,6 +26,7 @@
22
26
  * Started writing release notes!
23
27
 
24
28
 
29
+ [tduehr]: https://github.com/tduehr
25
30
  [frasercobb]: https://github.com/frasercobb
26
31
  [grepory]: https://github.com/grepory
27
32
  [ianchesal]: https://github.com/ianchesal
@@ -8,6 +8,7 @@ module Packer
8
8
  DOCKER = 'docker'
9
9
  VIRTUALBOX_ISO = 'virtualbox-iso'
10
10
  VMWARE_VMX = 'vmware-vmx'
11
+ VMWARE_ISO = 'vmware-iso'
11
12
  NULL = 'null'
12
13
 
13
14
  VALID_BUILDER_TYPES = [
@@ -16,6 +17,7 @@ module Packer
16
17
  DOCKER,
17
18
  VIRTUALBOX_ISO,
18
19
  VMWARE_VMX,
20
+ VMWARE_ISO,
19
21
  NULL
20
22
  ]
21
23
 
@@ -32,6 +34,7 @@ module Packer
32
34
  DOCKER => Packer::Builder::Docker,
33
35
  VIRTUALBOX_ISO => Packer::Builder::VirtualBoxISO,
34
36
  VMWARE_VMX => Packer::Builder::VMWareVMX,
37
+ VMWARE_ISO => Packer::Builder::VMWareISO,
35
38
  NULL => Packer::Builder::Null
36
39
  }.fetch(type).new
37
40
  end
@@ -3,4 +3,5 @@ require 'packer/builders/amazon'
3
3
  require 'packer/builders/docker'
4
4
  require 'packer/builders/virtualbox'
5
5
  require 'packer/builders/vmware_vmx'
6
+ require 'packer/builders/vmware_iso'
6
7
  require 'packer/builders/null'
@@ -0,0 +1,206 @@
1
+ # Encoding: utf-8
2
+ require 'packer/builder'
3
+ require 'packer/dataobject'
4
+
5
+ module Packer
6
+ class Builder < Packer::DataObject
7
+ class VMWareISO < Builder
8
+ def initialize
9
+ super
10
+ self.data['type'] = VMWARE_ISO
11
+ self.add_required(
12
+ 'iso_checksum',
13
+ 'iso_checksum_type',
14
+ 'iso_url',
15
+ 'ssh_username'
16
+ )
17
+ end
18
+
19
+ def iso_checksum(checksum)
20
+ self.__add_string('iso_checksum', checksum)
21
+ end
22
+
23
+ def iso_checksum_type(type)
24
+ self.__add_string('iso_checksum_type', type)
25
+ end
26
+
27
+ def iso_url(url)
28
+ self.__add_string('iso_url', url, %w[iso_urls])
29
+ end
30
+
31
+ def iso_urls(urls)
32
+ self.__add_array_of_strings('iso_urls', urls, %[iso_url])
33
+ end
34
+
35
+ def ssh_username(username)
36
+ self.__add_string('ssh_username', username)
37
+ end
38
+
39
+ def boot_command(commands)
40
+ self.__add_array_of_strings('boot_command', commands)
41
+ end
42
+
43
+ def boot_wait(time)
44
+ self.__add_string('boot_wait',time)
45
+ end
46
+
47
+ def disk_size(megabytes)
48
+ self.__add_integer('disk_size', megabytes)
49
+ end
50
+
51
+ # 0 - create a growable virtual disk contained in a single file (monolithic sparse).
52
+ # 1 - create a growable virtual disk split into 2GB files (split sparse).
53
+ # 2 - create a preallocated virtual disk contained in a single file (monolithic flat).
54
+ # 3 - create a preallocated virtual disk split into 2GB files (split flat).
55
+ # 4 - create a preallocated virtual disk compatible with ESX server (VMFS flat).
56
+ # 5 - create a compressed disk optimized for streaming.
57
+ def disk_type_id(tid)
58
+ self.__add_string('disk_type_id',tid)
59
+ end
60
+
61
+ def floppy_files(files)
62
+ self.__add_array_of_strings('floppy_files', files)
63
+ end
64
+
65
+ def fusion_app_path(app_path)
66
+ self.__add_string('fusion_app_path',app_path)
67
+ end
68
+
69
+ def guest_os_type(ostype)
70
+ self.__add_string('guest_os_type', ostype)
71
+ end
72
+
73
+ def headless(bool)
74
+ self.__add_boolean('headless', bool)
75
+ end
76
+
77
+ def http_directory(directory)
78
+ self.__add_string('http_directory', directory)
79
+ end
80
+
81
+ def http_port_min(port_number)
82
+ self.__add_integer('http_port_min', port_number)
83
+ end
84
+
85
+ def http_port_max(port_number)
86
+ self.__add_integer('http_port_max', port_number)
87
+ end
88
+
89
+ def output_directory(directory)
90
+ self.__add_string('output_directory', directory)
91
+ end
92
+
93
+ def remote_cache_datastore(cache)
94
+ self.__add_string('remote_cache_datastore', cache)
95
+ end
96
+
97
+ def remote_cache_directory(cache_directory)
98
+ self.__add_string('remote_cache_directory', cache_directory)
99
+ end
100
+
101
+ def remote_datastore(datastore)
102
+ self.__add_string('remote_datastore', datastore)
103
+ end
104
+
105
+ def remote_host(host)
106
+ self.__add_string('remote_host', host)
107
+ end
108
+
109
+ def remote_password(passwd)
110
+ self.__add_string('remote_password', passwd)
111
+ end
112
+
113
+ def remote_type(typ)
114
+ self.__add_string('remote_type', typ)
115
+ end
116
+
117
+ def remote_username(username)
118
+ self.__add_string('remote_username', username)
119
+ end
120
+
121
+ def shutdown_command(command)
122
+ self.__add_string('shutdown_command', command)
123
+ end
124
+
125
+ def shutdown_timeout(time)
126
+ self.__add_string('shutdown_timeout', time)
127
+ end
128
+
129
+ def skip_compaction(bool)
130
+ self.__add_boolean('skip_compaction', bool)
131
+ end
132
+
133
+ def ssh_host(host)
134
+ self.__add_string('ssh_host', host)
135
+ end
136
+
137
+ def ssh_host_port_min(port_number)
138
+ self.__add_integer('ssh_host_port_min', port_number)
139
+ end
140
+
141
+ def ssh_host_port_max(port_number)
142
+ self.__add_integer('ssh_host_port_max', port_number)
143
+ end
144
+
145
+ def ssh_key_path(path)
146
+ self.__add_string('ssh_key_path', path)
147
+ end
148
+
149
+ def ssh_password(password)
150
+ self.__add_string('ssh_password', password)
151
+ end
152
+
153
+ def ssh_port(port_number)
154
+ self.__add_integer('ssh_port', port_number)
155
+ end
156
+
157
+ def ssh_skip_request_pty(bool)
158
+ self.__add_boolean('ssh_skip_request_pty', bool)
159
+ end
160
+
161
+ def ssh_wait_timeout(time)
162
+ self.__add_string('ssh_wait_timeout', time)
163
+ end
164
+
165
+ def tools_upload_flavor(flavor)
166
+ self.__add_string('tools_upload_flavor', flavor)
167
+ end
168
+
169
+ def tools_upload_path(path)
170
+ self.__add_string('tools_upload_path', path)
171
+ end
172
+
173
+ def version(version)
174
+ self.__add_string('version', version)
175
+ end
176
+
177
+ def vm_name(name)
178
+ self.__add_string('vm_name', name)
179
+ end
180
+
181
+ def vmdk_name(name)
182
+ self.__add_string('vmdk_name', name)
183
+ end
184
+
185
+ def vmx_data(data)
186
+ self.__add_hash('vmx_data', data)
187
+ end
188
+
189
+ def vmx_data_post(data)
190
+ self.__add_hash('vmx_data_post', data)
191
+ end
192
+
193
+ def vmx_template_path(path)
194
+ self.__add_string('vmx_template_path', path)
195
+ end
196
+
197
+ def vnc_port_min(port)
198
+ self.__add_integer('vnc_port_min', port)
199
+ end
200
+
201
+ def vnc_port_max(port)
202
+ self.__add_integer('vnc_port_max', port)
203
+ end
204
+ end
205
+ end
206
+ end
@@ -1,3 +1,3 @@
1
1
  module Packer
2
- VERSION = "1.2.0"
2
+ VERSION = "1.3.0"
3
3
  end
@@ -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"]
9
+ spec.authors = ["Ian Chesal", "Fraser Cobb", "Greg Poirier", "Matasano Security"]
10
10
  spec.email = ["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,41 @@
1
+ # Encoding: utf-8
2
+ require 'spec_helper'
3
+
4
+ RSpec.describe Packer::Builder::VMWareISO do
5
+ let(:builder) { Packer::Builder.get_builder(Packer::Builder::VMWARE_ISO) }
6
+
7
+ describe '#initialize' do
8
+ it 'has a type of VMWare ISO' do
9
+ expect(builder.data['type']).to eq(Packer::Builder::VMWARE_ISO)
10
+ end
11
+
12
+ it 'requires iso_checksum' do
13
+ expect { builder.validate }.to raise_error(Packer::DataObject::DataValidationError)
14
+ builder.iso_checksum '88197272b2a442402820fcc788a8cc7a'
15
+ builder.iso_checksum_type "MD5"
16
+ builder.iso_url 'path'
17
+ builder.ssh_username 'user'
18
+ expect { builder.validate }.not_to raise_error
19
+ end
20
+ end
21
+
22
+ describe '#vmx_data' do
23
+ it 'adds a hash of arbitrary data' do
24
+ builder.vmx_data(
25
+ key1: 'value1',
26
+ key2: 'value2'
27
+ )
28
+ expect(builder.data['vmx_data'].keys.length).to eq(2)
29
+ end
30
+ end
31
+
32
+ describe '#vmx_data_post' do
33
+ it 'adds a hash of arbitrary data' do
34
+ builder.vmx_data_post(
35
+ key1: 'value1',
36
+ key2: 'value2'
37
+ )
38
+ expect(builder.data['vmx_data_post'].keys.length).to eq(2)
39
+ end
40
+ end
41
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # Encoding: utf-8
2
2
  require 'packer-config'
3
3
 
4
+ RSpec::Expectations.configuration.warn_about_potential_false_positives = false
4
5
  # RSpec.configure do |c|
5
6
  # c.treat_symbols_as_metadata_keys_with_true_values = true
6
7
  # end
metadata CHANGED
@@ -1,16 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: packer-config
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian Chesal
8
8
  - Fraser Cobb
9
9
  - Greg Poirier
10
+ - Matasano Security
10
11
  autorequire:
11
12
  bindir: bin
12
13
  cert_chain: []
13
- date: 2015-05-15 00:00:00.000000000 Z
14
+ date: 2015-06-16 00:00:00.000000000 Z
14
15
  dependencies:
15
16
  - !ruby/object:Gem::Dependency
16
17
  name: bundler
@@ -140,6 +141,7 @@ files:
140
141
  - lib/packer/builders/docker.rb
141
142
  - lib/packer/builders/null.rb
142
143
  - lib/packer/builders/virtualbox.rb
144
+ - lib/packer/builders/vmware_iso.rb
143
145
  - lib/packer/builders/vmware_vmx.rb
144
146
  - lib/packer/dataobject.rb
145
147
  - lib/packer/envvar.rb
@@ -179,6 +181,7 @@ files:
179
181
  - spec/packer/builders/docker_spec.rb
180
182
  - spec/packer/builders/null_spec.rb
181
183
  - spec/packer/builders/virtualbox_spec.rb
184
+ - spec/packer/builders/vmware_iso_spec.rb
182
185
  - spec/packer/builders/vmware_vmx_spec.rb
183
186
  - spec/packer/dataobject_spec.rb
184
187
  - spec/packer/envvar_spec.rb
@@ -226,7 +229,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
226
229
  version: '0'
227
230
  requirements: []
228
231
  rubyforge_project:
229
- rubygems_version: 2.4.5
232
+ rubygems_version: 2.4.8
230
233
  signing_key:
231
234
  specification_version: 4
232
235
  summary: An object model to build packer.io configurations in Ruby.
@@ -249,6 +252,7 @@ test_files:
249
252
  - spec/packer/builders/docker_spec.rb
250
253
  - spec/packer/builders/null_spec.rb
251
254
  - spec/packer/builders/virtualbox_spec.rb
255
+ - spec/packer/builders/vmware_iso_spec.rb
252
256
  - spec/packer/builders/vmware_vmx_spec.rb
253
257
  - spec/packer/dataobject_spec.rb
254
258
  - spec/packer/envvar_spec.rb