vagrant-cloudstack 1.3.0 → 1.4.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.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +18 -19
  3. data/.ruby-version +1 -1
  4. data/.travis.yml +19 -19
  5. data/CHANGELOG.md +179 -171
  6. data/Docker/.dockerignore +2 -0
  7. data/Docker/Dockerfile +51 -0
  8. data/Docker/Dockerfile.chefdk_0_17 +49 -0
  9. data/Docker/Dockerfile.latest_dependencies +49 -0
  10. data/Docker/README.md +67 -0
  11. data/Docker/vac.ps1 +29 -0
  12. data/Docker/vac.sh +30 -0
  13. data/Gemfile +20 -20
  14. data/LICENSE +8 -8
  15. data/README.md +416 -416
  16. data/Rakefile +106 -99
  17. data/bootstrap.key +27 -0
  18. data/build_rpm.sh +7 -7
  19. data/functional-tests/basic/Vagrantfile.basic_networking +45 -45
  20. data/functional-tests/basic/basic_spec.rb +21 -21
  21. data/functional-tests/networking/Vagrantfile.advanced_networking +119 -102
  22. data/functional-tests/networking/networking_spec.rb +14 -0
  23. data/functional-tests/rsync/Vagrantfile.advanced_networking +39 -56
  24. data/functional-tests/rsync/rsync_spec.rb +9 -9
  25. data/functional-tests/vmlifecycle/Vagrantfile.advanced_networking +66 -82
  26. data/functional-tests/vmlifecycle/vmlifecycle_spec.rb +13 -13
  27. data/lib/vagrant-cloudstack/action/connect_cloudstack.rb +47 -47
  28. data/lib/vagrant-cloudstack/action/is_created.rb +18 -18
  29. data/lib/vagrant-cloudstack/action/is_stopped.rb +18 -18
  30. data/lib/vagrant-cloudstack/action/message_already_created.rb +16 -16
  31. data/lib/vagrant-cloudstack/action/message_not_created.rb +16 -16
  32. data/lib/vagrant-cloudstack/action/message_will_not_destroy.rb +16 -16
  33. data/lib/vagrant-cloudstack/action/read_rdp_info.rb +76 -76
  34. data/lib/vagrant-cloudstack/action/read_ssh_info.rb +104 -87
  35. data/lib/vagrant-cloudstack/action/read_state.rb +38 -38
  36. data/lib/vagrant-cloudstack/action/read_winrm_info.rb +103 -103
  37. data/lib/vagrant-cloudstack/action/run_instance.rb +798 -703
  38. data/lib/vagrant-cloudstack/action/start_instance.rb +81 -81
  39. data/lib/vagrant-cloudstack/action/stop_instance.rb +28 -28
  40. data/lib/vagrant-cloudstack/action/terminate_instance.rb +269 -224
  41. data/lib/vagrant-cloudstack/action/timed_provision.rb +21 -21
  42. data/lib/vagrant-cloudstack/action/wait_for_state.rb +41 -41
  43. data/lib/vagrant-cloudstack/action/warn_networks.rb +19 -19
  44. data/lib/vagrant-cloudstack/action.rb +210 -210
  45. data/lib/vagrant-cloudstack/capabilities/rdp.rb +12 -12
  46. data/lib/vagrant-cloudstack/capabilities/winrm.rb +12 -12
  47. data/lib/vagrant-cloudstack/config.rb +566 -548
  48. data/lib/vagrant-cloudstack/errors.rb +27 -27
  49. data/lib/vagrant-cloudstack/exceptions/exceptions.rb +10 -10
  50. data/lib/vagrant-cloudstack/model/cloudstack_resource.rb +51 -33
  51. data/lib/vagrant-cloudstack/plugin.rb +82 -82
  52. data/lib/vagrant-cloudstack/provider.rb +58 -58
  53. data/lib/vagrant-cloudstack/service/cloudstack_resource_service.rb +64 -58
  54. data/lib/vagrant-cloudstack/util/timer.rb +17 -17
  55. data/lib/vagrant-cloudstack/version.rb +5 -5
  56. data/lib/vagrant-cloudstack.rb +17 -17
  57. data/locales/en.yml +131 -123
  58. data/spec/spec_helper.rb +8 -6
  59. data/spec/vagrant-cloudstack/action/read_ssh_info_spec.rb +80 -0
  60. data/spec/vagrant-cloudstack/config_spec.rb +355 -355
  61. data/spec/vagrant-cloudstack/model/cloudstack_resource_spec.rb +95 -73
  62. data/spec/vagrant-cloudstack/service/cloudstack_resource_service_spec.rb +43 -43
  63. data/spec/vagrant-cloudstack/support/be_a_resource.rb +6 -0
  64. data/vagrant-cloudstack.gemspec +59 -59
  65. data/vagrant-cloudstack.spec +42 -42
  66. metadata +14 -7
  67. data/dummy.box +0 -0
  68. data/example_box/README.md +0 -13
  69. data/example_box/metadata.json +0 -3
  70. data/functional-tests/networking/rsync_spec.rb +0 -12
