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
data/Rakefile CHANGED
@@ -1,99 +1,106 @@
1
- require 'rubygems'
2
- require 'bundler/setup'
3
- require 'rspec/core/rake_task'
4
-
5
- RSpec::Core::RakeTask.new(:functionaltest) do |t|
6
- t.pattern = "*_spec.rb"
7
- t.rspec_opts = "-fd"
8
- end
9
-
10
- # Immediately sync all stdout so that tools like buildbot can
11
- # immediately load in the output.
12
- $stdout.sync = true
13
- $stderr.sync = true
14
-
15
- # Change to the directory of this file.
16
- Dir.chdir(File.expand_path("../", __FILE__))
17
-
18
- # This installs the tasks that help with gem creation and
19
- # publishing.
20
- Bundler::GemHelper.install_tasks
21
-
22
- # Install the `spec` task so that we can run tests.
23
- RSpec::Core::RakeTask.new
24
-
25
- # Default task is to run the unit tests
26
- task :default => "spec"
27
-
28
-
29
- namespace :functional_tests do
30
-
31
- # Name must match folder beneath functional-tests/
32
- functional_test_names = %w(vmlifecycle networking rsync)
33
- separate_test_names = %w(basic)
34
-
35
- desc "Check for required enviroment variables for functional testing"
36
- task :check_environment do
37
- [
38
- 'CLOUDSTACK_API_KEY',
39
- 'CLOUDSTACK_SECRET_KEY',
40
- 'CLOUDSTACK_HOST',
41
- 'PUBLIC_SOURCE_NAT_IP',
42
- 'NETWORK_NAME',
43
- 'SERVICE_OFFERING_NAME',
44
- 'ZONE_NAME',
45
- 'PUBLIC_WINRM_PORT',
46
- 'PRIVATE_WINRM_PORT',
47
- 'PUBLIC_SSH_PORT',
48
- 'PRIVATE_SSH_PORT',
49
- 'SOURCE_CIDR',
50
- 'LINUX_TEMPLATE_NAME',
51
- 'WINDOWS_TEMPLATE_NAME'
52
- ].each do |var|
53
- if ENV[var].nil?
54
- puts "#{var} not set. Quitting"
55
- exit 1
56
- end
57
- end
58
- end
59
-
60
- desc "Run all functional tests"
61
- task :all => [ :check_environment ] do
62
- functional_test_names.each do |test_name|
63
- Rake::Task["functional_tests:#{test_name}"].invoke
64
- end
65
- end
66
-
67
-
68
- functional_test_names.each do |test_dir_name|
69
- desc "Run functional test: #{test_dir_name}"
70
- task test_dir_name => [ :check_environment ] do
71
- Dir.chdir("#{File.expand_path('../', __FILE__)}/functional-tests/#{test_dir_name}/")
72
- Dir.glob("Vagrantfile*", File::FNM_CASEFOLD).each do |vagrant_file|
73
-
74
- ENV['TEST_NAME'] = "vagrant_cloudstack_functional_test-#{test_dir_name}"
75
- ENV['VAGRANT_VAGRANTFILE'] = vagrant_file
76
- puts "Running RSpec tests in folder : #{test_dir_name}"
77
- puts "Using Vagrant file : #{ENV['VAGRANT_VAGRANTFILE']}"
78
- Rake::Task[:functionaltest].execute
79
- end
80
- end
81
- end
82
-
83
- separate_test_names.each do |test_dir_name|
84
- desc "Run functional test: #{test_dir_name}"
85
- task test_dir_name => [ :check_environment ] do
86
- Dir.chdir("#{File.expand_path('../', __FILE__)}/functional-tests/#{test_dir_name}/")
87
- Dir.glob("Vagrantfile*", File::FNM_CASEFOLD).each do |vagrant_file|
88
-
89
- ENV['TEST_NAME'] = "vagrant_cloudstack_functional_test-#{test_dir_name}"
90
- ENV['VAGRANT_VAGRANTFILE'] = vagrant_file
91
- puts "Running RSpec tests in folder : #{test_dir_name}"
92
- puts "Using Vagrant file : #{ENV['VAGRANT_VAGRANTFILE']}"
93
- Rake::Task[:functionaltest].execute
94
- end
95
- end
96
- end
97
-
98
-
99
- end
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+ require 'rspec/core/rake_task'
4
+
5
+ RSpec::Core::RakeTask.new(:functionaltest) do |t|
6
+ t.pattern = "*_spec.rb"
7
+ t.rspec_opts = "-fd"
8
+ end
9
+
10
+ # Immediately sync all stdout so that tools like buildbot can
11
+ # immediately load in the output.
12
+ $stdout.sync = true
13
+ $stderr.sync = true
14
+
15
+ # Change to the directory of this file.
16
+ Dir.chdir(File.expand_path("../", __FILE__))
17
+
18
+ # This installs the tasks that help with gem creation and
19
+ # publishing.
20
+ Bundler::GemHelper.install_tasks
21
+
22
+ # Install the `spec` task so that we can run tests.
23
+ RSpec::Core::RakeTask.new
24
+
25
+ # Default task is to run the unit tests
26
+ task :default => "spec"
27
+
28
+
29
+ namespace :functional_tests do
30
+
31
+ # Name must match folder beneath functional-tests/
32
+ functional_test_names = %w(vmlifecycle networking rsync)
33
+ separate_test_names = %w(basic)
34
+
35
+ desc "Check for required enviroment variables for functional testing"
36
+ task :check_environment do
37
+ missing_env=false
38
+ [
39
+ 'CLOUDSTACK_API_KEY',
40
+ 'CLOUDSTACK_SECRET_KEY',
41
+ 'CLOUDSTACK_HOST',
42
+ 'PUBLIC_SOURCE_NAT_IP',
43
+ 'NETWORK_NAME',
44
+ 'SERVICE_OFFERING_NAME',
45
+ 'ZONE_NAME',
46
+ 'PUBLIC_WINRM_PORT',
47
+ 'PRIVATE_WINRM_PORT',
48
+ 'PUBLIC_SSH_PORT',
49
+ 'PRIVATE_SSH_PORT',
50
+ 'SOURCE_CIDR',
51
+ 'LINUX_TEMPLATE_NAME',
52
+ 'WINDOWS_TEMPLATE_NAME',
53
+ 'VPC_PUBLIC_IP',
54
+ 'VPC_TIER_NAME',
55
+ 'VR_PUBLIC_IP',
56
+ 'VR_NETWORK_NAME',
57
+ 'DISK_OFFERING_NAME'
58
+ ].each do |var|
59
+ if ENV[var].nil?
60
+ puts "Please set environment variable #{var}."
61
+ missing_env=true
62
+ end
63
+ end
64
+ exit 1 if missing_env
65
+ end
66
+
67
+ desc "Run all functional tests"
68
+ task :all => [ :check_environment ] do
69
+ functional_test_names.each do |test_name|
70
+ Rake::Task["functional_tests:#{test_name}"].invoke
71
+ end
72
+ end
73
+
74
+
75
+ functional_test_names.each do |test_dir_name|
76
+ desc "Run functional test: #{test_dir_name}"
77
+ task test_dir_name => [ :check_environment ] do
78
+ Dir.chdir("#{File.expand_path('../', __FILE__)}/functional-tests/#{test_dir_name}/")
79
+ Dir.glob("Vagrantfile*", File::FNM_CASEFOLD).each do |vagrant_file|
80
+
81
+ ENV['TEST_NAME'] = "vagrant_cloudstack_functional_test-#{test_dir_name}"
82
+ ENV['VAGRANT_VAGRANTFILE'] = vagrant_file
83
+ puts "Running RSpec tests in folder : #{test_dir_name}"
84
+ puts "Using Vagrant file : #{ENV['VAGRANT_VAGRANTFILE']}"
85
+ Rake::Task[:functionaltest].execute
86
+ end
87
+ end
88
+ end
89
+
90
+ separate_test_names.each do |test_dir_name|
91
+ desc "Run functional test: #{test_dir_name}"
92
+ task test_dir_name => [ :check_environment ] do
93
+ Dir.chdir("#{File.expand_path('../', __FILE__)}/functional-tests/#{test_dir_name}/")
94
+ Dir.glob("Vagrantfile*", File::FNM_CASEFOLD).each do |vagrant_file|
95
+
96
+ ENV['TEST_NAME'] = "vagrant_cloudstack_functional_test-#{test_dir_name}"
97
+ ENV['VAGRANT_VAGRANTFILE'] = vagrant_file
98
+ puts "Running RSpec tests in folder : #{test_dir_name}"
99
+ puts "Using Vagrant file : #{ENV['VAGRANT_VAGRANTFILE']}"
100
+ Rake::Task[:functionaltest].execute
101
+ end
102
+ end
103
+ end
104
+
105
+
106
+ end
data/bootstrap.key ADDED
@@ -0,0 +1,27 @@
1
+ -----BEGIN RSA PRIVATE KEY-----
2
+ MIIEowIBAAKCAQEAyxoANMip0RrJ9YeBHrw9J6zEcHtY06I930mV5Jj0qQh4xY+x
3
+ t2ra2GZFGYBHDqp8akIgm5wXsBUXX1KoP2DsURyKTeo4UrXG+KAaVziTKqbPxGHO
4
+ 1HxZ1xkEifW1+UlC9Ghu2klI2MyedgpVwsEvT6JYyu7UJeklE3DrWkQHOFN7J/IL
5
+ XtuP7PvSYVC+5TUgyCC1n0KJLixjFgCPZl+5xpY3oM5gU9jVWOXGwUPt3d2/RgnF
6
+ 0XLeGlm0TbibVX+Po5OEmC3c8cccBg5JIOVUZ8Yq6EuejjfFYkMET5B2MLTDdrl0
7
+ pzv9EIVsGuQ5jQCzrMkiSz9ExTU6OPKJZWTRUwIBIwKCAQEAnK2oYzu2M5hSp3cp
8
+ F7XIxtW8HEHlcA9xjv5AboSfexUp9316d4zx92TWOD5is4rVAYN4PYcK9YydAGRV
9
+ 57/MPpJcEDhXVb9tmzmt64NqNth0ZEtzqztbP4hT9WXG5OC+n0k/knMMT3lHCppC
10
+ KIZmU1/7Wrg9QdEcmfgGA84UMsKstkmyZQvNoxEDnLV3u0e6dLv1lrSnn2wuJl6u
11
+ eEcGq119wW/xKV5wgjgE7G8SDQ4DwFLaRUNA3GEeIYdXU1v5AI+5HjR+/VCa89GM
12
+ qb8mfUZjf1sxYW2s8kxxusAgMq/H2SRLekg8TwlzF3xHlPTxxOVnmV9/zQ3e9Fik
13
+ RTNumwKBgQD94SNYdhX7m2qg+GNHKn00qSMQJOEYCKxmac3fwFdqQxibGXiFDrrL
14
+ w/n44QoRwP2v5/byxChYVD6ART0SLuclKXMsOH35ht2W6DJltALFZp8upVk1ZSah
15
+ zfotISXcYxaCnIugG7QfQdyeFSA3uN9vH7FEze0v9DTPXTIrPJvqWwKBgQDMzEk9
16
+ b0SARUu68x6tHUf6azlnH1FVfMRYjWwZVfgXdfF0xXjlBgJuQXPHflSL0xBDZMPe
17
+ CNbl19Yy5oA94HaGguFL9il3sMNm60eCaurFaD2Ew8gMtECYuQIwyo3+SYr7a12Y
18
+ oSo6S8J7Myxiqr3SQgFzo4pvJgFmSaxG2I+2aQKBgQCuFrkmt1+H9YryCWil0/4V
19
+ e0s+RSyixB5yHKptizSgowmO7OTthnF1yDZhhF6tFp9UDMaX1vcX/0DM/EciaU4K
20
+ 2pgeUp+GiF1uyxs+bM6zPw4RW3BfIMoIjT3VzZZN+s2bZAf4wookD+e820lKx+mr
21
+ SO6VlIVithWVgbwAZBMkWwKBgEY3aZFn+jqbamv7lX0unFXbnqcDbFfTAX1yUPK+
22
+ Y7BFsd7knnpoddyouftBQY8GiTuthPurQl1ukpUb1DJ42C4ePp2ze+6Fv1Z8jYvM
23
+ 4sdW8IVKcHliX0pOD2EvgSP79SMAPVjmzKZF3Ed/Qmr4thwz4z2XKCYbqLVbFn6w
24
+ pk0rAoGBAJWNcH9WB5itvwRrfn0G+Q1reH/8rc59QkU+XfDnJadBcvDc41bGiUM1
25
+ ynlE1/1emU3L2syZrT7Wuob1wNzMfeHLIASuIjYt337bHfWsT8qI4BekhZf/PoNx
26
+ eYhpBXmesWJWksYOuMt+/cFus+59Rm6cFrLrp1bgzzqDPNGaslyD
27
+ -----END RSA PRIVATE KEY-----
data/build_rpm.sh CHANGED
@@ -1,7 +1,7 @@
1
- #!/bin/bash
2
- VERSION=1.3.0
3
- mkdir -p /tmp/vagrant-cloudstack-build_rpm.$$/vagrant-cloudstack-$VERSION
4
- cp -r . /tmp/vagrant-cloudstack-build_rpm.$$/vagrant-cloudstack-$VERSION/
5
- tar -C /tmp/vagrant-cloudstack-build_rpm.$$/ -czf ~/rpmbuild/SOURCES/vagrant-cloudstack-$VERSION.tar.gz vagrant-cloudstack-$VERSION
6
- rpmbuild --define "gemver $VERSION" -bb vagrant-cloudstack.spec
7
- rm -rf /tmp/vagrant-cloudstack-build_rpm.$$
1
+ #!/bin/bash
2
+ VERSION=1.4.0
3
+ mkdir -p /tmp/vagrant-cloudstack-build_rpm.$$/vagrant-cloudstack-$VERSION
4
+ cp -r . /tmp/vagrant-cloudstack-build_rpm.$$/vagrant-cloudstack-$VERSION/
5
+ tar -C /tmp/vagrant-cloudstack-build_rpm.$$/ -czf ~/rpmbuild/SOURCES/vagrant-cloudstack-$VERSION.tar.gz vagrant-cloudstack-$VERSION
6
+ rpmbuild --define "gemver $VERSION" -bb vagrant-cloudstack.spec
7
+ rm -rf /tmp/vagrant-cloudstack-build_rpm.$$
@@ -1,45 +1,45 @@
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
-
11
- config.vm.synced_folder ".", "/vagrant", disabled: true, type: 'rsync' # if Vagrant::Util::Platform.windows?
12
- config.vm.box = ENV['LINUX_TEMPLATE_NAME']
13
-
14
- config.vm.provider :cloudstack do |cloudstack, override|
15
- cloudstack.display_name = ENV['TEST_NAME']
16
-
17
- cloudstack.host = ENV['CLOUDSTACK_HOST']
18
- cloudstack.path = '/client/api'
19
- cloudstack.port = '8080'
20
- cloudstack.scheme = 'http'
21
- cloudstack.api_key = ENV['CLOUDSTACK_API_KEY']
22
- cloudstack.secret_key = ENV['CLOUDSTACK_SECRET_KEY']
23
-
24
- cloudstack.zone_name = ENV['ZONE_NAME']
25
- cloudstack.network_name = ENV['NETWORK_NAME']
26
- cloudstack.service_offering_name = ENV['SERVICE_OFFERING_NAME']
27
-
28
-
29
- cloudstack.expunge_on_destroy = ENV['CS_EXPUNGE'] == "true"
30
- cloudstack.network_type = "Ignored"
31
- cloudstack.ssh_key = ENV['SSH_KEY'] unless ENV['SSH_KEY'].nil?
32
- cloudstack.ssh_user = ENV['SSH_USER'] unless ENV['SSH_USER'].nil?
33
-
34
- cloudstack.security_groups = [{
35
- :name => "Awesome_security_group1",
36
- :description => "Created from the Vagrantfile",
37
- :rules => [{:type => "ingress", :protocol => "TCP", :startport => 23, :endport => 23, :cidrlist => "0.0.0.0/0"}]
38
- },
39
- {
40
- :name => "Awesome_security_group2",
41
- :description => "Created from the Vagrantfile",
42
- :rules => [{:type => "ingress", :protocol => "TCP", :startport => 22, :endport => 22, :cidrlist => "0.0.0.0/0"}]
43
- }]
44
- end
45
- 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
+
11
+ config.vm.synced_folder ".", "/vagrant", disabled: true, type: 'rsync' # if Vagrant::Util::Platform.windows?
12
+ config.vm.box = ENV['LINUX_TEMPLATE_NAME']
13
+
14
+ config.vm.provider :cloudstack do |cloudstack, override|
15
+ cloudstack.display_name = ENV['TEST_NAME']
16
+
17
+ cloudstack.host = ENV['CLOUDSTACK_HOST']
18
+ cloudstack.path = '/client/api'
19
+ cloudstack.port = '8080'
20
+ cloudstack.scheme = 'http'
21
+ cloudstack.api_key = ENV['CLOUDSTACK_API_KEY']
22
+ cloudstack.secret_key = ENV['CLOUDSTACK_SECRET_KEY']
23
+
24
+ cloudstack.zone_name = ENV['ZONE_NAME']
25
+ cloudstack.network_name = ENV['NETWORK_NAME']
26
+ cloudstack.service_offering_name = ENV['SERVICE_OFFERING_NAME']
27
+
28
+
29
+ cloudstack.expunge_on_destroy = ENV['CS_EXPUNGE'] == "true"
30
+ cloudstack.network_type = "Ignored"
31
+ cloudstack.ssh_key = ENV['SSH_KEY'] unless ENV['SSH_KEY'].nil?
32
+ cloudstack.ssh_user = ENV['SSH_USER'] unless ENV['SSH_USER'].nil?
33
+
34
+ cloudstack.security_groups = [{
35
+ :name => "Awesome_security_group1",
36
+ :description => "Created from the Vagrantfile",
37
+ :rules => [{:type => "ingress", :protocol => "TCP", :startport => 23, :endport => 23, :cidrlist => "0.0.0.0/0"}]
38
+ },
39
+ {
40
+ :name => "Awesome_security_group2",
41
+ :description => "Created from the Vagrantfile",
42
+ :rules => [{:type => "ingress", :protocol => "TCP", :startport => 22, :endport => 22, :cidrlist => "0.0.0.0/0"}]
43
+ }]
44
+ end
45
+ end
@@ -1,21 +1,21 @@
1
- describe 'Basic Network' do
2
- it 'starts Linux VM with security groups' do
3
- expect(`vagrant up`).to include(
4
- 'Security Group Awesome_security_group1 created with ID',
5
- 'Security Group Awesome_security_group2 created with ID',
6
- 'Security Group: Awesome_security_group1 (',
7
- 'Security Group: Awesome_security_group2 (',
8
- 'Network name or id will be ignored',
9
- 'Machine is booted and ready for use!'
10
- )
11
- expect($?.exitstatus).to eq(0)
12
- end
13
- it 'destroys Linux with security groups' do
14
- expect(`vagrant destroy --force`).to include(
15
- 'Terminating the instance...',
16
- 'Deleted ingress rules',
17
- 'Deleted egress rules'
18
- )
19
- expect($?.exitstatus).to eq(0)
20
- end
21
- end
1
+ describe 'Basic Network' do
2
+ it 'starts Linux VM with security groups' do
3
+ expect(`vagrant up`).to include(
4
+ 'Security Group Awesome_security_group1 created with ID',
5
+ 'Security Group Awesome_security_group2 created with ID',
6
+ 'Security Group: Awesome_security_group1 (',
7
+ 'Security Group: Awesome_security_group2 (',
8
+ 'Network name or id will be ignored',
9
+ 'Machine is booted and ready for use!'
10
+ )
11
+ expect($?.exitstatus).to eq(0)
12
+ end
13
+ it 'destroys Linux with security groups' do
14
+ expect(`vagrant destroy --force`).to include(
15
+ 'Terminating the instance...',
16
+ 'Deleted ingress rules',
17
+ 'Deleted egress rules'
18
+ )
19
+ expect($?.exitstatus).to eq(0)
20
+ end
21
+ end
@@ -1,102 +1,119 @@
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
- cloudstack_pf_ip_address = ENV['PUBLIC_SOURCE_NAT_IP']
9
- machines = {
10
- box1: {
11
- # Test fixed public port
12
- pf_public_port: ENV['PUBLIC_SSH_PORT'],
13
- # Test fixed private port
14
- pf_private_port: ENV['PRIVATE_SSH_PORT'],
15
- firewall_rules: [
16
- # Full Firewall rule
17
- {:ipaddress => cloudstack_pf_ip_address, :protocol => 'tcp', :startport => 1111, :endport => 1111},
18
- # Firewall rule without ':ipaddress' which defaults to 'cloudstack_pf_ip_address'
19
- {:protocol => 'tcp', :startport => 1122, :endport => 1122},
20
- # Firewall rule without ':protocol', which defaults to 'tcp'
21
- {:startport => 1133, :endport => 1133},
22
- # Firewall rule without ':endport', which defaults to ':startport' if present
23
- {:startport => 1144},
24
- # Firewall rule without ':start', which defaults to ':endport' if present
25
- {:endport => 22}
26
- ],
27
- port_forwarding_rules: [
28
- # Full portforwarding rule
29
- {:ipaddress => cloudstack_pf_ip_address, :protocol => "tcp", :publicport => 1111, :privateport => 22, :openfirewall => false},
30
- # Portforwarding rule without ':ipaddress' which defaults to 'cloudstack_pf_ip_address'
31
- {:protocol => "tcp", :publicport => 1122, :privateport => 22, :openfirewall => false},
32
- # Portforwarding rule without ':protocol', which defaults to 'tcp'
33
- {:publicport => 1133, :privateport => 22, :openfirewall => false},
34
- # Portforwarding rule without ':openfirewall', which defaults to 'cloudstack.pf_open_firewall'
35
- {:publicport => 1144, :privateport => 22},
36
- # Portforwarding rule without ':publicport', which defaults to ':privateport'
37
- {:privateport => 22},
38
- # Portforwarding rule with ':generate_firewall', which generates an apropriate
39
- # Firewall rule based ':publicport' => ':startport', and other defaults
40
- {:publicport => 1155, :privateport => 22, :generate_firewall => true},
41
- # Portforwarding rule which instructs CloudStack to create a Firewall rule
42
- {:publicport => 1166, :privateport => 22, :openfirewall => true},
43
- ],
44
- # Trusted network as array, instead of string. Add some networks to make sure it's an (multi element) Array
45
- pf_trusted_networks: [ENV['SOURCE_CIDR'], ',172.31.1.172/32', '172.31.1.173/32'],
46
- # Ignore security groups
47
- security_groups: [{
48
- :name => "Awesome_security_group",
49
- :description => "Created from the Vagrantfile",
50
- :rules => [{:type => "ingress", :protocol => "TCP", :startport => 22, :endport => 22, :cidrlist => "0.0.0.0/0"}]
51
- }],
52
- # Ignore security groups
53
- security_group_names: ['default', 'Awesome_security_group'],
54
- },
55
- box2: {
56
- # NO pf_public_port; test auto generated public port
57
- # NO pf_private_port; test detection of Communicator port (SSH/Winrm)
58
- # NO firewall rules for Communicator (SSH/WinRM), test auto generation
59
- # Trusted networks as string instead of array. Add some networks to make sure it supports multiple network-string
60
- pf_trusted_networks: ENV['SOURCE_CIDR'] + ',172.31.1.172/32,172.31.1.173/32'
61
- }
62
- }
63
-
64
- Vagrant.configure(VAGRANTFILE_API_VERSION) do |global_config|
65
- machines.each_pair do |name, options|
66
- global_config.vm.define name do |config|
67
- config.vm.box = ENV['LINUX_TEMPLATE_NAME']
68
-
69
- config.vm.synced_folder ".", "/vagrant", type: "rsync",
70
- rsync__exclude: [".git/", "vendor"], disabled: true
71
-
72
- config.vm.provider :cloudstack do |cloudstack, override|
73
- cloudstack.display_name = "#{name}-#{ENV['TEST_NAME']}"
74
-
75
- cloudstack.host = ENV['CLOUDSTACK_HOST']
76
- # Use default path, port and scheme
77
- cloudstack.api_key = ENV['CLOUDSTACK_API_KEY']
78
- cloudstack.secret_key = ENV['CLOUDSTACK_SECRET_KEY']
79
- cloudstack.zone_name = ENV['ZONE_NAME']
80
- cloudstack.network_name = ENV['NETWORK_NAME']
81
- cloudstack.service_offering_name = ENV['SERVICE_OFFERING_NAME']
82
- cloudstack.ssh_key = ENV['SSH_KEY'] unless ENV['SSH_KEY'].nil?
83
- cloudstack.ssh_user = ENV['SSH_USER'] unless ENV['SSH_USER'].nil?
84
- cloudstack.expunge_on_destroy == true
85
-
86
- cloudstack.pf_ip_address = cloudstack_pf_ip_address
87
- cloudstack.pf_public_port = options[:pf_public_port] unless options[:pf_public_port].nil?
88
- cloudstack.pf_private_port = options[:pf_private_port] unless options[:pf_private_port].nil?
89
- cloudstack.pf_open_firewall = false
90
-
91
- # With Advanced networking, following Basic networking features should be ignored
92
- cloudstack.security_groups = options[:security_groups] unless options[:security_groups].nil?
93
- cloudstack.security_group_names = options[:security_group_names] unless options[:security_group_names].nil?
94
- # With Advanced networking, following Basic networking features should be ignored
95
-
96
- cloudstack.pf_trusted_networks = options[:pf_trusted_networks] unless options[:pf_trusted_networks].nil?
97
- cloudstack.firewall_rules = options[:firewall_rules] unless options[:firewall_rules].nil?
98
- cloudstack.port_forwarding_rules = options[:port_forwarding_rules] unless options[:port_forwarding_rules].nil?
99
- end
100
- end
101
- end
102
- 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
+ networks = {
9
+ VR: {
10
+ network_name: ENV['VR_NETWORK_NAME'],
11
+ public_ip: ENV['VR_PUBLIC_IP']
12
+ },
13
+ VPC: {
14
+ network_name: ENV['VPC_TIER_NAME'],
15
+ public_ip: ENV['VPC_PUBLIC_IP']
16
+ }
17
+ }
18
+ machines = {}
19
+ networks.each_pair do |net_name, net_options|
20
+ box_number = 0
21
+ machines["#{net_name}box#{box_number+=1}"] = {
22
+ # Test fixed public port
23
+ pf_public_port: ENV['PUBLIC_SSH_PORT'],
24
+ # Test fixed private port
25
+ pf_private_port: ENV['PRIVATE_SSH_PORT'],
26
+ #
27
+ pf_ip_address: net_options[:public_ip],
28
+ network_name: net_options[:network_name],
29
+ firewall_rules: [
30
+ # Full Firewall rule
31
+ {:ipaddress => net_options[:public_ip], :protocol => 'tcp', :startport => 1111, :endport => 1111},
32
+ # Firewall rule without ':ipaddress' which defaults to 'cloudstack_pf_ip_address'
33
+ {:protocol => 'tcp', :startport => 1122, :endport => 1122},
34
+ # Firewall rule without ':protocol', which defaults to 'tcp'
35
+ {:startport => 1133, :endport => 1133},
36
+ # Firewall rule without ':endport', which defaults to ':startport' if present
37
+ {:startport => 1144},
38
+ # Firewall rule without ':start', which defaults to ':endport' if present
39
+ {:endport => 22}
40
+ ],
41
+ port_forwarding_rules: [
42
+ # Full portforwarding rule
43
+ {:ipaddress => net_options[:public_ip], :protocol => "tcp", :publicport => 1111, :privateport => 22, :openfirewall => false},
44
+ # Portforwarding rule without ':ipaddress' which defaults to 'cloudstack_pf_ip_address'
45
+ {:protocol => "tcp", :publicport => 1122, :privateport => 22, :openfirewall => false},
46
+ # Portforwarding rule without ':protocol', which defaults to 'tcp'
47
+ {:publicport => 1133, :privateport => 22, :openfirewall => false},
48
+ # Portforwarding rule without ':openfirewall', which defaults to 'cloudstack.pf_open_firewall'
49
+ {:publicport => 1144, :privateport => 22},
50
+ # Portforwarding rule without ':publicport', which defaults to ':privateport'
51
+ {:privateport => 22},
52
+ # Portforwarding rule with ':generate_firewall', which generates an apropriate
53
+ # Firewall rule based ':publicport' => ':startport', and other defaults
54
+ {:publicport => 1155, :privateport => 22, :generate_firewall => true},
55
+ # Portforwarding rule which instructs CloudStack to create a Firewall rule
56
+ {:publicport => 1166, :privateport => 22, :openfirewall => true},
57
+ ],
58
+ # Trusted network as array, instead of string. Add some networks to make sure it's an (multi element) Array
59
+ pf_trusted_networks: [ENV['SOURCE_CIDR'], ',172.31.1.172/32', '172.31.1.173/32'],
60
+ # Ignore security groups
61
+ security_groups: [{
62
+ :name => "Awesome_security_group",
63
+ :description => "Created from the Vagrantfile",
64
+ :rules => [{:type => "ingress", :protocol => "TCP", :startport => 22, :endport => 22, :cidrlist => "0.0.0.0/0"}]
65
+ }],
66
+ # Ignore security groups
67
+ security_group_names: ['default', 'Awesome_security_group'],
68
+ }
69
+
70
+ machines["#{net_name}box#{box_number+=1}"] = {
71
+ network_name: net_options[:network_name],
72
+ pf_ip_address: net_options[:public_ip],
73
+ # NO pf_public_port; test auto generated public port
74
+ # NO pf_private_port; test detection of Communicator port (SSH/Winrm)
75
+ # NO firewall rules for Communicator (SSH/WinRM), test auto generation
76
+ # Trusted networks as string instead of array. Add some networks to make sure it supports multiple network-string
77
+ pf_trusted_networks: ENV['SOURCE_CIDR'] + ',172.31.1.172/32,172.31.1.173/32'
78
+ }
79
+ end
80
+
81
+ Vagrant.configure(VAGRANTFILE_API_VERSION) do |global_config|
82
+ machines.each_pair do |name, options|
83
+ global_config.vm.define name do |config|
84
+ config.vm.box = ENV['LINUX_TEMPLATE_NAME']
85
+
86
+ config.vm.synced_folder ".", "/vagrant", type: "rsync",
87
+ rsync__exclude: [".git/", "vendor"], disabled: true
88
+
89
+ config.vm.provider :cloudstack do |cloudstack, override|
90
+ cloudstack.display_name = "#{name}-#{ENV['TEST_NAME']}"
91
+
92
+ cloudstack.host = ENV['CLOUDSTACK_HOST']
93
+ # Use default path, port and scheme
94
+ cloudstack.api_key = ENV['CLOUDSTACK_API_KEY']
95
+ cloudstack.secret_key = ENV['CLOUDSTACK_SECRET_KEY']
96
+ cloudstack.zone_name = ENV['ZONE_NAME']
97
+ cloudstack.network_name = options[:network_name]
98
+ cloudstack.service_offering_name = ENV['SERVICE_OFFERING_NAME']
99
+ cloudstack.ssh_key = ENV['SSH_KEY'] unless ENV['SSH_KEY'].nil?
100
+ cloudstack.ssh_user = ENV['SSH_USER'] unless ENV['SSH_USER'].nil?
101
+ cloudstack.expunge_on_destroy = ENV['EXPUNGE_ON_DESTROY']=="true"
102
+
103
+ cloudstack.pf_ip_address = options[:pf_ip_address]
104
+ cloudstack.pf_public_port = options[:pf_public_port] unless options[:pf_public_port].nil?
105
+ cloudstack.pf_private_port = options[:pf_private_port] unless options[:pf_private_port].nil?
106
+ cloudstack.pf_open_firewall = false
107
+
108
+ # With Advanced networking, following Basic networking features should be ignored
109
+ cloudstack.security_groups = options[:security_groups] unless options[:security_groups].nil?
110
+ cloudstack.security_group_names = options[:security_group_names] unless options[:security_group_names].nil?
111
+ # With Advanced networking, following Basic networking features should be ignored
112
+
113
+ cloudstack.pf_trusted_networks = options[:pf_trusted_networks] unless options[:pf_trusted_networks].nil?
114
+ cloudstack.firewall_rules = options[:firewall_rules] unless options[:firewall_rules].nil?
115
+ cloudstack.port_forwarding_rules = options[:port_forwarding_rules] unless options[:port_forwarding_rules].nil?
116
+ end
117
+ end
118
+ end
119
+ end