fog-openstack 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a5ef3d5e9db5c4a3630e0f142fb5969346b249a2
4
- data.tar.gz: 86a67a59a76c82967d7f834c8d0c4fce73391ec1
3
+ metadata.gz: e282e95abf02b0be1feaf68de539e9f46dac483b
4
+ data.tar.gz: 267e6a26085dd1f653d3dc29873b3f2da90ea4ac
5
5
  SHA512:
6
- metadata.gz: 064950f848ead6d4791df03194d7b991dd793c8717c42beb0e383f400339560f6633e379709c1dd6239876172f60ef4f8c18eae906e3446ea7c405933193cce8
7
- data.tar.gz: 4ac6a0c3d149c410d9bbbda237fe14b4d6ab862b4a29a3dc92e4ce96860ce3fc9eb4b6e788d3c93a2be34bd2311ccd87d02ec4d28a0233594e1fdcefbc3d553a
6
+ metadata.gz: 2673e523851172fdba9bd090628a702183420790368f4153901824e4a645dc35050264e7caf5eba5bba1ed7f56f8d22b3c394b21f2d16efcd0c54420775abc08
7
+ data.tar.gz: eb67d3fb407504402fa618a80f6b863beab72f2625f5fe364f2d3acc48743c0187008a5b80e9c6be6eb3c236148e4e9ddaed7ab9469796dc5bb8f1d922ac3691
data/Rakefile CHANGED
@@ -1,12 +1,23 @@
1
1
  require 'bundler/gem_tasks'
2
2
  require 'rubocop/rake_task'
3
+ require "minitest/spec"
3
4
 
4
5
  RuboCop::RakeTask.new
5
6
 
6
7
  task :default => :test
7
8
 
8
9
  desc 'Run fog-openstack unit tests'
9
- mock = ENV['FOG_MOCK'] || 'true'
10
10
  task :test do
11
+ mock = ENV['FOG_MOCK'] || 'true'
11
12
  sh("export FOG_MOCK=#{mock} && bundle exec shindont")
12
13
  end
14
+
15
+ require 'rake/testtask'
16
+
17
+ desc "Run fog-openstack unit tests for /spec"
18
+ Rake::TestTask.new do |t|
19
+ t.name = 'spec'
20
+ t.libs.push [ "lib", "spec" ]
21
+ t.pattern = 'spec/**/*_spec.rb'
22
+ t.verbose = true
23
+ end
@@ -31,4 +31,7 @@ Gem::Specification.new do |spec|
31
31
  spec.add_development_dependency 'rubocop'
32
32
  spec.add_development_dependency 'rubyzip', '~> 0.9.9'
33
33
  spec.add_development_dependency 'shindo', '~> 0.3'
34
+ spec.add_development_dependency 'minitest'
35
+ spec.add_development_dependency 'vcr'
36
+ spec.add_development_dependency 'webmock'
34
37
  end
data/gemfiles/Gemfile-1.9 CHANGED
@@ -13,4 +13,7 @@ group :development, :test do
13
13
  gem "rubocop"
14
14
  gem "rubyzip", "~> 0.9.9"
15
15
  gem "shindo", "~> 0.3"
16
+ gem "minitest"
17
+ gem "vcr"
18
+ gem "webmock"
16
19
  end
@@ -302,7 +302,7 @@ module Fog
302
302
  service.live_migrate_server(id, host, block_migration, disk_over_commit)
303
303
  end
304
304
 
305
- def evacuate(host, on_shared_storage, admin_password = nil)
305
+ def evacuate(host = nil, on_shared_storage = true, admin_password = nil)
306
306
  requires :id
307
307
  service.evacuate_server(id, host, on_shared_storage, admin_password)
308
308
  end
@@ -17,6 +17,18 @@ module Fog
17
17
  Fog::Logger.deprecation('Calling OpenStack[:compute].services.details is deprecated, use .services.all')
18
18
  all(options)
19
19
  end
