fog-libvirt 0.10.0 → 0.10.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c7115a1bb2c554de544d464049d48c6a15f2b39499a729180ab0e37bab55d3f3
4
- data.tar.gz: c38e323849b149376f72edacd821788aa9df923d7bd4ca334dd0792a1ade5fab
3
+ metadata.gz: b0eeb036772c096dd44785f75d40342a54ba904b25bdc1a9a4fcd6618c5e68d2
4
+ data.tar.gz: 6724150fb122ed80117725f1ee72d87de38d29ba7e3b10e5da2e752d302c2b92
5
5
  SHA512:
6
- metadata.gz: dc0dd759cec37c6e89557dec04bc05a679150183474cf589509cf0a36d51a129bcfd521b0ecbb2682b8eb76ef1d2bd25f81bff8e3117ba35961fd8d8f2d1a285
7
- data.tar.gz: f7f1661e4e48a4fdaa68475ca34eb6f35bd346981891ea7cdb49a4b05d236b2886bf125ffb51ec2538277d3b7fe7584f3338eea30e0c4011a4712290d7370533
6
+ metadata.gz: e793caef5c183c003807f4d1d080575a47c0a64051ff84e76063863beae0e8bf253acf4b5dfb0054125343230578f0ce1f6e7871ca16ae249ace8b3d8c76d82e
7
+ data.tar.gz: 262443398fed1548bbcec936781cddc5e5f0664f0744021db5f47ed076b245e69b7061c5bcb35ae38270314b0a64e189896b6e923309d39277abf2538b139a45
@@ -1,24 +1,10 @@
1
1
  module Fog
2
2
  module Libvirt
3
3
  class Compute
4
- class Real
5
- def list_pools(filter = { })
6
- data=[]
7
- if filter.key?(:name)
8
- data << find_pool_by_name(filter[:name], filter[:include_inactive])
9
- elsif filter.key?(:uuid)
10
- data << find_pool_by_uuid(filter[:uuid], filter[:include_inactive])
11
- else
12
- (client.list_storage_pools + client.list_defined_storage_pools).each do |name|
13
- data << find_pool_by_name(name, filter[:include_inactive])
14
- end
15
- end
16
- data.compact
17
- end
18
-
4
+ module Shared
19
5
  private
20
6
 
21
- private_class_method def self.pool_to_attributes(pool, include_inactive = nil)
7
+ def pool_to_attributes(pool, include_inactive = nil)
22
8
  return nil unless pool.active? || include_inactive
23
9
 
24
10
  states=[:inactive, :building, :running, :degrated, :inaccessible]
@@ -34,6 +20,26 @@ module Fog
34
20
  :state => states[pool.info.state]
35
21
  }
36
22
  end
23
+ end
24
+
25
+ class Real
26
+ include Shared
27
+
28
+ def list_pools(filter = { })
29
+ data=[]
30
+ if filter.key?(:name)
31
+ data << find_pool_by_name(filter[:name], filter[:include_inactive])
32
+ elsif filter.key?(:uuid)
33
+ data << find_pool_by_uuid(filter[:uuid], filter[:include_inactive])
34
+ else
35
+ (client.list_storage_pools + client.list_defined_storage_pools).each do |name|
36
+ data << find_pool_by_name(name, filter[:include_inactive])
37
+ end
38
+ end
39
+ data.compact
40
+ end
41
+
42
+ private
37
43
 
38
44
  def find_pool_by_name name, include_inactive
39
45
  pool_to_attributes(client.lookup_storage_pool_by_name(name), include_inactive)
@@ -49,6 +55,8 @@ module Fog
49
55
  end
50
56
 
51
57
  class Mock
58
+ include Shared
59
+
52
60
  def list_pools(filter = { })
53
61
  pool1 = mock_pool 'pool1'
54
62
  pool2 = mock_pool 'pool1'
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module Libvirt
3
- VERSION = '0.10.0'
3
+ VERSION = '0.10.1'
4
4
  end
5
5
  end
@@ -59,11 +59,11 @@ Shindo.tests("Fog::Compute[:libvirt] | list_pools request", 'libvirt') do
59
59
  :num_of_volumes => 3
60
60
  }
61
61
 
62
- response = ::Fog::Libvirt::Compute::Real.send(:pool_to_attributes, FakePool.new(inactive_pool), true)
62
+ response = compute.send(:pool_to_attributes, FakePool.new(inactive_pool), true)
63
63
 
64
64
  test("should be hash of attributes") { response.kind_of? Hash }
65
65
 
66
- response = ::Fog::Libvirt::Compute::Real.send(:pool_to_attributes, FakePool.new(inactive_pool))
66
+ response = compute.send(:pool_to_attributes, FakePool.new(inactive_pool))
67
67
 
68
68
  test("should be nil") { response.nil? }
69
69
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fog-libvirt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - geemus (Wesley Beary)
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-01 00:00:00.000000000 Z
11
+ date: 2022-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fog-core