opennebula-provider 0.1.5 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -2
- data/lib/opennebula-provider/config.rb +4 -1
- data/lib/opennebula-provider/errors.rb +16 -4
- data/lib/opennebula-provider/helpers/rocci.rb +30 -5
- data/lib/opennebula-provider/version.rb +1 -1
- data/locales/en.yml +22 -5
- metadata +27 -29
- data/test/test_rsa +0 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fae90815076cc487d10199bed0a3ff1d8dbd81a1
|
4
|
+
data.tar.gz: 575a144fdd4436e0f18246a33ea8de5bd8a7d61b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8b14749cdfa2ee3f57b6f047d74dab81b9402ae57a8b0999fddb884efac5fb7945deeedbe1398286b61ea91165ff6583a1021bb3741cc56c2651a65b9727b09
|
7
|
+
data.tar.gz: 767e5d43bd71c92f0bd6b2211469271ac27d1b7200e4c8bb7dd4cb6f5c5fc76342565f1ec382d137da76d8cdb00270d5c7c33056e8d7098f6c8555321ae85672
|
data/README.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# OpenNebula::Provider
|
2
2
|
|
3
|
-
[![Gem Version](https://badge.fury.io/rb/opennebula-provider.
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/opennebula-provider.svg)](https://rubygems.org/gems/opennebula-provider)
|
4
4
|
|
5
5
|
This is a Vagrant 1.5 plugin that add an OpenNebula provider to Vagrant.
|
6
6
|
|
7
|
-
**NOTE:** This plugin requires occi-api gem and works with rOCCI-server.
|
7
|
+
**NOTE:** This plugin requires occi-api gem and works with [rOCCI-server](https://github.com/gwdg/rOCCI-server/).
|
8
8
|
|
9
9
|
## Features
|
10
10
|
|
@@ -49,6 +49,7 @@ end
|
|
49
49
|
* `auth` - OpenNebula authorization method, default: basic
|
50
50
|
* `os_tpl` - OpenNebula os template
|
51
51
|
* `resource_tpl` - OpenNebula resource template, default: small
|
52
|
+
* `title` - OpenNebula instance name
|
52
53
|
|
53
54
|
## Contributing
|
54
55
|
|
@@ -7,6 +7,7 @@ module VagrantPlugins
|
|
7
7
|
attr_accessor :password
|
8
8
|
attr_accessor :os_tpl
|
9
9
|
attr_accessor :resource_tpl
|
10
|
+
attr_accessor :title
|
10
11
|
|
11
12
|
def initialize
|
12
13
|
@endpoint = UNSET_VALUE
|
@@ -15,6 +16,7 @@ module VagrantPlugins
|
|
15
16
|
@password = UNSET_VALUE
|
16
17
|
@os_tpl = UNSET_VALUE
|
17
18
|
@resource_tpl = UNSET_VALUE
|
19
|
+
@title = UNSET_VALUE
|
18
20
|
end
|
19
21
|
|
20
22
|
def finalize!
|
@@ -24,6 +26,7 @@ module VagrantPlugins
|
|
24
26
|
@password = nil if @password == UNSET_VALUE
|
25
27
|
@os_tpl = nil if @os_tpl == UNSET_VALUE
|
26
28
|
@resource_tpl = 'small' if @resource_tpl == UNSET_VALUE
|
29
|
+
@title = nil if @title == UNSET_VALUE
|
27
30
|
end
|
28
31
|
|
29
32
|
def validate(machine)
|
@@ -31,7 +34,7 @@ module VagrantPlugins
|
|
31
34
|
errors << I18n.t('opennebula_provider.config.endpoint') unless @endpoint
|
32
35
|
errors << I18n.t('opennebula_provider.config.username') unless @username
|
33
36
|
errors << I18n.t('opennebula_provider.config.password') unless @password
|
34
|
-
errors << I18n.t('opennebula_provider.config.
|
37
|
+
errors << I18n.t('opennebula_provider.config.os_tpl') unless @os_tpl
|
35
38
|
|
36
39
|
{ 'OpenNebula provider' => errors }
|
37
40
|
end
|
@@ -5,17 +5,29 @@ module VagrantPlugins
|
|
5
5
|
error_namespace('opennebula_provider.errors')
|
6
6
|
end
|
7
7
|
|
8
|
-
class QuotaError < OpenNebulaProviderError
|
9
|
-
error_key(:quota)
|
10
|
-
end
|
11
|
-
|
12
8
|
class AllocateError < OpenNebulaProviderError
|
13
9
|
error_key(:allocate)
|
14
10
|
end
|
15
11
|
|
12
|
+
class AuthError < OpenNebulaProviderError
|
13
|
+
error_key(:auth)
|
14
|
+
end
|
15
|
+
|
16
16
|
class ComputeError < OpenNebulaProviderError
|
17
17
|
error_key(:compute)
|
18
18
|
end
|
19
|
+
|
20
|
+
class ConnectError < OpenNebulaProviderError
|
21
|
+
error_key(:connect)
|
22
|
+
end
|
23
|
+
|
24
|
+
class ResourceError < OpenNebulaProviderError
|
25
|
+
error_key(:resource)
|
26
|
+
end
|
27
|
+
|
28
|
+
class QuotaError < OpenNebulaProviderError
|
29
|
+
error_key(:quota)
|
30
|
+
end
|
19
31
|
end
|
20
32
|
end
|
21
33
|
end
|
@@ -23,20 +23,41 @@ module VagrantPlugins
|
|
23
23
|
password: @config.password
|
24
24
|
}
|
25
25
|
# :log => {
|
26
|
-
|
27
|
-
|
26
|
+
# :out => STDERR,
|
27
|
+
# :level => Occi::Api::Log::DEBUG
|
28
28
|
# }
|
29
29
|
}
|
30
|
-
|
30
|
+
begin
|
31
|
+
@rocci = Occi::Api::Client::ClientHttp.new(options)
|
32
|
+
rescue Errno::ECONNREFUSED => e
|
33
|
+
raise Errors::ConnectError, error: e
|
34
|
+
rescue Occi::Api::Client::Errors::AuthnError => e
|
35
|
+
raise Errors::AuthError, error: e
|
36
|
+
end
|
31
37
|
end
|
32
38
|
|
33
39
|
def compute
|
34
40
|
@logger.info 'compute!'
|
35
41
|
cmpt = @rocci.get_resource 'compute'
|
42
|
+
|
36
43
|
os = @rocci.get_mixin @config.os_tpl, 'os_tpl'
|
44
|
+
unless os
|
45
|
+
mixins = @rocci.get_mixins 'os_tpl'
|
46
|
+
mixins.each do |mixin|
|
47
|
+
if mixin.title == @config.os_tpl
|
48
|
+
os = @rocci.get_mixin mixin.term, 'os_tpl'
|
49
|
+
end
|
50
|
+
end
|
51
|
+
fail Errors::ComputeError, error: I18n.t('opennebula_provider.compute.os_missing', template: @config.os_tpl) unless os
|
52
|
+
end
|
53
|
+
|
37
54
|
size = @rocci.get_mixin @config.resource_tpl, 'resource_tpl'
|
55
|
+
unless size
|
56
|
+
fail Errors::ComputeError, error: I18n.t('opennebula_provider.compute.resource_size_missing', template: @config.resource_tpl)
|
57
|
+
end
|
58
|
+
|
38
59
|
cmpt.mixins << os << size
|
39
|
-
cmpt.title =
|
60
|
+
cmpt.title = @config.title if @config.title
|
40
61
|
cmpt_loc = @rocci.create cmpt
|
41
62
|
@logger.info "Location of new compute resource: #{cmpt_loc}"
|
42
63
|
cmpt_loc
|
@@ -65,7 +86,11 @@ module VagrantPlugins
|
|
65
86
|
|
66
87
|
def machine_state(id)
|
67
88
|
if id
|
68
|
-
|
89
|
+
begin
|
90
|
+
desc = @rocci.describe id
|
91
|
+
rescue ArgumentError => e
|
92
|
+
raise Errors::ResourceError, error: e
|
93
|
+
end
|
69
94
|
return :not_created if desc.empty?
|
70
95
|
return desc.first.attributes.occi.compute.state
|
71
96
|
else
|
data/locales/en.yml
CHANGED
@@ -4,7 +4,7 @@ en:
|
|
4
4
|
connecting: |-
|
5
5
|
Connecting to OpenNebula
|
6
6
|
creating: |-
|
7
|
-
Creating a new instance...
|
7
|
+
Creating a new instance...
|
8
8
|
not_created: |-
|
9
9
|
Instance is not created
|
10
10
|
destroying: |-
|
@@ -23,6 +23,11 @@ en:
|
|
23
23
|
long_not_created: |-
|
24
24
|
The OpenNebula instance is not created
|
25
25
|
|
26
|
+
short_inactive: |-
|
27
|
+
inactive
|
28
|
+
long_inactive: |-
|
29
|
+
Instance is inactive
|
30
|
+
|
26
31
|
short_active: |-
|
27
32
|
active
|
28
33
|
long_active: |-
|
@@ -40,13 +45,25 @@ en:
|
|
40
45
|
Username is not set
|
41
46
|
password: |-
|
42
47
|
Password is not set
|
43
|
-
|
44
|
-
|
48
|
+
os_tpl: |-
|
49
|
+
An os template must defined via "os_tpl"
|
50
|
+
|
51
|
+
compute:
|
52
|
+
os_missing: |-
|
53
|
+
Os template "%{template}" is not defined in OpenNebula
|
54
|
+
resource_size_missing: |-
|
55
|
+
Resource size "%{template}" is not defined in rOCCI-server
|
45
56
|
|
46
57
|
errors:
|
58
|
+
allocate: |-
|
59
|
+
Allocation error! %{error}
|
60
|
+
auth: |-
|
61
|
+
Authentication error! %{error}
|
47
62
|
compute: |-
|
48
63
|
Compute error! %{error}
|
64
|
+
connect: |-
|
65
|
+
Connect error! %{error}
|
66
|
+
resource: |-
|
67
|
+
Resource error! %{error}
|
49
68
|
quota: |-
|
50
69
|
Quota error! %{error}
|
51
|
-
allocate: |-
|
52
|
-
Allocation error! %{error}
|
metadata
CHANGED
@@ -1,69 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opennebula-provider
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cherdancev Evgeni
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: occi-api
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '4.2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '4.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '1.3'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.3'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
description: OpenNebula provider for Vagrant
|
@@ -73,31 +73,30 @@ executables: []
|
|
73
73
|
extensions: []
|
74
74
|
extra_rdoc_files: []
|
75
75
|
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- Gemfile
|
76
78
|
- LICENSE.txt
|
77
|
-
- locales/en.yml
|
78
79
|
- README.md
|
79
|
-
-
|
80
|
+
- Rakefile
|
81
|
+
- boxes/dummy/README.md
|
80
82
|
- boxes/dummy/dummy.box
|
81
83
|
- boxes/dummy/metadata.json
|
82
|
-
-
|
83
|
-
- lib/opennebula-provider/
|
84
|
-
- lib/opennebula-provider/errors.rb
|
85
|
-
- lib/opennebula-provider/plugin.rb
|
86
|
-
- lib/opennebula-provider/helpers/rocci.rb
|
87
|
-
- lib/opennebula-provider/action/destroy.rb
|
84
|
+
- lib/opennebula-provider.rb
|
85
|
+
- lib/opennebula-provider/action.rb
|
88
86
|
- lib/opennebula-provider/action/check_state.rb
|
89
|
-
- lib/opennebula-provider/action/read_ssh_info.rb
|
90
87
|
- lib/opennebula-provider/action/connect_opennebula.rb
|
91
88
|
- lib/opennebula-provider/action/create.rb
|
89
|
+
- lib/opennebula-provider/action/destroy.rb
|
90
|
+
- lib/opennebula-provider/action/read_ssh_info.rb
|
92
91
|
- lib/opennebula-provider/action/sync_folders.rb
|
93
|
-
- lib/opennebula-provider/action.rb
|
94
92
|
- lib/opennebula-provider/config.rb
|
93
|
+
- lib/opennebula-provider/errors.rb
|
94
|
+
- lib/opennebula-provider/helpers/rocci.rb
|
95
|
+
- lib/opennebula-provider/plugin.rb
|
95
96
|
- lib/opennebula-provider/provider.rb
|
96
|
-
- lib/opennebula-provider.rb
|
97
|
+
- lib/opennebula-provider/version.rb
|
98
|
+
- locales/en.yml
|
97
99
|
- opennebula-provider.gemspec
|
98
|
-
- test/test_rsa
|
99
|
-
- Rakefile
|
100
|
-
- .gitignore
|
101
100
|
homepage: ''
|
102
101
|
licenses:
|
103
102
|
- MIT
|
@@ -108,19 +107,18 @@ require_paths:
|
|
108
107
|
- lib
|
109
108
|
required_ruby_version: !ruby/object:Gem::Requirement
|
110
109
|
requirements:
|
111
|
-
- -
|
110
|
+
- - ">="
|
112
111
|
- !ruby/object:Gem::Version
|
113
112
|
version: '0'
|
114
113
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
114
|
requirements:
|
116
|
-
- -
|
115
|
+
- - ">="
|
117
116
|
- !ruby/object:Gem::Version
|
118
117
|
version: '0'
|
119
118
|
requirements: []
|
120
119
|
rubyforge_project:
|
121
|
-
rubygems_version: 2.
|
120
|
+
rubygems_version: 2.2.2
|
122
121
|
signing_key:
|
123
122
|
specification_version: 4
|
124
123
|
summary: OpenNebula provider for Vagrant
|
125
|
-
test_files:
|
126
|
-
- test/test_rsa
|
124
|
+
test_files: []
|
data/test/test_rsa
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
-----BEGIN RSA PRIVATE KEY-----
|
2
|
-
MIIEpQIBAAKCAQEA7PbUG3ZnKywbc031GWQjzxnqBYHgOy78cEoMccC1oiuX1+1o
|
3
|
-
tKkGtADuAnDOrd3bPOQNr0vNxJpizHM+Jdj/Osno8gW1G01rGTQG/CZ6uA20bd4b
|
4
|
-
ob1yPjrmo/PaFmG18xgK/P7hP8h9ME9pXHWiQAewQs1OW/QM9REowFrxyFIEAZXp
|
5
|
-
/MKXP96Yr59cdFRY+5k0uchOH5zT1HR5VEIaS1bouF2IYSUjdHbDbX8LRU5z4h4R
|
6
|
-
1rf1f6ANAsZfANi+G0wJqZwOCf8vz397AzAEMfhCHCYwrD68qpl9Olf9HWgnF1WT
|
7
|
-
U5yX0+bakZWl0VmJGsBlD9y8q+A2tZo+VMLBNQIDAQABAoIBAQDJ8w4PnZgNThjS
|
8
|
-
6tSA4Dw4a0BrkyUzqzaOyDzU0US6weY1quo6VXcV/1jYkaVCvjnzKfSTucnSzTR4
|
9
|
-
Q5rqjIXwZ1V0tfKEIzWsFBAD4xNhOqTToZ/w9tCfQnl/rvnlaz6yv4HV3a7AOjCe
|
10
|
-
9H65wrMVWLgaJniqm1JTpV0Smi9G5SMCs3S+r3JMeTDkGiaMOuRxt0jWF6tQqKvW
|
11
|
-
UquE9uRZkqXnvZUZYe38AjZ/grbhIJHUFqDxidAGX4ouhnIuqZy971oel6C3ZPWu
|
12
|
-
4Px5Ex58+HqRdjvOnLhSVVgBEtE8LdMMjYf3RFTPszdMtAXpU+zh2Jzkswha+pKT
|
13
|
-
+99gYshdAoGBAPvxVgxNZsRZWnpDPAEm5R5I0pD7vP9oCtr4QlQPTHCt6GYXtS+J
|
14
|
-
rHCUomNH98+kVbQuWqaOFX2FfIIw9C/GO/r8X51sSAp7Ah0HKW6WeLKMk+jfgruH
|
15
|
-
jJy5MS2gMmdVAgoAr8OXMMFJAyuvgyeVpXpJiEdOIV4U8oCB4dPLSEcHAoGBAPDH
|
16
|
-
vdhLUItEE3XWeghalkXPeWa1EBc7l53dXxr/4DXk63/AgFIGt7g5OEwZjPqSZ0Pz
|
17
|
-
SbuOxGzIj8FVwfSvFWbOsbe03IRgaIltGWq6pVzpa3uJASNAWZh10z3UhJuj9vWG
|
18
|
-
4oMvGkZoBK8eAjgQPAxVhemZotoxEhaNkDQtDorjAoGBANTtVmf3Uo9HZSxHfoMK
|
19
|
-
uEEsEqnt2AGTkPkXMBeTBmuEzxDZoIuYs2BCfiuiO1IF9VjehEaXdporItt1PCrU
|
20
|
-
QwUQHk8RoKEa7OJTlzSbf06HeMorfHW5TaF28pU4+uBR+/MwOVv4f4AbkM5u+02N
|
21
|
-
L9l2I/L/mTvGQF1TZ+RzvZYpAoGABMPfNPWgnXD2daGN/rZUPQNzIp44uEz8niow
|
22
|
-
ZKdlt4tVQcz8fSMW5bV0MMVcreTR2F1rOyQDLSf2+FuLIB2K7eLvT3Rr3M7PotCe
|
23
|
-
7SbOeP1BnEtE037Fhyfly1Z2XWIsVAWcW/5FpdkPJqwQXS2tEo1qvgnFWE4aTon0
|
24
|
-
raOqowMCgYEAy2I3mslOA9lylapShkydPRraBow9rTtpGi8K85HTdyz3wzfR5t7Y
|
25
|
-
Aoad1jJ77U2nXnHTe+s1X7FusyX8SF6Wl9jb/Wjf9K/LbMZQqCmzDqsAA6Rwguds
|
26
|
-
OD2kABU5dyf6X8BJ3vpv4JR57nOowwkKFKJNZmkNPiwolF9kCk0YQFM=
|
27
|
-
-----END RSA PRIVATE KEY-----
|