20
+
21
+ def get(service_id)
22
+ # OpenStack API currently does not support getting single service from it
23
+ # There is a blueprint https://blueprints.launchpad.net/nova/+spec/get-service-by-id
24
+ # with spec proposal patch https://review.openstack.org/#/c/172412/ but this is abandoned.
25
+ serv = service.list_services.body['services'].detect do |s|
26
+ s['id'] == service_id
27
+ end
28
+ new(serv) if serv
29
+ rescue Fog::Compute::OpenStack::NotFound
30
+ nil
31
+ end
20
32
  end
21
33
  end
22
34
  end
@@ -2,13 +2,12 @@ module Fog
2
2
  module Compute
3
3
  class OpenStack
4
4
  class Real
5
- def evacuate_server(server_id, host, on_shared_storage, admin_password = nil)
5
+ def evacuate_server(server_id, host = nil, on_shared_storage = true, admin_password = nil)
6
+ evacuate = {'onSharedStorage' => on_shared_storage}
7
+ evacuate['host'] = host if host
8
+ evacuate['adminPass'] = admin_password if admin_password
6
9
  body = {
7
- 'evacuate' => {
8
- 'host' => host,
9
- 'onSharedStorage' => on_shared_storage,
10
- 'admin_password' => admin_password,
11
- }
10
+ 'evacuate' => evacuate
12
11
  }
13
12
  server_action(server_id, body)
14
13
  end
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module Openstack
3
- VERSION = "0.1.4"
3
+ VERSION = "0.1.5"
4
4
  end
5
5
  end
@@ -0,0 +1,17 @@
1
+ Shindo.tests("Fog::Compute[:openstack] | services", ['openstack']) do
2
+ tests('success') do
3
+ tests('#all').succeeds do
4
+ services = Fog::Compute[:openstack].services.all
5
+ @service = services.first
6
+ end
7
+
8
+ tests('#get').succeeds do
9
+ service = Fog::Compute[:openstack].services.get(@service.id)
10
+ %w(id binary host).all? do |attr|
11
+ attr1 = service.send(attr.to_sym)
12
+ attr2 = @service.send(attr.to_sym)
13
+ attr1 == attr2
14
+ end
15
+ end
16
+ end
17
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fog-openstack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Darby
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-04-26 00:00:00.000000000 Z
11
+ date: 2016-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fog-core
@@ -164,6 +164,48 @@ dependencies:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0.3'
167
+ - !ruby/object:Gem::Dependency
168
+ name: minitest
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: vcr
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ version: '0'
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - ">="
193
+ - !ruby/object:Gem::Version
194
+ version: '0'
195
+ - !ruby/object:Gem::Dependency
196
+ name: webmock
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - ">="
200
+ - !ruby/object:Gem::Version
201
+ version: '0'
202
+ type: :development
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - ">="
207
+ - !ruby/object:Gem::Version
208
+ version: '0'
167
209
  description: OpenStack fog provider gem.
168
210
  email:
169
211
  - matt.darby@rackspace.com
@@ -173,7 +215,6 @@ extra_rdoc_files: []
173
215
  files:
174
216
  - ".gitignore"
175
217
  - ".hound.yml"
176
- - ".rspec"
177
218
  - ".rubocop.yml"
178
219
  - ".ruby-gemset"
179
220
  - ".ruby-version"
@@ -918,6 +959,7 @@ files:
918
959
  - tests/openstack/models/compute/images_tests.rb
919
960
  - tests/openstack/models/compute/security_group_tests.rb
920
961
  - tests/openstack/models/compute/server_tests.rb
962
+ - tests/openstack/models/compute/service_tests.rb
921
963
  - tests/openstack/models/identity/ec2_credential_tests.rb
922
964
  - tests/openstack/models/identity/ec2_credentials_tests.rb
923
965
  - tests/openstack/models/identity/role_tests.rb
data/.rspec DELETED
@@ -1,2 +0,0 @@
1
- --format documentation
2
- --color