fog-proxmox 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/Gemfile.lock +44 -39
- data/Rakefile +5 -0
- data/fog-proxmox.gemspec +1 -0
- data/lib/fog/identity/proxmox.rb +4 -0
- data/lib/fog/proxmox.rb +0 -2
- data/lib/fog/proxmox/helpers/cpu_helper.rb +8 -14
- data/lib/fog/proxmox/string.rb +31 -0
- data/lib/fog/proxmox/version.rb +1 -1
- data/spec/fixtures/proxmox/pve.home +27 -0
- data/spec/hash_spec.rb +0 -43
- data/spec/helpers/cpu_helper_spec.rb +6 -27
- data/spec/identity_spec.rb +1 -13
- data/spec/proxmox_vcr.rb +0 -7
- metadata +19 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 72c9c0184ad5eeb569e93c6c87efb86878b9dd1f9cf3b721366c29bd433a756a
|
4
|
+
data.tar.gz: 99a1b6d7dc83eabb4ce9270bc8d059b24545de8ddecb4ecaf2b299ade4c1714b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '08a0bf25cec3bd9096edea232740dfc39552a1a89c0c4b63fb80392b96cb53fe601779faf956610d4107bf84093180c949c48ce868715135ab1aef0ca9bae49a'
|
7
|
+
data.tar.gz: d073370e33a01afc0db3cb3d97309e7e30d914241bb61016a37fea371e9749d68213f64d188da46c15a91bcb69b8e0bbb666acc29dc9bd7fcc097d47a3f82819
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
fog-proxmox (0.8.
|
4
|
+
fog-proxmox (0.8.1)
|
5
5
|
fog-core (~> 2.1)
|
6
6
|
fog-json (~> 1.2)
|
7
7
|
ipaddress (~> 0.8)
|
@@ -9,14 +9,17 @@ PATH
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
addressable (2.
|
13
|
-
public_suffix (>= 2.0.2, <
|
12
|
+
addressable (2.7.0)
|
13
|
+
public_suffix (>= 2.0.2, < 5.0)
|
14
14
|
ast (2.4.0)
|
15
15
|
axiom-types (0.1.1)
|
16
16
|
descendants_tracker (~> 0.0.4)
|
17
17
|
ice_nine (~> 0.11.0)
|
18
18
|
thread_safe (~> 0.3, >= 0.3.1)
|
19
19
|
builder (3.2.3)
|
20
|
+
bundler-audit (0.6.1)
|
21
|
+
bundler (>= 1.2.0, < 3)
|
22
|
+
thor (~> 0.18)
|
20
23
|
codeclimate-engine-rb (0.4.1)
|
21
24
|
virtus (~> 1.0)
|
22
25
|
coderay (1.1.2)
|
@@ -25,20 +28,20 @@ GEM
|
|
25
28
|
colorize (0.8.1)
|
26
29
|
crack (0.4.3)
|
27
30
|
safe_yaml (~> 1.0.0)
|
28
|
-
debase (0.2.
|
31
|
+
debase (0.2.4.1)
|
29
32
|
debase-ruby_core_source (>= 0.10.2)
|
30
|
-
debase-ruby_core_source (0.10.
|
31
|
-
debride (1.8.
|
33
|
+
debase-ruby_core_source (0.10.6)
|
34
|
+
debride (1.8.2)
|
32
35
|
path_expander (~> 1.0)
|
33
36
|
ruby_parser (~> 3.6)
|
34
37
|
sexp_processor (~> 4.5)
|
35
38
|
descendants_tracker (0.0.4)
|
36
39
|
thread_safe (~> 0.3, >= 0.3.1)
|
37
40
|
diff-lcs (1.3)
|
38
|
-
docile (1.3.
|
41
|
+
docile (1.3.2)
|
39
42
|
equalizer (0.0.11)
|
40
|
-
excon (0.
|
41
|
-
fasterer (0.
|
43
|
+
excon (0.68.0)
|
44
|
+
fasterer (0.7.1)
|
42
45
|
colorize (~> 0.7)
|
43
46
|
ruby_parser (>= 3.13.0)
|
44
47
|
fastri (0.3.1.1)
|
@@ -51,64 +54,65 @@ GEM
|
|
51
54
|
fog-core
|
52
55
|
multi_json (~> 1.10)
|
53
56
|
formatador (0.2.5)
|
54
|
-
hashdiff (0.
|
57
|
+
hashdiff (1.0.0)
|
55
58
|
ice_nine (0.11.2)
|
56
59
|
ipaddress (0.8.3)
|
57
|
-
jaro_winkler (1.5.
|
60
|
+
jaro_winkler (1.5.3)
|
58
61
|
json (2.2.0)
|
59
62
|
method_source (0.9.2)
|
60
|
-
mime-types (3.
|
63
|
+
mime-types (3.3)
|
61
64
|
mime-types-data (~> 3.2015)
|
62
|
-
mime-types-data (3.2019.
|
63
|
-
minitest (5.
|
64
|
-
multi_json (1.
|
65
|
-
parallel (1.
|
65
|
+
mime-types-data (3.2019.1009)
|
66
|
+
minitest (5.12.2)
|
67
|
+
multi_json (1.14.1)
|
68
|
+
parallel (1.18.0)
|
66
69
|
parser (2.5.3.0)
|
67
70
|
ast (~> 2.4.0)
|
68
|
-
path_expander (1.0
|
71
|
+
path_expander (1.1.0)
|
69
72
|
pry (0.12.2)
|
70
73
|
coderay (~> 1.1.0)
|
71
74
|
method_source (~> 0.9.0)
|
72
|
-
public_suffix (
|
75
|
+
public_suffix (4.0.1)
|
73
76
|
rainbow (3.0.0)
|
74
|
-
rake (12.3.
|
77
|
+
rake (12.3.3)
|
75
78
|
rcodetools (0.8.5.0)
|
76
79
|
reek (4.8.2)
|
77
80
|
codeclimate-engine-rb (~> 0.4.0)
|
78
81
|
parser (>= 2.5.0.0, < 2.6)
|
79
82
|
rainbow (>= 2.0, < 4.0)
|
80
|
-
rspec (3.
|
81
|
-
rspec-core (~> 3.
|
82
|
-
rspec-expectations (~> 3.
|
83
|
-
rspec-mocks (~> 3.
|
84
|
-
rspec-core (3.
|
85
|
-
rspec-support (~> 3.
|
86
|
-
rspec-expectations (3.
|
83
|
+
rspec (3.9.0)
|
84
|
+
rspec-core (~> 3.9.0)
|
85
|
+
rspec-expectations (~> 3.9.0)
|
86
|
+
rspec-mocks (~> 3.9.0)
|
87
|
+
rspec-core (3.9.0)
|
88
|
+
rspec-support (~> 3.9.0)
|
89
|
+
rspec-expectations (3.9.0)
|
87
90
|
diff-lcs (>= 1.2.0, < 2.0)
|
88
|
-
rspec-support (~> 3.
|
89
|
-
rspec-mocks (3.
|
91
|
+
rspec-support (~> 3.9.0)
|
92
|
+
rspec-mocks (3.9.0)
|
90
93
|
diff-lcs (>= 1.2.0, < 2.0)
|
91
|
-
rspec-support (~> 3.
|
92
|
-
rspec-support (3.
|
93
|
-
rubocop (0.68.
|
94
|
+
rspec-support (~> 3.9.0)
|
95
|
+
rspec-support (3.9.0)
|
96
|
+
rubocop (0.68.1)
|
94
97
|
jaro_winkler (~> 1.5.1)
|
95
98
|
parallel (~> 1.10)
|
96
99
|
parser (>= 2.5, != 2.5.1.1)
|
97
100
|
rainbow (>= 2.2.2, < 4.0)
|
98
101
|
ruby-progressbar (~> 1.7)
|
99
102
|
unicode-display_width (>= 1.4.0, < 1.6)
|
100
|
-
ruby-debug-ide (0.
|
103
|
+
ruby-debug-ide (0.7.0)
|
101
104
|
rake (>= 0.8.1)
|
102
|
-
ruby-progressbar (1.10.
|
103
|
-
ruby_parser (3.
|
105
|
+
ruby-progressbar (1.10.1)
|
106
|
+
ruby_parser (3.14.0)
|
104
107
|
sexp_processor (~> 4.9)
|
105
108
|
safe_yaml (1.0.5)
|
106
|
-
sexp_processor (4.
|
107
|
-
simplecov (0.
|
109
|
+
sexp_processor (4.13.0)
|
110
|
+
simplecov (0.17.1)
|
108
111
|
docile (~> 1.1)
|
109
112
|
json (>= 1.8, < 3)
|
110
113
|
simplecov-html (~> 0.10.0)
|
111
114
|
simplecov-html (0.10.2)
|
115
|
+
thor (0.20.3)
|
112
116
|
thread_safe (0.3.6)
|
113
117
|
unicode-display_width (1.5.0)
|
114
118
|
vcr (4.0.0)
|
@@ -117,16 +121,17 @@ GEM
|
|
117
121
|
coercible (~> 1.0)
|
118
122
|
descendants_tracker (~> 0.0, >= 0.0.3)
|
119
123
|
equalizer (~> 0.0, >= 0.0.9)
|
120
|
-
webmock (3.
|
124
|
+
webmock (3.7.6)
|
121
125
|
addressable (>= 2.3.6)
|
122
126
|
crack (>= 0.3.2)
|
123
|
-
hashdiff
|
127
|
+
hashdiff (>= 0.4.0, < 2.0.0)
|
124
128
|
|
125
129
|
PLATFORMS
|
126
130
|
ruby
|
127
131
|
|
128
132
|
DEPENDENCIES
|
129
133
|
bundler (~> 2.0)
|
134
|
+
bundler-audit (~> 0.6)
|
130
135
|
debase (~> 0.2.2)
|
131
136
|
debride (~> 1.8)
|
132
137
|
fasterer (~> 0.3)
|
@@ -145,4 +150,4 @@ DEPENDENCIES
|
|
145
150
|
webmock (~> 3.5)
|
146
151
|
|
147
152
|
BUNDLED WITH
|
148
|
-
2.0.
|
153
|
+
2.0.2
|
data/Rakefile
CHANGED
@@ -20,7 +20,9 @@
|
|
20
20
|
require 'bundler/gem_tasks'
|
21
21
|
require 'rubocop/rake_task'
|
22
22
|
require 'rake/testtask'
|
23
|
+
require 'bundler/audit/task'
|
23
24
|
|
25
|
+
Bundler::Audit::Task.new
|
24
26
|
RuboCop::RakeTask.new
|
25
27
|
|
26
28
|
task default: :test
|
@@ -34,6 +36,9 @@ end
|
|
34
36
|
desc 'Run fog-proxmox spec/ tests (VCR)'
|
35
37
|
task spec: 'tests:spec'
|
36
38
|
|
39
|
+
desc 'Run audit vulnerabilities'
|
40
|
+
task audit: 'bundle:audit'
|
41
|
+
|
37
42
|
namespace :tests do
|
38
43
|
desc 'Run fog-proxmox test/'
|
39
44
|
Rake::TestTask.new do |t|
|
data/fog-proxmox.gemspec
CHANGED
@@ -55,6 +55,7 @@ Gem::Specification.new do |spec|
|
|
55
55
|
spec.add_development_dependency 'simplecov'
|
56
56
|
spec.add_development_dependency 'vcr', '~> 4.0'
|
57
57
|
spec.add_development_dependency 'webmock', '~> 3.5'
|
58
|
+
spec.add_development_dependency 'bundler-audit', '~> 0.6'
|
58
59
|
|
59
60
|
spec.add_dependency 'fog-core', '~> 2.1'
|
60
61
|
spec.add_dependency 'fog-json', '~> 1.2'
|
data/lib/fog/identity/proxmox.rb
CHANGED
@@ -19,6 +19,7 @@
|
|
19
19
|
# frozen_string_literal: true
|
20
20
|
|
21
21
|
require 'fog/core'
|
22
|
+
require 'fog/proxmox/string'
|
22
23
|
|
23
24
|
module Fog
|
24
25
|
module Proxmox
|
@@ -108,6 +109,9 @@ module Fog
|
|
108
109
|
authenticate
|
109
110
|
@persistent = options[:persistent] || false
|
110
111
|
url = "#{@scheme}://#{@host}:#{@port}"
|
112
|
+
if ENV.has_key?('SSL_VERIFY_PEER')
|
113
|
+
Excon.defaults[:ssl_verify_peer] = Fog::Proxmox::String.to_boolean(ENV['SSL_VERIFY_PEER'])
|
114
|
+
end
|
111
115
|
@connection = Fog::Core::Connection.new(url, @persistent, @connection_options.merge(path_prefix: @path_prefix))
|
112
116
|
end
|
113
117
|
|
data/lib/fog/proxmox.rb
CHANGED
@@ -91,13 +91,11 @@ module Fog
|
|
91
91
|
method: 'POST',
|
92
92
|
path: 'access/ticket'
|
93
93
|
}
|
94
|
-
|
95
94
|
connection = Fog::Core::Connection.new(
|
96
95
|
uri.to_s,
|
97
96
|
false,
|
98
97
|
connection_options
|
99
98
|
)
|
100
|
-
|
101
99
|
response = connection.request(request)
|
102
100
|
data = Json.get_data(response)
|
103
101
|
ticket = data['ticket']
|
@@ -21,27 +21,21 @@ module Fog
|
|
21
21
|
module Proxmox
|
22
22
|
# module Cpu mixins
|
23
23
|
module CpuHelper
|
24
|
-
|
25
|
-
|
26
|
-
cpu
|
24
|
+
CPU_REGEXP = /(\bcputype=)?(\w+)[,]?(\bflags=)?(\+[\w-]+)?[;]?(\+[\w-]+)?/
|
25
|
+
def self.extract(cpu,i)
|
26
|
+
cpu.match(CPU_REGEXP)[i]
|
27
27
|
end
|
28
28
|
|
29
29
|
def self.extract_type(cpu)
|
30
|
-
|
31
|
-
cpu_a[1] unless cpu_a.empty? || cpu_a.size < 2
|
30
|
+
extract(cpu,2)
|
32
31
|
end
|
33
32
|
|
34
|
-
def self.
|
35
|
-
|
33
|
+
def self.has_pcid?(cpu)
|
34
|
+
extract(cpu,5) == '+pcid'
|
36
35
|
end
|
37
36
|
|
38
|
-
def self.
|
39
|
-
|
40
|
-
end
|
41
|
-
|
42
|
-
def self.has?(value, cpu)
|
43
|
-
cpu_a = extract(cpu)
|
44
|
-
cpu_a.include? value
|
37
|
+
def self.has_spectre?(cpu)
|
38
|
+
extract(cpu,4) == '+spec-ctrl'
|
45
39
|
end
|
46
40
|
end
|
47
41
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2018 Tristan Robert
|
4
|
+
|
5
|
+
# This file is part of Fog::Proxmox.
|
6
|
+
|
7
|
+
# Fog::Proxmox is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
|
12
|
+
# Fog::Proxmox is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with Fog::Proxmox. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
|
20
|
+
module Fog
|
21
|
+
module Proxmox
|
22
|
+
# module String mixins
|
23
|
+
module String
|
24
|
+
def self.to_boolean(text)
|
25
|
+
return true if text == true || text =~ (/(true|t|yes|y|1)$/i)
|
26
|
+
return false if text == false || text.empty? || text =~ (/(false|f|no|n|0)$/i)
|
27
|
+
raise ArgumentError.new("invalid value for Boolean: \"#{text}\"")
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/fog/proxmox/version.rb
CHANGED
@@ -0,0 +1,27 @@
|
|
1
|
+
-----BEGIN CERTIFICATE-----
|
2
|
+
MIIEqjCCApKgAwIBAgIBATANBgkqhkiG9w0BAQsFADB2MSQwIgYDVQQDDBtQcm94
|
3
|
+
bW94IFZpcnR1YWwgRW52aXJvbm1lbnQxLTArBgNVBAsMJDNlMmQ4NDIzLTliZTQt
|
4
|
+
NDUwZC1hODQ1LTU5N2YxNDI2MmNmZjEfMB0GA1UECgwWUFZFIENsdXN0ZXIgTWFu
|
5
|
+
YWdlciBDQTAeFw0xOTA0MjYxMjA3NDFaFw0yOTA0MjMxMjA3NDFaMFQxGTAXBgNV
|
6
|
+
BAsTEFBWRSBDbHVzdGVyIE5vZGUxJDAiBgNVBAoTG1Byb3htb3ggVmlydHVhbCBF
|
7
|
+
bnZpcm9ubWVudDERMA8GA1UEAxMIcHZlLmhvbWUwggEiMA0GCSqGSIb3DQEBAQUA
|
8
|
+
A4IBDwAwggEKAoIBAQDAbgysxUY0hGRhkWzTNyJBLMFZdZZklfSEZ+rvSe5XOPa/
|
9
|
+
A57/ztcBV52D/+xd9KMfELcTs8kZkjJi+jAWopo3ZxvuSbf1BdGY7Z9orgSGL66a
|
10
|
+
HH9lTRBo8BPmwSPnRBbZRVq99raSk0yMDppEhN/UohXmpvyprSblw9bN+c0NoZMS
|
11
|
+
bQo+lcrE8Us35ss4cR9XbuH2QUknBeIKGJpY+dXf+fVjR4CQFxkH/2la3Gvrgv5m
|
12
|
+
/L0H6Uj+mseDRwNHajlSrD3iSlL+FF0JDnDPXYQbKRkkVXIDj3eCOpn+eTwfX5Wc
|
13
|
+
aj8xenNF79q2uMp2d1YKuQ4gakvImt6i+2y2oxZBAgMBAAGjZTBjMAkGA1UdEwQC
|
14
|
+
MAAwEwYDVR0lBAwwCgYIKwYBBQUHAwEwQQYDVR0RBDowOIcEfwAAAYcQAAAAAAAA
|
15
|
+
AAAAAAAAAAAAAYIJbG9jYWxob3N0hwTAqDhlggNwdmWCCHB2ZS5ob21lMA0GCSqG
|
16
|
+
SIb3DQEBCwUAA4ICAQCEx5jgVYo1ERT6R2z4EugBVVU4opNNnv8tkYPypjn9lDd0
|
17
|
+
DePuA4GroLwYG7UXeuafBAWuJ3EYlmMI1FQ6fzmS3PzuueRkQHSXwI2yxfoTBKDN
|
18
|
+
/mN4eslsCgH4UxIUuFpFphciB2g18sU+CgvsKxM26Cu3g7DrzJJhcj5qj1jt/IyA
|
19
|
+
PuIEHjvab7/OlSwWkn9f4QxfAo+MdSWZ+tYKdFIa/WBsZNJ4DTOC8nR9SZJH/pzO
|
20
|
+
vFiamxZQA4yWYazKD3K+Uc78M29V5sWfom/LU7F2w/vm7xm1tDXrz6LpMwFSzzZN
|
21
|
+
ywMYt1qxg+gqBX4bdHTmz0fMSpKihwWV9b8RFlq4vVogC4tpSCn4ORGESej2uK8s
|
22
|
+
rpCSFxh6wX4oWdLBkhqvczk72dd8yiCO1rv80P+n9QBfsbZx6R582u4atUY9p+Kp
|
23
|
+
QBfuBNROMyC8zBNUC4oiOi5Ew5UL2yWm7h1Oi82ilQz54vlg1OS070Nj2rP2hi52
|
24
|
+
a0tF/E4QFehz5mOuJ8J8KYKcNuIFWMcj2ts7tIuseXOcnZkyzjJzrZNe+6lCtu7V
|
25
|
+
3mN1lf/dPHDAjLOx2oiJmEEUPOYtl6kgJm2lSXEzNhWNBk9gom/LcYJSRxrNbwP2
|
26
|
+
2ip8qCzM+ozuNuCXlB7q9WcnN8BV+2olhBWF3Smsg5XM+QTwidGqhmiMozLTVA==
|
27
|
+
-----END CERTIFICATE-----
|
data/spec/hash_spec.rb
CHANGED
@@ -1,43 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Copyright 2018 Tristan Robert
|
4
|
-
|
5
|
-
# This file is part of Fog::Proxmox.
|
6
|
-
|
7
|
-
# Fog::Proxmox is free software: you can redistribute it and/or modify
|
8
|
-
# it under the terms of the GNU General Public License as published by
|
9
|
-
# the Free Software Foundation, either version 3 of the License, or
|
10
|
-
# (at your option) any later version.
|
11
|
-
|
12
|
-
# Fog::Proxmox is distributed in the hope that it will be useful,
|
13
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
-
# GNU General Public License for more details.
|
16
|
-
|
17
|
-
# You should have received a copy of the GNU General Public License
|
18
|
-
# along with Fog::Proxmox. If not, see <http://www.gnu.org/licenses/>.
|
19
|
-
|
20
|
-
require 'spec_helper'
|
21
|
-
require 'fog/proxmox/hash'
|
22
|
-
|
23
|
-
describe Fog::Proxmox::Hash do
|
24
|
-
|
25
|
-
let(:net_vm) do
|
26
|
-
{ net0: 'virtio=66:89:C5:59:AA:96,bridge=vmbr0,firewall=1,link_down=1,queues=1,rate=1,tag=1' }
|
27
|
-
end
|
28
|
-
let(:net) do
|
29
|
-
{ id: 'net0', model: 'virtio', macaddr: '66:89:C5:59:AA:96', z: nil }
|
30
|
-
end
|
31
|
-
|
32
|
-
describe '#flatten' do
|
33
|
-
it "returns string net_vm" do
|
34
|
-
assert_equal 'net0: virtio=66:89:C5:59:AA:96,bridge=vmbr0,firewall=1,link_down=1,queues=1,rate=1,tag=1', Fog::Proxmox::Hash.flatten(net_vm)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
describe '#stringify' do
|
39
|
-
it "returns stringify hash" do
|
40
|
-
assert_equal 'id=net0,model=virtio,macaddr=66:89:C5:59:AA:96', Fog::Proxmox::Hash.stringify(net)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
@@ -35,27 +35,6 @@ require 'fog/proxmox/helpers/cpu_helper'
|
|
35
35
|
'cputype=kvm64,flags=+spec-ctrl'
|
36
36
|
end
|
37
37
|
|
38
|
-
describe '#extract' do
|
39
|
-
it "returns array" do
|
40
|
-
result = Fog::Proxmox::CpuHelper.extract(cpu)
|
41
|
-
assert_equal(5, result.length)
|
42
|
-
assert_equal('cputype=', result[0])
|
43
|
-
assert_equal('kvm64', result[1])
|
44
|
-
assert_equal(',flags=', result[2])
|
45
|
-
assert_equal('+spec-ctrl', result[3])
|
46
|
-
assert_equal('+pcid', result[4])
|
47
|
-
end
|
48
|
-
it "returns array" do
|
49
|
-
result = Fog::Proxmox::CpuHelper.extract(cpu_nocputype)
|
50
|
-
assert_equal(5, result.length)
|
51
|
-
assert !result[0]
|
52
|
-
assert_equal('kvm64', result[1])
|
53
|
-
assert_equal(',flags=', result[2])
|
54
|
-
assert_equal('+spec-ctrl', result[3])
|
55
|
-
assert_equal('+pcid', result[4])
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
38
|
describe '#extract_type' do
|
60
39
|
it "returns string" do
|
61
40
|
result = Fog::Proxmox::CpuHelper.extract_type(cpu)
|
@@ -67,24 +46,24 @@ require 'fog/proxmox/helpers/cpu_helper'
|
|
67
46
|
end
|
68
47
|
end
|
69
48
|
|
70
|
-
describe '#
|
49
|
+
describe '#has_spectre?' do
|
71
50
|
it "returns true" do
|
72
|
-
result = Fog::Proxmox::CpuHelper.
|
51
|
+
result = Fog::Proxmox::CpuHelper.has_spectre?(cpu)
|
73
52
|
assert result
|
74
53
|
end
|
75
54
|
it "returns false" do
|
76
|
-
result = Fog::Proxmox::CpuHelper.
|
55
|
+
result = Fog::Proxmox::CpuHelper.has_spectre?(cpu_nospectre)
|
77
56
|
assert !result
|
78
57
|
end
|
79
58
|
end
|
80
59
|
|
81
|
-
describe '#
|
60
|
+
describe '#has_pcid?' do
|
82
61
|
it "returns true" do
|
83
|
-
result = Fog::Proxmox::CpuHelper.
|
62
|
+
result = Fog::Proxmox::CpuHelper.has_pcid?(cpu)
|
84
63
|
assert result
|
85
64
|
end
|
86
65
|
it "returns false" do
|
87
|
-
result = Fog::Proxmox::CpuHelper.
|
66
|
+
result = Fog::Proxmox::CpuHelper.has_pcid?(cpu_nopcid)
|
88
67
|
assert !result
|
89
68
|
end
|
90
69
|
end
|
data/spec/identity_spec.rb
CHANGED
@@ -22,6 +22,7 @@ require_relative './proxmox_vcr'
|
|
22
22
|
|
23
23
|
describe Fog::Proxmox::Identity do
|
24
24
|
before :all do
|
25
|
+
Excon.defaults[:ssl_ca_file] = 'spec/fixtures/proxmox/pve.home'
|
25
26
|
@proxmox_vcr = ProxmoxVCR.new(
|
26
27
|
vcr_directory: 'spec/fixtures/proxmox/identity',
|
27
28
|
service_class: Fog::Proxmox::Identity
|
@@ -30,19 +31,6 @@ describe Fog::Proxmox::Identity do
|
|
30
31
|
@pve_url = @proxmox_vcr.url
|
31
32
|
@username = @proxmox_vcr.username
|
32
33
|
@password = @proxmox_vcr.password
|
33
|
-
@ticket = @proxmox_vcr.ticket
|
34
|
-
@csrftoken = @proxmox_vcr.csrftoken
|
35
|
-
end
|
36
|
-
|
37
|
-
it 'authenticates with username and password' do
|
38
|
-
VCR.use_cassette('auth') do
|
39
|
-
identity = Fog::Proxmox::Identity.new(
|
40
|
-
pve_username: @username,
|
41
|
-
pve_password: @password,
|
42
|
-
pve_url: @pve_url.to_s
|
43
|
-
)
|
44
|
-
identity.wont_be_nil
|
45
|
-
end
|
46
34
|
end
|
47
35
|
|
48
36
|
it 'verifies ticket with path and privs' do
|
data/spec/proxmox_vcr.rb
CHANGED
@@ -76,23 +76,16 @@ class ProxmoxVCR
|
|
76
76
|
|
77
77
|
@username = 'root@pam'
|
78
78
|
@password = 'proxmox01'
|
79
|
-
# ticket recorded in identity_ticket.yml
|
80
|
-
@ticket = 'PVE:root@pam:5AB4B38A::m5asyATnV66Htv+Z2QYNu+KuqZDsR1t3fCViuu0bTAWYfU85zdUY2dF9lJXa7soWlaZ3tZriTxC7d+nhMq9Fq8hCRlNG4ntsEw/CzeuS50phSvq4Phx1uZVV0KjkdcVP1X0J50e42Zfr5hzptiO+cD68OF2GG0GaboQ/MV+PA5IxojYojQe1w6yjjzreZhiZYy9zq1W5CW23yIt5pPWk9oFxLNUHU1I2+jqMCOeE40VhivCUEslusD0ZdoA3tkIWJ504rKQJrJIsq1zi6LIpGsktkbUPxHwSgnftQs0IPRuP5HGaz1g9FSW1IUpC8iCHqEV6re+Pb9Yz+G1G7+G0TQ=='
|
81
|
-
@csrftoken = '5AB4B38A:J+3XBmYsJqR7F+18kqbMhj6I/SM'
|
82
79
|
|
83
80
|
unless use_recorded
|
84
81
|
@username = ENV['PVE_USERNAME'] || options[:username] || @username
|
85
82
|
@password = ENV['PVE_PASSWORD'] || options[:password] || @password
|
86
|
-
@ticket = ENV['PVE_TICKET'] || options[:ticket] || @ticket
|
87
|
-
@csrftoken = ENV['PVE_CSRFTOKEN'] || options[:csrftoken] || @csrftoken
|
88
83
|
end
|
89
84
|
|
90
85
|
connection_params = {
|
91
86
|
pve_url: @url,
|
92
87
|
pve_username: @username,
|
93
88
|
pve_password: @password,
|
94
|
-
pve_ticket: @ticket,
|
95
|
-
pve_csrftoken: @csrftoken,
|
96
89
|
connection_options: @connection_options
|
97
90
|
}
|
98
91
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fog-proxmox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tristan Robert
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -234,6 +234,20 @@ dependencies:
|
|
234
234
|
- - "~>"
|
235
235
|
- !ruby/object:Gem::Version
|
236
236
|
version: '3.5'
|
237
|
+
- !ruby/object:Gem::Dependency
|
238
|
+
name: bundler-audit
|
239
|
+
requirement: !ruby/object:Gem::Requirement
|
240
|
+
requirements:
|
241
|
+
- - "~>"
|
242
|
+
- !ruby/object:Gem::Version
|
243
|
+
version: '0.6'
|
244
|
+
type: :development
|
245
|
+
prerelease: false
|
246
|
+
version_requirements: !ruby/object:Gem::Requirement
|
247
|
+
requirements:
|
248
|
+
- - "~>"
|
249
|
+
- !ruby/object:Gem::Version
|
250
|
+
version: '0.6'
|
237
251
|
- !ruby/object:Gem::Dependency
|
238
252
|
name: fog-core
|
239
253
|
requirement: !ruby/object:Gem::Requirement
|
@@ -441,6 +455,7 @@ files:
|
|
441
455
|
- lib/fog/proxmox/helpers/disk_helper.rb
|
442
456
|
- lib/fog/proxmox/helpers/nic_helper.rb
|
443
457
|
- lib/fog/proxmox/json.rb
|
458
|
+
- lib/fog/proxmox/string.rb
|
444
459
|
- lib/fog/proxmox/variables.rb
|
445
460
|
- lib/fog/proxmox/version.rb
|
446
461
|
- lib/fog/storage/proxmox.rb
|
@@ -463,6 +478,7 @@ files:
|
|
463
478
|
- spec/fixtures/proxmox/identity/users.yml
|
464
479
|
- spec/fixtures/proxmox/network/identity_ticket.yml
|
465
480
|
- spec/fixtures/proxmox/network/networks.yml
|
481
|
+
- spec/fixtures/proxmox/pve.home
|
466
482
|
- spec/hash_spec.rb
|
467
483
|
- spec/helpers/controller_helper_spec.rb
|
468
484
|
- spec/helpers/cpu_helper_spec.rb
|
@@ -515,6 +531,7 @@ test_files:
|
|
515
531
|
- spec/fixtures/proxmox/identity/users.yml
|
516
532
|
- spec/fixtures/proxmox/network/identity_ticket.yml
|
517
533
|
- spec/fixtures/proxmox/network/networks.yml
|
534
|
+
- spec/fixtures/proxmox/pve.home
|
518
535
|
- spec/hash_spec.rb
|
519
536
|
- spec/helpers/controller_helper_spec.rb
|
520
537
|
- spec/helpers/cpu_helper_spec.rb
|