vagrant-deltacloud-provider 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +22 -0
  3. data/.rubocop.yml +28 -0
  4. data/CHANGELOG.md +8 -0
  5. data/Gemfile +18 -0
  6. data/LICENSE.txt +22 -0
  7. data/RELEASE.md +15 -0
  8. data/Rakefile +25 -0
  9. data/Vagrantfile +20 -0
  10. data/dummy.box +0 -0
  11. data/example_box/README.md +13 -0
  12. data/example_box/metadata.json +3 -0
  13. data/functional_tests/Vagrantfile +43 -0
  14. data/functional_tests/keys/vagrant-deltacloud +27 -0
  15. data/functional_tests/keys/vagrant-deltacloud.pub +1 -0
  16. data/functional_tests/run_tests.sh +139 -0
  17. data/gemfiles/latest_stable.gemfile +10 -0
  18. data/gemfiles/minimal_release.gemfile +10 -0
  19. data/gemfiles/previous_release.gemfile +10 -0
  20. data/lib/vagrant-deltacloud-provider.rb +58 -0
  21. data/lib/vagrant-deltacloud-provider/action.rb +200 -0
  22. data/lib/vagrant-deltacloud-provider/action/abstract_action.rb +22 -0
  23. data/lib/vagrant-deltacloud-provider/action/create_server.rb +109 -0
  24. data/lib/vagrant-deltacloud-provider/action/delete_server.rb +32 -0
  25. data/lib/vagrant-deltacloud-provider/action/message.rb +19 -0
  26. data/lib/vagrant-deltacloud-provider/action/read_ssh_info.rb +70 -0
  27. data/lib/vagrant-deltacloud-provider/action/read_state.rb +43 -0
  28. data/lib/vagrant-deltacloud-provider/action/resume.rb +26 -0
  29. data/lib/vagrant-deltacloud-provider/action/start_server.rb +26 -0
  30. data/lib/vagrant-deltacloud-provider/action/stop_server.rb +27 -0
  31. data/lib/vagrant-deltacloud-provider/action/suspend.rb +26 -0
  32. data/lib/vagrant-deltacloud-provider/action/sync_folders.rb +129 -0
  33. data/lib/vagrant-deltacloud-provider/action/wait_accessible.rb +63 -0
  34. data/lib/vagrant-deltacloud-provider/action/wait_active.rb +35 -0
  35. data/lib/vagrant-deltacloud-provider/action/wait_stop.rb +35 -0
  36. data/lib/vagrant-deltacloud-provider/client/deltacloud.rb +174 -0
  37. data/lib/vagrant-deltacloud-provider/client/domain.rb +189 -0
  38. data/lib/vagrant-deltacloud-provider/client/http_utils.rb +104 -0
  39. data/lib/vagrant-deltacloud-provider/client/request_logger.rb +24 -0
  40. data/lib/vagrant-deltacloud-provider/command/abstract_command.rb +46 -0
  41. data/lib/vagrant-deltacloud-provider/command/hardware_profile_list.rb +26 -0
  42. data/lib/vagrant-deltacloud-provider/command/image_list.rb +24 -0
  43. data/lib/vagrant-deltacloud-provider/command/instance_list.rb +24 -0
  44. data/lib/vagrant-deltacloud-provider/command/main.rb +53 -0
  45. data/lib/vagrant-deltacloud-provider/command/network_list.rb +25 -0
  46. data/lib/vagrant-deltacloud-provider/command/reset.rb +21 -0
  47. data/lib/vagrant-deltacloud-provider/command/utils.rb +27 -0
  48. data/lib/vagrant-deltacloud-provider/command/volume_list.rb +27 -0
  49. data/lib/vagrant-deltacloud-provider/config.rb +241 -0
  50. data/lib/vagrant-deltacloud-provider/config_resolver.rb +219 -0
  51. data/lib/vagrant-deltacloud-provider/errors.rb +144 -0
  52. data/lib/vagrant-deltacloud-provider/plugin.rb +42 -0
  53. data/lib/vagrant-deltacloud-provider/provider.rb +50 -0
  54. data/lib/vagrant-deltacloud-provider/utils.rb +9 -0
  55. data/lib/vagrant-deltacloud-provider/version.rb +5 -0
  56. data/locales/en.yml +282 -0
  57. data/spec/vagrant-deltacloud-provider/action/create_server_spec.rb +208 -0
  58. data/spec/vagrant-deltacloud-provider/action/delete_server_spec.rb +48 -0
  59. data/spec/vagrant-deltacloud-provider/action/message_spec.rb +34 -0
  60. data/spec/vagrant-deltacloud-provider/action/read_ssh_info_spec.rb +92 -0
  61. data/spec/vagrant-deltacloud-provider/action/read_state_spec.rb +68 -0
  62. data/spec/vagrant-deltacloud-provider/action/resume_server_spec.rb +48 -0
  63. data/spec/vagrant-deltacloud-provider/action/start_server_spec.rb +48 -0
  64. data/spec/vagrant-deltacloud-provider/action/stop_server_spec.rb +48 -0
  65. data/spec/vagrant-deltacloud-provider/action/suspend_server_spec.rb +48 -0
  66. data/spec/vagrant-deltacloud-provider/action/sync_folders_spec.rb +153 -0
  67. data/spec/vagrant-deltacloud-provider/action/wait_accessible_spec.rb +68 -0
  68. data/spec/vagrant-deltacloud-provider/action/wait_active_spec.rb +45 -0
  69. data/spec/vagrant-deltacloud-provider/action/wait_stop_spec.rb +45 -0
  70. data/spec/vagrant-deltacloud-provider/action_spec.rb +110 -0
  71. data/spec/vagrant-deltacloud-provider/client/utils_spec.rb +177 -0
  72. data/spec/vagrant-deltacloud-provider/command/hardware_profile_list_spec.rb +43 -0
  73. data/spec/vagrant-deltacloud-provider/command/image_list_spec.rb +58 -0
  74. data/spec/vagrant-deltacloud-provider/command/network_list_spec.rb +46 -0
  75. data/spec/vagrant-deltacloud-provider/command/reset_spec.rb +25 -0
  76. data/spec/vagrant-deltacloud-provider/command/volume_list_spec.rb +40 -0
  77. data/spec/vagrant-deltacloud-provider/config_resolver_spec.rb +202 -0
  78. data/spec/vagrant-deltacloud-provider/config_spec.rb +213 -0
  79. data/spec/vagrant-deltacloud-provider/provider_spec.rb +13 -0
  80. data/spec/vagrant-deltacloud-provider/spec_helper.rb +33 -0
  81. data/spec/vagrant-deltacloud-provider/utils_spec.rb +87 -0
  82. data/stackrc +24 -0
  83. data/vagrant-deltacloud-provider.gemspec +30 -0
  84. metadata +290 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7021b92fd05df8d82de878708883706eb69ffa95
