chef-provisioning-virtualbox 0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1a8721d58c710a9142bead68d289efbaad062136
4
+ data.tar.gz: b2b2b05fe1d55edcf4dc14213146ea42b14997b0
5
+ SHA512:
6
+ metadata.gz: 319b0b929441f9936395c90de85b0cddcc799995688851a9bc4a11154f782239b3f73aaf22d532d4099737734f62491a9c99c8a6668c7c25ea189c99b8c7a10d
7
+ data.tar.gz: c417541b3a66a3a3931ca16976d71f1ece7471cf971f43b2aa2ad6f3cf7bbe63c193a618f36e3b511a59e5b2abf15bee02f2318f26de6c7f5d9071e179e1330b
@@ -0,0 +1,2 @@
1
+ require 'chef/provisioning/virtualbox_driver/driver'
2
+ Chef::Provisioning.register_driver_class('virtualbox', Chef::Provisioning::VirtualboxDriver::Driver)
@@ -0,0 +1,3 @@
1
+ require 'chef/provisioning'
2
+ require 'chef/provisioning/virtualbox_driver/driver'
3
+ require 'chef/provisioning/resource/virtualbox_example_resource'
@@ -0,0 +1,55 @@
1
+ require 'chef/provisioning/driver'
2
+ require 'chef/provisioning/virtualbox_driver/version'
3
+
4
+ class Chef
5
+ module Provisioning
6
+ module VirtualboxDriver
7
+ class Driver < Chef::Provisioning::Driver
8
+
9
+ # generated by script, required by API.
10
+ def self.canonicalize_url(driver_url, config)
11
+ [ "vbox:#{driver_url} [vboxmanage]", config ]
12
+ end
13
+
14
+ # generated by script, required by API.
15
+ def self.from_url(driver_url, config)
16
+ Driver.new(driver_url, config)
17
+ end
18
+
19
+ def virtualbox
20
+ Virtualbox.connect('/usr/local/bin/vboxmanage')
21
+ end
22
+ end
23
+
24
+
25
+ def virtualbox.create_server(name, machine_options)
26
+ machine_spec.reference['server_id'] = %x(/usr/local/bin/createvm-q.sh "#{name}" 10)
27
+ end
28
+
29
+ def allocate_machine(action_handler, machine_spec, machine_options)
30
+ if machine_spec.reference
31
+ if !virtualbox.server_exists?(machine_spec.reference['server_id'])
32
+ action_handler.perform_action "Machine #{machine_spec.reference['server_id']} does not exist. Recreating ..." do
33
+ machine_spec.reference = nil
34
+ end
35
+ end
36
+ end
37
+ if !machine_spec.reference
38
+ action_handler.perform_action "Creating server #{machine_spec.name} with options #{machine_options}" do
39
+ private_key = get_private_key('bootstrapkey')
40
+ server_id = virtualbox.create_server(machine_spec.name, machine_options, :bootstrap_ssh_key => private_key)
41
+ machine_spec.reference = {
42
+ 'driver_url' => driver_url,
43
+ 'driver_version' => VirtualboxDriver::VERSION,
44
+ 'server_id' => server_id,
45
+ 'bootstrap_key' => 'bootstrapkey'
46
+ }
47
+ end
48
+ end
49
+ end
50
+
51
+
52
+
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,7 @@
1
+ class Chef
2
+ module Provisioning
3
+ module VirtualboxDriver
4
+ VERSION = '0.1'
5
+ end
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,47 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: chef-provisioning-virtualbox
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Robert Reilly
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-08-19 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Virtualbox Driver for chef provisioning
14
+ email: robertjreilly@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/chef/provisioning/driver_init/virtualbox.rb
20
+ - lib/chef/provisioning/virtualbox_driver.rb
21
+ - lib/chef/provisioning/virtualbox_driver/driver.rb
22
+ - lib/chef/provisioning/virtualbox_driver/version.rb
23
+ homepage: https://github.com/rj-reilly/chef-provisioning-virtualbox
24
+ licenses:
25
+ - MIT
26
+ metadata: {}
27
+ post_install_message:
28
+ rdoc_options: []
29
+ require_paths:
30
+ - lib
31
+ required_ruby_version: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ required_rubygems_version: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ requirements: []
42
+ rubyforge_project:
43
+ rubygems_version: 2.4.6
44
+ signing_key:
45
+ specification_version: 4
46
+ summary: Virtualbox Driver for chef provisioning
47
+ test_files: []