@@ -0,0 +1,14 @@
1
+ describe 'Networking features' do
2
+ it 'creates firewall and portwarding rules for both Virtual Router and VPC' do
3
+ expect(`vagrant up`).to include(
4
+ 'VRbox1: Machine is booted and ready for use!',
5
+ 'VRbox2: Machine is booted and ready for use!',
6
+ 'VPCbox1: Machine is booted and ready for use!',
7
+ 'VPCbox2: Machine is booted and ready for use!'
8
+ )
9
+ expect($?.exitstatus).to eq(0)
10
+
11
+ expect(`vagrant destroy --force`).to include('Terminating the instance...')
12
+ expect($?.exitstatus).to eq(0)
13
+ end
14
+ end
@@ -1,56 +1,39 @@
1
- # -*- mode: ruby -*-
2
- # vi: set ft=ruby :
3
-
4
- # Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
5
- VAGRANTFILE_API_VERSION = '2'
6
-
7
- Vagrant.require_version '>= 1.5.0'
8
-
9
- Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
10
- config.vm.box = ENV['LINUX_TEMPLATE_NAME']
11
-
12
- config.vm.synced_folder ".", "/vagrant", type: "rsync",
13
- rsync__exclude: [".git/", "vendor"]
14
-
15
- config.vm.provider :cloudstack do |cloudstack, override|
16
- cloudstack.display_name = ENV['TEST_NAME']
17
-
18
- cloudstack.host = ENV['CLOUDSTACK_HOST']
19
- cloudstack.path = '/client/api'
20
- cloudstack.port = '443'
21
- cloudstack.scheme = 'https'
22
- cloudstack.api_key = ENV['CLOUDSTACK_API_KEY']
23
- cloudstack.secret_key = ENV['CLOUDSTACK_SECRET_KEY']
24
-
25
- public_source_nat_ip = ENV['PUBLIC_SOURCE_NAT_IP']
26
- public_ssh_port = ENV['PUBLIC_SSH_PORT']
27
- open_firewall = ENV['OPEN_FIREWALL'] == "true"
28
-
29
- cloudstack.zone_name = ENV['ZONE_NAME']
30
- cloudstack.network_name = ENV['NETWORK_NAME']
31
- cloudstack.service_offering_name = ENV['SERVICE_OFFERING_NAME']
32
-
33
- cloudstack.pf_ip_address = public_source_nat_ip
34
- cloudstack.pf_public_port = public_ssh_port
35
- cloudstack.pf_private_port = ENV['PRIVATE_SSH_PORT']
36
- cloudstack.pf_open_firewall = open_firewall
37
-
38
- unless open_firewall
39
- cloudstack.firewall_rules = [
40
- {
41
- ipaddress: public_source_nat_ip,
42
- cidrlist: ENV['SOURCE_CIDR'],
43
- protocol: 'tcp',
44
- startport: public_ssh_port.to_i,
45
- endport: public_ssh_port.to_i
46
- }
47
- ]
48
- end
49
-
50
- unless ENV['SSH_KEY'].nil?
51
- cloudstack.ssh_key = ENV['SSH_KEY']
52
- cloudstack.ssh_user = ENV['SSH_USER']
53
- end
54
- end
55
-
56
- end
1
+ # -*- mode: ruby -*-
2
+ # vi: set ft=ruby :
3
+
4
+ # Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
5
+ VAGRANTFILE_API_VERSION = '2'
6
+
7
+ Vagrant.require_version '>= 1.5.0'
8
+
9
+ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
10
+ config.vm.box = ENV['LINUX_TEMPLATE_NAME']
11
+
12
+ config.vm.synced_folder ".", "/vagrant", type: "rsync",
13
+ rsync__exclude: [".git/", "vendor"]
14
+
15
+ config.vm.provider :cloudstack do |cloudstack, override|
16
+ cloudstack.display_name = ENV['TEST_NAME']
17
+
18
+ cloudstack.host = ENV['CLOUDSTACK_HOST']
19
+ cloudstack.path = '/client/api'
20
+ cloudstack.port = '443'
21
+ cloudstack.scheme = 'https'
22
+ cloudstack.api_key = ENV['CLOUDSTACK_API_KEY']
23
+ cloudstack.secret_key = ENV['CLOUDSTACK_SECRET_KEY']
24
+
25
+ cloudstack.zone_name = ENV['ZONE_NAME']
26
+ cloudstack.network_name = ENV['NETWORK_NAME']
27
+ cloudstack.service_offering_name = ENV['SERVICE_OFFERING_NAME']
28
+
29
+ cloudstack.pf_ip_address = ENV['PUBLIC_SOURCE_NAT_IP']
30
+ cloudstack.pf_trusted_networks = ENV['SOURCE_CIDR']
31
+ cloudstack.pf_open_firewall = false
32
+
33
+ unless ENV['SSH_KEY'].nil?
34
+ cloudstack.ssh_key = ENV['SSH_KEY']
35
+ cloudstack.ssh_user = ENV['SSH_USER']
36
+ end
37
+ end
38
+
39
+ end
@@ -1,9 +1,9 @@
1
- describe 'VM RSync' do
2
- it 'does rsync to the VM' do
3
- expect(`vagrant up`).to include('Machine is booted and ready for use!')
4
- expect($?.exitstatus).to eq(0)
5
- expect(`vagrant ssh -c "ls /vagrant; echo;"`).to include('Vagrantfile.advanced_networking')
6
- expect(`vagrant destroy --force`).to include('Terminating the instance...')
7
- expect($?.exitstatus).to eq(0)
8
- end
9
- end
1
+ describe 'VM RSync' do
2
+ it 'does rsync to the VM' do
3
+ expect(`vagrant up`).to include('Machine is booted and ready for use!')
4
+ expect($?.exitstatus).to eq(0)
5
+ expect(`vagrant ssh -c "ls /vagrant; echo;"`).to include('Vagrantfile.advanced_networking')
6
+ expect(`vagrant destroy --force`).to include('Terminating the instance...')
7
+ expect($?.exitstatus).to eq(0)
8
+ end
9
+ end
@@ -1,82 +1,66 @@
1
- # -*- mode: ruby -*-
2
- # vi: set ft=ruby :
3
-
4
- # Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
5
- VAGRANTFILE_API_VERSION = '2'
6
-
7
- Vagrant.require_version '>= 1.5.0'
8
-
9
- machines = {
10
- 'linux-box' => {
11
- 'public_port' => ENV['PUBLIC_SSH_PORT'],
12
- 'private_port' => ENV['PRIVATE_SSH_PORT'],
13
- 'template' => ENV['LINUX_TEMPLATE_NAME'],
14
- 'communicator' => 'ssh',
15
- 'rsync_disabled' => true
16
- },
17
- 'windows-box' => {
18
- 'public_port' => ENV['PUBLIC_WINRM_PORT'],
19
- 'private_port' => ENV['PRIVATE_WINRM_PORT'],
20
- 'template' => ENV['WINDOWS_TEMPLATE_NAME'],
21
- 'communicator' => 'winrm',
22
- 'rsync_disabled' => true
23
- }
24
- }
25
-
26
-
27
- Vagrant.configure(VAGRANTFILE_API_VERSION) do |global_config|
28
- machines.each_pair do |name, options|
29
- global_config.vm.define name do |config|
30
- config.vm.box = options['template']
31
-
32
- config.vm.communicator = options['communicator']
33
- config.vm.synced_folder ".", "/vagrant", type: "rsync",
34
- rsync__exclude: [".git/", "vendor"], disabled: options['rsync_disabled']
35
- config.vm.provider :cloudstack do |cloudstack, override|
36
-
37
- cloudstack.display_name = ENV['TEST_NAME']
38
-
39
- cloudstack.host = ENV['CLOUDSTACK_HOST']
40
- cloudstack.path = '/client/api'
41
- cloudstack.port = '443'
42
- cloudstack.scheme = 'https'
43
- cloudstack.api_key = ENV['CLOUDSTACK_API_KEY']
44
- cloudstack.secret_key = ENV['CLOUDSTACK_SECRET_KEY']
45
-
46
- public_source_nat_ip = ENV['PUBLIC_SOURCE_NAT_IP']
47
- open_firewall = ENV['OPEN_FIREWALL'] == "true"
48
-
49
- cloudstack.zone_name = ENV['ZONE_NAME']
50
- cloudstack.network_name = ENV['NETWORK_NAME']
51
- cloudstack.service_offering_name = ENV['SERVICE_OFFERING_NAME']
52
-
53
- cloudstack.pf_ip_address = public_source_nat_ip
54
-
55
- cloudstack.pf_public_port = options['public_port']
56
- cloudstack.pf_private_port = options['private_port']
57
- cloudstack.pf_open_firewall = open_firewall
58
-
59
- unless open_firewall
60
- cloudstack.firewall_rules = [
61
- {
62
- ipaddress: public_source_nat_ip,
63
- cidrlist: ENV['SOURCE_CIDR'],
64
- protocol: 'tcp',
65
- startport: options['public_port'].to_i,
66
- endport: options['public_port'].to_i
67
- }
68
- ]
69
- end
70
-
71
- unless ENV['SSH_KEY'].nil?
72
- cloudstack.ssh_key = ENV['SSH_KEY']
73
- cloudstack.ssh_user = ENV['SSH_USER']
74
- end
75
-
76
- unless ENV['WINDOWS_USER'].nil?
77
- cloudstack.vm_user = ENV['WINDOWS_USER']
78
- end
79
- end
80
- end
81
- end
82
- end
1
+ # -*- mode: ruby -*-
2
+ # vi: set ft=ruby :
3
+
4
+ # Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
5
+ VAGRANTFILE_API_VERSION = '2'
6
+
7
+ Vagrant.require_version '>= 1.5.0'
8
+
9
+ machines = {
10
+ 'linux-box' => {
11
+ 'template' => ENV['LINUX_TEMPLATE_NAME'],
12
+ 'communicator' => 'ssh',
13
+ 'rsync_disabled' => true
14
+ },
15
+ 'windows-box' => {
16
+ 'template' => ENV['WINDOWS_TEMPLATE_NAME'],
17
+ 'communicator' => 'winrm',
18
+ 'rsync_disabled' => true
19
+ }
20
+ }
21
+
22
+
23
+ Vagrant.configure(VAGRANTFILE_API_VERSION) do |global_config|
24
+ machines.each_pair do |name, options|
25
+ global_config.vm.define name do |config|
26
+ config.vm.box = options['template']
27
+
28
+ config.vm.communicator = options['communicator']
29
+ config.vm.synced_folder ".", "/vagrant", type: "rsync",
30
+ rsync__exclude: [".git/", "vendor"], disabled: options['rsync_disabled']
31
+ config.vm.provider :cloudstack do |cloudstack, override|
32
+
33
+ cloudstack.display_name = ENV['TEST_NAME']
34
+
35
+ cloudstack.host = ENV['CLOUDSTACK_HOST']
36
+ cloudstack.path = '/client/api'
37
+ cloudstack.port = '443'
38
+ cloudstack.scheme = 'https'
39
+ cloudstack.api_key = ENV['CLOUDSTACK_API_KEY']
40
+ cloudstack.secret_key = ENV['CLOUDSTACK_SECRET_KEY']
41
+ cloudstack.expunge_on_destroy = ENV['EXPUNGE_ON_DESTROY']=="true"
42
+
43
+ cloudstack.zone_name = ENV['ZONE_NAME']
44
+ cloudstack.network_name = ENV['NETWORK_NAME']
45
+ cloudstack.service_offering_name = ENV['SERVICE_OFFERING_NAME']
46
+ cloudstack.disk_offering_name = ENV['DISK_OFFERING_NAME']
47
+
48
+ cloudstack.pf_ip_address = ENV['PUBLIC_SOURCE_NAT_IP']
49
+
50
+ cloudstack.pf_public_port = options['public_port']
51
+ cloudstack.pf_private_port = options['private_port']
52
+ cloudstack.pf_trusted_networks = ENV['SOURCE_CIDR']
53
+ cloudstack.pf_open_firewall = false
54
+
55
+ unless ENV['SSH_KEY'].nil?
56
+ cloudstack.ssh_key = ENV['SSH_KEY']
57
+ cloudstack.ssh_user = ENV['SSH_USER']
58
+ end
59
+
60
+ unless ENV['WINDOWS_USER'].nil?
61
+ cloudstack.vm_user = ENV['WINDOWS_USER']
62
+ end
63
+ end
64
+ end
65
+ end
66
+ end
@@ -1,13 +1,13 @@
1
- describe 'VM Life Cycle' do
2
- it 'starts Linux and Windows VM' do
3
- expect(`vagrant up`).to include(
4
- 'linux-box: Machine is booted and ready for use!',
5
- 'windows-box: Machine is booted and ready for use!'
6
- )
7
- expect($?.exitstatus).to eq(0)
8
- end
9
- it 'destroys Linux and Windows VM' do
10
- expect(`vagrant destroy --force`).to include('Terminating the instance...')
11
- expect($?.exitstatus).to eq(0)
12
- end
13
- end
1
+ describe 'VM Life Cycle' do
2
+ it 'starts Linux and Windows VM' do
3
+ expect(`vagrant up`).to include(
4
+ 'linux-box: Machine is booted and ready for use!',
5
+ 'windows-box: Machine is booted and ready for use!'
6
+ )
7
+ expect($?.exitstatus).to eq(0)
8
+ end
9
+ it 'destroys Linux and Windows VM' do
10
+ expect(`vagrant destroy --force`).to include('Done removing resources')
11
+ expect($?.exitstatus).to eq(0)
12
+ end
13
+ end
@@ -1,47 +1,47 @@
1
- require 'fog'
2
- require 'log4r'
3
-
4
- module VagrantPlugins
5
- module Cloudstack
6
- module Action
7
- # This action connects to Cloudstack, verifies credentials work, and
8
- # puts the Cloudstack connection object into the
9
- # `:cloudstack_compute` key in the environment.
10
- class ConnectCloudstack
11
- def initialize(app, env)
12
- @app = app
13
- @logger = Log4r::Logger.new('vagrant_cloudstack::action::connect_cloudstack')
14
- end
15
-
16
- def call(env)
17
- # Get the domain we're going to booting up in
18
- domain = env[:machine].provider_config.domain_id
19
-
20
- # Get the configs
21
- domain_config = env[:machine].provider_config.get_domain_config(domain)
22
-
23
- # Build the fog config
24
- fog_config = {
25
- :provider => :cloudstack
26
- #:domain => domain_config
27
- }
28
-
29
- if domain_config.api_key
30
- fog_config[:cloudstack_api_key] = domain_config.api_key
31
- fog_config[:cloudstack_secret_access_key] = domain_config.secret_key
32
- end
33
-
34
- fog_config[:cloudstack_host] = domain_config.host if domain_config.host
35
- fog_config[:cloudstack_path] = domain_config.path if domain_config.path
36
- fog_config[:cloudstack_port] = domain_config.port if domain_config.port
37
- fog_config[:cloudstack_scheme] = domain_config.scheme if domain_config.scheme
38
-
39
- @logger.info('Connecting to Cloudstack...')
40
- env[:cloudstack_compute] = Fog::Compute.new(fog_config)
41
-
42
- @app.call(env)
43
- end
44
- end
45
- end
46
- end
47
- end
1
+ require 'fog'
2
+ require 'log4r'
3
+
4
+ module VagrantPlugins
5
+ module Cloudstack
6
+ module Action
7
+ # This action connects to Cloudstack, verifies credentials work, and
8
+ # puts the Cloudstack connection object into the
9
+ # `:cloudstack_compute` key in the environment.
10
+ class ConnectCloudstack
11
+ def initialize(app, env)
12
+ @app = app
13
+ @logger = Log4r::Logger.new('vagrant_cloudstack::action::connect_cloudstack')
14
+ end
15
+
16
+ def call(env)
17
+ # Get the domain we're going to booting up in
18
+ domain = env[:machine].provider_config.domain_id
19
+
20
+ # Get the configs
21
+ domain_config = env[:machine].provider_config.get_domain_config(domain)
22
+
23
+ # Build the fog config
24
+ fog_config = {
25
+ :provider => :cloudstack
26
+ #:domain => domain_config
27
+ }
28
+
29
+ if domain_config.api_key
30
+ fog_config[:cloudstack_api_key] = domain_config.api_key
31
+ fog_config[:cloudstack_secret_access_key] = domain_config.secret_key
32
+ end
33
+
34
+ fog_config[:cloudstack_host] = domain_config.host if domain_config.host
35
+ fog_config[:cloudstack_path] = domain_config.path if domain_config.path
36
+ fog_config[:cloudstack_port] = domain_config.port if domain_config.port
37
+ fog_config[:cloudstack_scheme] = domain_config.scheme if domain_config.scheme
38
+
39
+ @logger.info('Connecting to Cloudstack...')
40
+ env[:cloudstack_compute] = Fog::Compute.new(fog_config)
41
+
42
+ @app.call(env)
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -1,18 +1,18 @@
1
- module VagrantPlugins
2
- module Cloudstack
3
- module Action
4
- # This can be used with "Call" built-in to check if the machine
5
- # is created and branch in the middleware.
6
- class IsCreated
7
- def initialize(app, env)
8
- @app = app
9
- end
10
-
11
- def call(env)
12
- env[:result] = env[:machine].state.id != :not_created
13
- @app.call(env)
14
- end
15
- end
16
- end
17
- end
18
- end
1
+ module VagrantPlugins
2
+ module Cloudstack
3
+ module Action
4
+ # This can be used with "Call" built-in to check if the machine
5
+ # is created and branch in the middleware.
6
+ class IsCreated
7
+ def initialize(app, env)
8
+ @app = app
9
+ end
10
+
11
+ def call(env)
12
+ env[:result] = env[:machine].state.id != :not_created
13
+ @app.call(env)
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -1,18 +1,18 @@
1
- module VagrantPlugins
2
- module Cloudstack
3
- module Action
4
- # This can be used with "Call" built-in to check if the machine
5
- # is stopped and branch in the middleware.
6
- class IsStopped
7
- def initialize(app, env)
8
- @app = app
9
- end
10
-
11
- def call(env)
12
- env[:result] = env[:machine].state.id == :stopped
13
- @app.call(env)
14
- end
15
- end
16
- end
17
- end
18
- end
1
+ module VagrantPlugins
2
+ module Cloudstack
3
+ module Action
4
+ # This can be used with "Call" built-in to check if the machine
5
+ # is stopped and branch in the middleware.
6
+ class IsStopped
7
+ def initialize(app, env)
8
+ @app = app
9
+ end
10
+
11
+ def call(env)
12
+ env[:result] = env[:machine].state.id == :stopped
13
+ @app.call(env)
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end