4
+ data.tar.gz: 37c3a5533a71a550f39d98f248acc63ff1ab7d5c
5
+ SHA512:
6
+ metadata.gz: 4a2679c764a8ecf76ece5b11fae5dbdc9f4c942bd80a8b223d5b819d1d09a41553b8cacf6ddbff5fe4c1e80a35a3dd3c323095bbd51d39ab4904c8aa8d60dd6b
7
+ data.tar.gz: ab9430b4544e569ba680d125d24571cbc84695c9fede6fb13a95cca9be62a32fe069f631cfe65819d9813952f46ef9e8973bbb7faa2f3d1699d952f3b1280b55
data/.gitignore ADDED
@@ -0,0 +1,22 @@
1
+ *.gem
2
+ *.iml
3
+ *.rbc
4
+ .bundle
5
+ .config
6
+ .vagrant
7
+ .yardoc
8
+ Gemfile.lock
9
+ gemfiles/*.lock
10
+ InstalledFiles
11
+ _yardoc
12
+ coverage
13
+ doc/
14
+ lib/bundler/man
15
+ pkg
16
+ rdoc
17
+ spec/reports
18
+ test/tmp
19
+ test/version_tmp
20
+ tmp
21
+ .venv
22
+ .idea/
data/.rubocop.yml ADDED
@@ -0,0 +1,28 @@
1
+ AllCops:
2
+ Exclude:
3
+ - 'out/**/*'
4
+
5
+ Style/FileName:
6
+ Enabled: false
7
+
8
+ Style/Encoding:
9
+ Enabled: false
10
+
11
+ Style/Documentation:
12
+ Enabled: false
13
+
14
+ Style/ClassLength:
15
+ Max: 300
16
+
17
+ Style/CyclomaticComplexity:
18
+ Severity: warning
19
+ Max: 15
20
+
21
+ Style/MethodLength:
22
+ Max: 60
23
+
24
+ Style/LineLength:
25
+ Max: 150
26
+
27
+ Style/ParameterLists:
28
+ Max: 6
data/CHANGELOG.md ADDED
@@ -0,0 +1,8 @@
1
+ # 0.0.2 (November 13, 2014)
2
+
3
+ * "vagrant deltacloud", "vagrant deltacloud ...", "vagrant up" and "vagrant destroy" work.
4
+
5
+ # 0.0.1 (November 11, 2014)
6
+
7
+ * Forked the vagrant-deltacloud-provider (https://github.com/ggiamarchi/vagrant-openstack-provider).
8
+ * Initial release. Work in progress: Will not work yet.
data/Gemfile ADDED
@@ -0,0 +1,18 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :development do
6
+ gem 'vagrant', git: 'https://github.com/mitchellh/vagrant.git', tag: 'v1.6.5'
7
+ gem 'appraisal', '1.0.0'
8
+ gem 'rubocop', '0.23.0', require: false
9
+ gem 'coveralls', require: false
10
+ end
11
+
12
+ group :debug do
13
+ gem 'byebug'
14
+ end
15
+
16
+ group :plugins do
17
+ gem "vagrant-deltacloud-provider", path: "."
18
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Mitchell Hashimoto
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/RELEASE.md ADDED
@@ -0,0 +1,15 @@
1
+ # Release process
2
+
3
+ This is vagrant-deltacloud-provider's current release process, documented so people know what is
4
+ currently done.
5
+
6
+ ## Prepare the release
7
+
8
+ * Update the version in "lib/vagrant-deltacloud-provider/version.rb"
9
+ * Update the version in CHANGELOG.md
10
+ * Use "rake release". This will make sure to tag that commit and push it RubyGems.
11
+ * Update the version again in both files to a dev version for working again.
12
+
13
+ The CHANGELOG.md should be maintained in a similar format to Vagrant:
14
+
15
+ https://github.com/mitchellh/vagrant/blob/master/CHANGELOG.md
data/Rakefile ADDED
@@ -0,0 +1,25 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+ require 'rspec/core/rake_task'
4
+ require 'rubocop/rake_task'
5
+
6
+ # Immediately sync all stdout so that tools like buildbot can
7
+ # immediately load in the output.
8
+ $stdout.sync = true
9
+ $stderr.sync = true
10
+
11
+ # Change to the directory of this file.
12
+ Dir.chdir(File.expand_path('../', __FILE__))
13
+
14
+ # This installs the tasks that help with gem creation and
15
+ # publishing.
16
+ Bundler::GemHelper.install_tasks
17
+
18
+ # Install the `spec` task so that we can run tests.
19
+ RSpec::Core::RakeTask.new
20
+
21
+ # Install the `rubocop` task
22
+ RuboCop::RakeTask.new
23
+
24
+ # Default task is to run the unit tests
25
+ task default: %w(rubocop spec)
data/Vagrantfile ADDED
@@ -0,0 +1,20 @@
1
+ require 'vagrant-deltacloud-provider'
2
+
3
+ Vagrant.configure('2') do |config|
4
+
5
+ config.vm.box = 'deltacloud'
6
+
7
+ config.ssh.username = ENV['OS_SSH_USERNAME']
8
+
9
+ config.vm.provider :deltacloud do |os|
10
+ os.deltacloud_api_url = ENV['OS_API_URL']
11
+ os.tenant_name = ENV['OS_TENANT_NAME']
12
+ os.username = ENV['OS_USERNAME']
13
+ os.password = ENV['OS_PASSWORD']
14
+ os.hardware_profile = ENV['OS_HARDWARE_PROFILE']
15
+ os.image = ENV['OS_IMAGE']
16
+ os.server_name = ENV['OS_SERVER_NAME']
17
+ end
18
+
19
+ config.vm.provision "shell", inline: "echo 'ok' > ~/provision"
20
+ end
data/dummy.box ADDED
Binary file
@@ -0,0 +1,13 @@
1
+ # Vagrant Deltacloud Cloud Example Box
2
+
3
+ Vagrant providers each require a custom provider-specific box format.
4
+ This folder shows the example contents of a box for the `deltacloud` provider.
5
+ To turn this into a box:
6
+
7
+ ```
8
+ $ tar cvzf deltacloud.box ./metadata.json ./Vagrantfile
9
+ ```
10
+
11
+ This box works by using Vagrant's built-in Vagrantfile merging to setup
12
+ defaults for Deltacloud. These defaults can easily be overwritten by higher-level
13
+ Vagrantfiles (such as project root Vagrantfiles).
@@ -0,0 +1,3 @@
1
+ {
2
+ "provider": "deltacloud"
3
+ }
@@ -0,0 +1,43 @@
1
+ require 'vagrant-deltacloud-provider'
2
+
3
+ Vagrant.configure('2') do |config|
4
+
5
+ config.vm.box = 'deltacloud'
6
+ config.vm.box_url = 'https://github.com/cybercom-finland/vagrant-deltacloud-provider/raw/master/source/dummy.box'
7
+
8
+ config.ssh.private_key_path = ENV['OS_KEYPAIR_PRIVATE_KEY']
9
+ config.ssh.pty = true
10
+ config.ssh.shell = ENV['OS_SSH_SHELL']
11
+
12
+ config.vm.provider :deltacloud do |os|
13
+ os.username = ENV['OS_USERNAME']
14
+ os.password = ENV['OS_PASSWORD']
15
+ os.deltacloud_api_url = ENV['OS_API_URL']
16
+ os.tenant_name = ENV['OS_TENANT_NAME']
17
+ os.ssh_timeout = ENV['OS_SSH_TIMEOUT'].to_i
18
+ os.sync_method = ENV['OS_SYNC_METHOD']
19
+ os.hardware_profile = ENV['OS_HARDWARE_PROFILE']
20
+ os.image = ENV['OS_IMAGE']
21
+ os.ssh_username = ENV['OS_SSH_USERNAME']
22
+ os.public_key_name = ENV['OS_PUBLIC_KEY_NAME']
23
+ end
24
+
25
+ config.vm.define 'test-basic' do |test|
26
+ test.vm.provision 'shell', inline: 'echo "SUCCESS" > /tmp/test_shell_provision'
27
+ end
28
+
29
+ config.vm.define 'test-ssh-public-key-path' do |test|
30
+ test.vm.provider :deltacloud do |os|
31
+ os.public_key_name = nil
32
+ os.public_key_path = ENV['OS_PUBLIC_KEY_PATH']
33
+ end
34
+ test.vm.provision 'shell', inline: 'echo "SUCCESS" > /tmp/test_shell_provision'
35
+ end
36
+
37
+ config.vm.define 'test-availabilty-zone' do |test|
38
+ test.vm.provider :deltacloud do |os|
39
+ os.availability_zone = ENV['OS_AZ']
40
+ end
41
+ test.vm.provision 'shell', inline: 'echo "SUCCESS" > /tmp/test_shell_provision'
42
+ end
43
+ end
@@ -0,0 +1,27 @@
1
+ -----BEGIN RSA PRIV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air-de-Julien.local
@@ -0,0 +1,139 @@
1
+ #!/bin/bash
2
+
3
+ export VAGRANT_DELTACLOUD_LOG=debug
4
+
5
+ export OS_SSH_TIMEOUT=600
6
+ export OS_SYNC_METHOD=none
7
+ export OS_SSH_SHELL=bash
8
+ export OS_SSH_USERNAME=
9
+ export OS_SERVER_NAME=
10
+ export OS_IMAGE=
11
+
12
+ ERROR_STATE=0
13
+
14
+ #TODO(Customize the tests to work with Cybercom Cloud)
15
+
16
+ cat > /tmp/images_with_ssh_user <<EOL
17
+ ubuntu-12.04_x86_64_HWE;stack
18
+ ubuntu-14.04_x86_64_LVM;stack
19
+ debian7_x86_64_LVM;stack
20
+ centos65_x86_64_LVM;stack
21
+ EOL
22
+
23
+ cat > /tmp/vagrant_machines <<EOL
24
+ test-basic
25
+ test-ssh-public-key-path
26
+ test-availabilty-zone
27
+ EOL
28
+
29
+ #
30
+ # $1 - Log level
31
+ # $2 - Action (e.g. UP, SSH, DESTROY)
32
+ # $* - Text
33
+ #
34
+ function log() {
35
+ [ $# -lt 3 ] && echo "Logger error..." >&2 && exit 1
36
+ level=$1 ; shift
37
+ action=$1 ; shift
38
+ printf "$(date '+%Y-%m-%d %H:%M:%S') | %10s | %10s | %s\n" "${level}" "${action}" "$*" | tee -a test.log
39
+ }
40
+
41
+ #
42
+ # $1 - Action (e.g. UP, SSH, DESTROY)
43
+ # $* - Text
44
+ #
45
+ function logInfo() {
46
+ action=$1
47
+ shift
48
+ log INFO "${action}" "$*"
49
+ }
50
+
51
+ #
52
+ # $1 - Action (e.g. UP, SSH, DESTROY)
53
+ # $* - Text
54
+ #
55
+ function logError() {
56
+ action=$1
57
+ shift
58
+ log ERROR "${action}" "$*"
59
+ ERROR_STATE=1
60
+ }
61
+
62
+ #
63
+ # $1 - Action (e.g. UP, SSH, DESTROY)
64
+ # $* - Text
65
+ #
66
+ function logSuccess() {
67
+ action=$1
68
+ shift
69
+ log SUCCESS "${action}" "$*"
70
+ }
71
+
72
+ runSingleTest() {
73
+ if [ -d ".vagrant" ]; then
74
+ rm -rf .vagrant
75
+ fi
76
+ machine=${1}
77
+
78
+ testSummary="${OS_SERVER_NAME} - ${OS_IMAGE} - ${OS_SSH_USERNAME}"
79
+
80
+ logInfo 'START' "${testSummary}"
81
+
82
+ bundle exec vagrant up "${machine}" --provider deltacloud 2>&1 | tee -a "${OS_SERVER_NAME}_up.log"
83
+ if [ "${PIPESTATUS[0]}" -ne 0 ] ; then
84
+ logError 'UP' "${testSummary}"
85
+ else
86
+ logSuccess 'UP' "${testSummary}"
87
+ bundle exec vagrant ssh "${machine}" -c "cat /tmp/test_shell_provision" 2>&1 | tee -a "${OS_SERVER_NAME}_ssh.log"
88
+ if [ "${PIPESTATUS[0]}" -ne 0 ] ; then
89
+ logError 'SSH' "${testSummary}"
90
+ else
91
+ logSuccess 'SSH' "${testSummary}"
92
+ fi
93
+ fi
94
+
95
+ bundle exec vagrant destroy "${machine}" 2>&1 | tee -a "${OS_SERVER_NAME}_destroy.log"
96
+ if [ "${PIPESTATUS[0]}" -ne 0 ] ; then
97
+ logError 'DESTROY' "${testSummary}"
98
+ else
99
+ logSuccess 'DESTROY' "${testSummary}"
100
+ fi
101
+
102
+ logInfo 'END' "${testSummary}"
103
+
104
+ }
105
+
106
+ #
107
+ # $1 - Instance name prefix
108
+ #
109
+ function runAllTests() {
110
+ ip=${1}
111
+ i=1
112
+ rm -f test.log "${name}_*.log"
113
+ touch test.log
114
+ nbTests=$(wc -l < /tmp/images_with_ssh_user)
115
+ for (( i=1 ; i<=nbTests ; i++ )) ; do
116
+ #TODO(vagrant status does not support providers, see https://github.com/mitchellh/vagrant/issues/4173)
117
+ #for machine in $(bundle exec vagrant status | tail -n +8 | head -n -4 | awk '{print $1}') ; do
118
+ while IFS= read -r machine
119
+ do
120
+ currentTest=$(head -n ${i} < /tmp/images_with_ssh_user | tail -n 1)
121
+ export OS_SERVER_NAME="${machine}_${i}"
122
+ export OS_IMAGE=$(echo "${currentTest}" | cut -f1 -d";")
123
+ export OS_SSH_USERNAME=$(echo "${currentTest}" | cut -f2 -d";")
124
+ runSingleTest "${machine}"
125
+ done < /tmp/vagrant_machines
126
+ done
127
+ }
128
+
129
+ echo ''
130
+ echo '################################################################################################'
131
+ echo '# Report summary #'
132
+ echo '################################################################################################'
133
+ echo ''
134
+ cat test.log
135
+ echo ''
136
+ echo '################################################################################################'
137
+ echo ''
138
+
139
+ exit ${ERROR_STATE}
@@ -0,0 +1,10 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec :path => "../"
4
+
5
+ group :development do
6
+ gem 'vagrant', git: 'git://github.com/mitchellh/vagrant.git', tag: 'v1.6.5'
7
+ gem 'appraisal', '1.0.0'
8
+ gem 'rubocop', '0.23.0', require: false
9
+ gem 'coveralls', require: false
10
+ end
@@ -0,0 +1,10 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec :path => "../"
4
+
5
+ group :development do
6
+ gem 'vagrant', git: 'git://github.com/mitchellh/vagrant.git', tag: 'v1.4.0'
7
+ gem 'appraisal', '1.0.0'
8
+ gem 'rubocop', '0.23.0', require: false
9
+ gem 'coveralls', require: false
10
+ end