vcloud-core 0.10.0 → 0.11.0
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.
- data/CHANGELOG.md +8 -0
- data/lib/vcloud/core/fog.rb +11 -9
- data/lib/vcloud/core/fog/login.rb +1 -8
- data/lib/vcloud/core/version.rb +1 -1
- data/spec/integration/core/fog/login_spec.rb +51 -13
- data/spec/vcloud/core/fog/login_spec.rb +1 -2
- metadata +25 -77
- data/spec/integration/core/fog/login_manual.rb +0 -47
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
## 0.11.0 (2014-09-11)
|
2
|
+
|
3
|
+
Changes:
|
4
|
+
|
5
|
+
- As deprecated in 0.7.0, it is now impossible to specify a plaintext
|
6
|
+
password in a FOG_RC file. Please use tokens via vcloud-login as per
|
7
|
+
the documentation: http://gds-operations.github.io/vcloud-tools/usage/
|
8
|
+
|
1
9
|
## 0.10.0 (2014-08-11)
|
2
10
|
|
3
11
|
API changes:
|
data/lib/vcloud/core/fog.rb
CHANGED
@@ -11,15 +11,7 @@ module Vcloud
|
|
11
11
|
FOG_CREDS_PASS_NAME = :vcloud_director_password
|
12
12
|
|
13
13
|
def self.check_credentials
|
14
|
-
|
15
|
-
unless pass.nil? or pass.empty?
|
16
|
-
warn <<EOF
|
17
|
-
[WARNING] Storing :vcloud_director_password in your plaintext FOG_RC file is
|
18
|
-
insecure. Future releases of vcloud-core (and tools that depend on
|
19
|
-
it) will prevent you from doing this. Please use vcloud-login to
|
20
|
-
get a session token instead.
|
21
|
-
EOF
|
22
|
-
end
|
14
|
+
check_plaintext_pass
|
23
15
|
end
|
24
16
|
|
25
17
|
def self.fog_credentials_pass
|
@@ -33,6 +25,16 @@ EOF
|
|
33
25
|
|
34
26
|
pass
|
35
27
|
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def self.check_plaintext_pass
|
32
|
+
pass = fog_credentials_pass
|
33
|
+
unless pass.nil? or pass.empty?
|
34
|
+
raise "Found plaintext #{Vcloud::Core::Fog::FOG_CREDS_PASS_NAME} entry. Please set it to an empty string as storing passwords in plaintext is insecure. See http://gds-operations.github.io/vcloud-tools/usage/ for further information."
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
36
38
|
end
|
37
39
|
end
|
38
40
|
end
|
@@ -6,7 +6,7 @@ module Vcloud
|
|
6
6
|
module Login
|
7
7
|
class << self
|
8
8
|
def token(pass)
|
9
|
-
|
9
|
+
Vcloud::Core::Fog.check_credentials
|
10
10
|
token = get_token(pass)
|
11
11
|
|
12
12
|
return token
|
@@ -18,13 +18,6 @@ module Vcloud
|
|
18
18
|
|
19
19
|
private
|
20
20
|
|
21
|
-
def check_plaintext_pass
|
22
|
-
pass = Vcloud::Core::Fog::fog_credentials_pass
|
23
|
-
unless pass.nil? || pass.empty?
|
24
|
-
raise "Found plaintext #{Vcloud::Core::Fog::FOG_CREDS_PASS_NAME} entry. Please set it to an empty string"
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
21
|
def get_token(pass)
|
29
22
|
ENV.delete(Vcloud::Core::Fog::TOKEN_ENV_VAR_NAME)
|
30
23
|
vcloud = ::Fog::Compute::VcloudDirector.new({
|
data/lib/vcloud/core/version.rb
CHANGED
@@ -1,22 +1,22 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Vcloud::Core::Fog::Login do
|
4
|
-
|
5
|
-
|
4
|
+
describe "#token" do
|
5
|
+
context "unable to load credentials" do
|
6
|
+
before(:each) do
|
7
|
+
stub_const('ENV', {})
|
6
8
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
@orig_credential = ::Fog.credential
|
10
|
+
::Fog.credential = 'null'
|
11
|
+
@orig_credentials_path = ::Fog.credentials_path
|
12
|
+
::Fog.credentials_path = '/dev/null'
|
13
|
+
end
|
12
14
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
15
|
+
after(:each) do
|
16
|
+
::Fog.credential = @orig_credential
|
17
|
+
::Fog.credentials_path = @orig_credentials_path
|
18
|
+
end
|
17
19
|
|
18
|
-
describe "#token" do
|
19
|
-
context "unable to load credentials" do
|
20
20
|
it "should raise an exception succinctly listing the missing credentials" do
|
21
21
|
# This test is known to fail with a TypeError due to a bug in Ruby 1.9.3 that
|
22
22
|
# has since been fixed. See https://github.com/gds-operations/vcloud-core/pull/100
|
@@ -30,5 +30,43 @@ describe Vcloud::Core::Fog::Login do
|
|
30
30
|
)
|
31
31
|
end
|
32
32
|
end
|
33
|
+
|
34
|
+
context "fog credentials without password" do
|
35
|
+
let(:token_length) { 44 }
|
36
|
+
let(:envvar_token) { 'FOG_VCLOUD_TOKEN' }
|
37
|
+
let(:envvar_password) { 'API_PASSWORD' }
|
38
|
+
|
39
|
+
before(:each) do
|
40
|
+
@real_password = ENV[envvar_password]
|
41
|
+
stub_const('ENV', {})
|
42
|
+
end
|
43
|
+
|
44
|
+
context "environment variable VCLOUD_FOG_TOKEN not set" do
|
45
|
+
it "should login and return a token" do
|
46
|
+
unless @real_password
|
47
|
+
pending "Password not available from environment variable #{envvar_password}"
|
48
|
+
end
|
49
|
+
|
50
|
+
expect(ENV).not_to have_key(envvar_token)
|
51
|
+
token = subject.token(@real_password)
|
52
|
+
expect(token.size).to eq(token_length)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
context "environment variable VCLOUD_FOG_TOKEN is set" do
|
57
|
+
let(:old_token) { 'mekmitasdigoat' }
|
58
|
+
|
59
|
+
it "should login and return a token, ignoring the existing token" do
|
60
|
+
unless @real_password
|
61
|
+
pending "Password not available from environment variable #{envvar_password}"
|
62
|
+
end
|
63
|
+
|
64
|
+
ENV[envvar_token] = old_token
|
65
|
+
new_token = subject.token(@real_password)
|
66
|
+
expect(new_token).to_not eq(old_token)
|
67
|
+
expect(new_token.size).to eq(token_length)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
33
71
|
end
|
34
72
|
end
|
@@ -4,7 +4,6 @@ require 'stringio'
|
|
4
4
|
describe Vcloud::Core::Fog::Login do
|
5
5
|
describe "#token" do
|
6
6
|
it "should return the output from get_token" do
|
7
|
-
expect(subject).to receive(:check_plaintext_pass)
|
8
7
|
expect(subject).to receive(:get_token).and_return('mekmitasdigoat')
|
9
8
|
expect(subject.token('supersekret')).to eq("mekmitasdigoat")
|
10
9
|
end
|
@@ -40,7 +39,7 @@ describe Vcloud::Core::Fog::Login do
|
|
40
39
|
expect(subject).to_not receive(:get_token)
|
41
40
|
expect { subject.token('supersekret') }.to raise_error(
|
42
41
|
RuntimeError,
|
43
|
-
"Found plaintext vcloud_director_password entry. Please set it to an empty string"
|
42
|
+
"Found plaintext vcloud_director_password entry. Please set it to an empty string as storing passwords in plaintext is insecure. See http://gds-operations.github.io/vcloud-tools/usage/ for further information."
|
44
43
|
)
|
45
44
|
end
|
46
45
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vcloud-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-09-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fog
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirement: &5442080 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,15 +21,10 @@ dependencies:
|
|
21
21
|
version: 1.22.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ! '>='
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: 1.22.0
|
24
|
+
version_requirements: *5442080
|
30
25
|
- !ruby/object:Gem::Dependency
|
31
26
|
name: mustache
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
27
|
+
requirement: &5461800 !ruby/object:Gem::Requirement
|
33
28
|
none: false
|
34
29
|
requirements:
|
35
30
|
- - ! '>='
|
@@ -37,15 +32,10 @@ dependencies:
|
|
37
32
|
version: '0'
|
38
33
|
type: :runtime
|
39
34
|
prerelease: false
|
40
|
-
version_requirements:
|
41
|
-
none: false
|
42
|
-
requirements:
|
43
|
-
- - ! '>='
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: '0'
|
35
|
+
version_requirements: *5461800
|
46
36
|
- !ruby/object:Gem::Dependency
|
47
37
|
name: highline
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
38
|
+
requirement: &5459000 !ruby/object:Gem::Requirement
|
49
39
|
none: false
|
50
40
|
requirements:
|
51
41
|
- - ! '>='
|
@@ -53,31 +43,21 @@ dependencies:
|
|
53
43
|
version: '0'
|
54
44
|
type: :runtime
|
55
45
|
prerelease: false
|
56
|
-
version_requirements:
|
57
|
-
none: false
|
58
|
-
requirements:
|
59
|
-
- - ! '>='
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
46
|
+
version_requirements: *5459000
|
62
47
|
- !ruby/object:Gem::Dependency
|
63
48
|
name: gem_publisher
|
64
|
-
requirement: !ruby/object:Gem::Requirement
|
49
|
+
requirement: &5455320 !ruby/object:Gem::Requirement
|
65
50
|
none: false
|
66
51
|
requirements:
|
67
|
-
- -
|
52
|
+
- - =
|
68
53
|
- !ruby/object:Gem::Version
|
69
54
|
version: 1.2.0
|
70
55
|
type: :development
|
71
56
|
prerelease: false
|
72
|
-
version_requirements:
|
73
|
-
none: false
|
74
|
-
requirements:
|
75
|
-
- - '='
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
version: 1.2.0
|
57
|
+
version_requirements: *5455320
|
78
58
|
- !ruby/object:Gem::Dependency
|
79
59
|
name: pry
|
80
|
-
requirement: !ruby/object:Gem::Requirement
|
60
|
+
requirement: &5473200 !ruby/object:Gem::Requirement
|
81
61
|
none: false
|
82
62
|
requirements:
|
83
63
|
- - ! '>='
|
@@ -85,15 +65,10 @@ dependencies:
|
|
85
65
|
version: '0'
|
86
66
|
type: :development
|
87
67
|
prerelease: false
|
88
|
-
version_requirements:
|
89
|
-
none: false
|
90
|
-
requirements:
|
91
|
-
- - ! '>='
|
92
|
-
- !ruby/object:Gem::Version
|
93
|
-
version: '0'
|
68
|
+
version_requirements: *5473200
|
94
69
|
- !ruby/object:Gem::Dependency
|
95
70
|
name: rake
|
96
|
-
requirement: !ruby/object:Gem::Requirement
|
71
|
+
requirement: &5471980 !ruby/object:Gem::Requirement
|
97
72
|
none: false
|
98
73
|
requirements:
|
99
74
|
- - ! '>='
|
@@ -101,15 +76,10 @@ dependencies:
|
|
101
76
|
version: '0'
|
102
77
|
type: :development
|
103
78
|
prerelease: false
|
104
|
-
version_requirements:
|
105
|
-
none: false
|
106
|
-
requirements:
|
107
|
-
- - ! '>='
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
version: '0'
|
79
|
+
version_requirements: *5471980
|
110
80
|
- !ruby/object:Gem::Dependency
|
111
81
|
name: rspec
|
112
|
-
requirement: !ruby/object:Gem::Requirement
|
82
|
+
requirement: &5469500 !ruby/object:Gem::Requirement
|
113
83
|
none: false
|
114
84
|
requirements:
|
115
85
|
- - ~>
|
@@ -117,15 +87,10 @@ dependencies:
|
|
117
87
|
version: 2.14.1
|
118
88
|
type: :development
|
119
89
|
prerelease: false
|
120
|
-
version_requirements:
|
121
|
-
none: false
|
122
|
-
requirements:
|
123
|
-
- - ~>
|
124
|
-
- !ruby/object:Gem::Version
|
125
|
-
version: 2.14.1
|
90
|
+
version_requirements: *5469500
|
126
91
|
- !ruby/object:Gem::Dependency
|
127
92
|
name: rubocop
|
128
|
-
requirement: !ruby/object:Gem::Requirement
|
93
|
+
requirement: &5496580 !ruby/object:Gem::Requirement
|
129
94
|
none: false
|
130
95
|
requirements:
|
131
96
|
- - ~>
|
@@ -133,15 +98,10 @@ dependencies:
|
|
133
98
|
version: 0.23.0
|
134
99
|
type: :development
|
135
100
|
prerelease: false
|
136
|
-
version_requirements:
|
137
|
-
none: false
|
138
|
-
requirements:
|
139
|
-
- - ~>
|
140
|
-
- !ruby/object:Gem::Version
|
141
|
-
version: 0.23.0
|
101
|
+
version_requirements: *5496580
|
142
102
|
- !ruby/object:Gem::Dependency
|
143
103
|
name: simplecov
|
144
|
-
requirement: !ruby/object:Gem::Requirement
|
104
|
+
requirement: &5495720 !ruby/object:Gem::Requirement
|
145
105
|
none: false
|
146
106
|
requirements:
|
147
107
|
- - ~>
|
@@ -149,15 +109,10 @@ dependencies:
|
|
149
109
|
version: 0.7.1
|
150
110
|
type: :development
|
151
111
|
prerelease: false
|
152
|
-
version_requirements:
|
153
|
-
none: false
|
154
|
-
requirements:
|
155
|
-
- - ~>
|
156
|
-
- !ruby/object:Gem::Version
|
157
|
-
version: 0.7.1
|
112
|
+
version_requirements: *5495720
|
158
113
|
- !ruby/object:Gem::Dependency
|
159
114
|
name: vcloud-tools-tester
|
160
|
-
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirement: &5493500 !ruby/object:Gem::Requirement
|
161
116
|
none: false
|
162
117
|
requirements:
|
163
118
|
- - ~>
|
@@ -165,12 +120,7 @@ dependencies:
|
|
165
120
|
version: 0.2.0
|
166
121
|
type: :development
|
167
122
|
prerelease: false
|
168
|
-
version_requirements:
|
169
|
-
none: false
|
170
|
-
requirements:
|
171
|
-
- - ~>
|
172
|
-
- !ruby/object:Gem::Version
|
173
|
-
version: 0.2.0
|
123
|
+
version_requirements: *5493500
|
174
124
|
description: Core tools for interacting with VMware vCloud Director. Includes VCloud
|
175
125
|
Query, a light wrapper round the vCloud Query API.
|
176
126
|
email:
|
@@ -219,7 +169,6 @@ files:
|
|
219
169
|
- lib/vcloud/core/vm.rb
|
220
170
|
- spec/integration/README.md
|
221
171
|
- spec/integration/core/edge_gateway_spec.rb
|
222
|
-
- spec/integration/core/fog/login_manual.rb
|
223
172
|
- spec/integration/core/fog/login_spec.rb
|
224
173
|
- spec/integration/core/query_runner_spec.rb
|
225
174
|
- spec/integration/core/vapp_spec.rb
|
@@ -277,17 +226,16 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
277
226
|
version: '0'
|
278
227
|
segments:
|
279
228
|
- 0
|
280
|
-
hash:
|
229
|
+
hash: 728476648198716353
|
281
230
|
requirements: []
|
282
231
|
rubyforge_project:
|
283
|
-
rubygems_version: 1.8.
|
232
|
+
rubygems_version: 1.8.11
|
284
233
|
signing_key:
|
285
234
|
specification_version: 3
|
286
235
|
summary: Core tools for interacting with VMware vCloud Director
|
287
236
|
test_files:
|
288
237
|
- spec/integration/README.md
|
289
238
|
- spec/integration/core/edge_gateway_spec.rb
|
290
|
-
- spec/integration/core/fog/login_manual.rb
|
291
239
|
- spec/integration/core/fog/login_spec.rb
|
292
240
|
- spec/integration/core/query_runner_spec.rb
|
293
241
|
- spec/integration/core/vapp_spec.rb
|
@@ -1,47 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
# These tests, which confirm that the Fog internals are performing a login
|
4
|
-
# and returning a new token, are not run automatically because they conflict
|
5
|
-
# with the use of vcloud-login in CI. Because we're using vcloud-login all
|
6
|
-
# of our tests should fail if the behaviour of Fog changes. However these
|
7
|
-
# may came in useful when debugging such a scenario.
|
8
|
-
|
9
|
-
describe Vcloud::Core::Fog::Login do
|
10
|
-
let!(:mock_env) { ENV.clone }
|
11
|
-
|
12
|
-
before(:each) do
|
13
|
-
stub_const('ENV', mock_env)
|
14
|
-
end
|
15
|
-
|
16
|
-
describe "#token" do
|
17
|
-
context "fog credentials without password" do
|
18
|
-
let(:token_length) { 44 }
|
19
|
-
let(:env_var_name) { 'FOG_VCLOUD_TOKEN' }
|
20
|
-
let!(:mock_fog_creds) { ::Fog.credentials.clone }
|
21
|
-
|
22
|
-
before(:each) do
|
23
|
-
@real_password = mock_fog_creds.delete(:vcloud_director_password)
|
24
|
-
allow(::Fog).to receive(:credentials).and_return(mock_fog_creds)
|
25
|
-
end
|
26
|
-
|
27
|
-
context "environment variable VCLOUD_FOG_TOKEN not set" do
|
28
|
-
it "should login and return a token" do
|
29
|
-
mock_env.delete(env_var_name)
|
30
|
-
token = subject.token(@real_password)
|
31
|
-
expect(token.size).to eq(token_length)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
context "environment variable VCLOUD_FOG_TOKEN is set" do
|
36
|
-
let(:old_token) { 'mekmitasdigoat' }
|
37
|
-
|
38
|
-
it "should login and return a token, ignoring the existing token" do
|
39
|
-
mock_env[env_var_name] = old_token
|
40
|
-
new_token = subject.token(@real_password)
|
41
|
-
expect(new_token).to_not eq(old_token)
|
42
|
-
expect(new_token.size).to eq(token_length)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|