Skip to content

Commit

Permalink
Shift fog-vcloud-director version to 0.3.0
Browse files Browse the repository at this point in the history
With this commit we shift fog-vcloud-director version to 0.3.0 which
is fog-core 2.1.x compliant, but remains fog-core 1.45 compatible.

Also, we omit the explicit fog-core requirement in vmware's Gemfile
bacause we don't need it per se so we better let the fog-vcloud-director
install whatever it needs.

Fixes #319

Signed-off-by: Miha Pleško <miha.plesko@xlab.si>
  • Loading branch information
miha-plesko committed Sep 20, 2018
1 parent 8c4e0c2 commit 8be144d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
4 changes: 2 additions & 2 deletions app/models/manageiq/providers/vmware/manager_auth_mixin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def raw_connect(server, port, username, password, api_version = '5.5', validate
}
}

connect = Fog::Compute::VcloudDirector.new(params)
connect = Fog::VcloudDirector::Compute.new(params)
connection_rescue_block { validate_connection(connect) } if validate
connect
end
Expand All @@ -70,7 +70,7 @@ def connection_rescue_block

def translate_exception(err)
case err
when Fog::Compute::VcloudDirector::Unauthorized
when Fog::VcloudDirector::Compute::Unauthorized
MiqException::MiqInvalidCredentialsError.new "Login failed due to a bad username or password."
when Excon::Errors::Timeout
MiqException::MiqUnreachableError.new "Login attempt timed out"
Expand Down
3 changes: 1 addition & 2 deletions manageiq-providers-vmware.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ Gem::Specification.new do |s|

s.files = Dir["{app,config,lib}/**/*"]

s.add_dependency("fog-vcloud-director", ["~> 0.2.2"])
s.add_dependency "fog-core", "~>1.40"
s.add_dependency("fog-vcloud-director", ["~> 0.3.0"])
s.add_dependency "vmware_web_service", "~>0.3.0"
s.add_dependency "rbvmomi", "~>1.13.0"

Expand Down
8 changes: 4 additions & 4 deletions spec/models/manageiq/providers/vmware/cloud_manager_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@

it "decrypts the vcloud password" do
encrypted = MiqPassword.encrypt("encrypted")
expect(::Fog::Compute::VcloudDirector).to receive(:new).with(params)
expect(::Fog::VcloudDirector::Compute).to receive(:new).with(params)

described_class.raw_connect("server", "port", "username", encrypted, "api_version")
end

it "validates the password if validate is true if specified" do
expect(described_class).to receive(:validate_connection).and_raise(Fog::Compute::VcloudDirector::Unauthorized)
expect(::Fog::Compute::VcloudDirector).to receive(:new).with(params)
expect(described_class).to receive(:validate_connection).and_raise(Fog::VcloudDirector::Compute::Unauthorized)
expect(::Fog::VcloudDirector::Compute).to receive(:new).with(params)

expect do
described_class.raw_connect("server", "port", "username", "encrypted", "api_version", true)
Expand All @@ -68,7 +68,7 @@

it "does not validate the password unless specified" do
expect(described_class).to_not receive(:validate_connection)
expect(::Fog::Compute::VcloudDirector).to receive(:new).with(params)
expect(::Fog::VcloudDirector::Compute).to receive(:new).with(params)

described_class.raw_connect("server", "port", "username", "encrypted", "api_version")
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@
},
{
:name => 'error response',
:data => -> { raise Fog::Compute::VcloudDirector::Forbidden, 'simulated error' },
:data => -> { raise Fog::VcloudDirector::Compute::Forbidden, 'simulated error' },
:expected => []
}
].each do |test_case|
Expand All @@ -299,7 +299,7 @@
},
{
:name => 'error response',
:data => -> { raise Fog::Compute::VcloudDirector::Forbidden, 'simulated error' },
:data => -> { raise Fog::VcloudDirector::Compute::Forbidden, 'simulated error' },
:expected => []
}
].each do |test_case|
Expand Down

0 comments on commit 8be144d

Please sign in to comment.