Skip to content

Commit

Permalink
Further fixes and changes required for Test Failures
Browse files Browse the repository at this point in the history
In order to allow spec tests to pass the cloud_manager_spec must requires an authentication
object for the openstack provider.

Also further checks for validity in the refresh parser.
  • Loading branch information
jerryk55 committed Mar 20, 2018
1 parent 73f42d4 commit f7dff4c
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def initialize(ems, options = nil)
@data = {}
@data_index = {}

@cinder_service = ems.parent_manager.cinder_service
@cinder_service = ems.&parent_manager&.cinder_service
end

def ems_inv_to_hashes
Expand All @@ -39,21 +39,21 @@ def ems_inv_to_hashes
end

def volumes
@volumes ||= @cinder_service.handled_list(:volumes)
@volumes ||= @cinder_service&.handled_list(:volumes)
end

def get_volumes
process_collection(volumes, :cloud_volumes) { |volume| parse_volume(volume) }
end

def get_snapshots
process_collection(@cinder_service.handled_list(:list_snapshots_detailed,
process_collection(@cinder_service&.handled_list(:list_snapshots_detailed,
:__request_body_index => "snapshots"),
:cloud_volume_snapshots) { |snap| parse_snapshot(snap) }
end

def get_backups
process_collection(@cinder_service.list_backups_detailed.body["backups"],
process_collection(@cinder_service&.list_backups_detailed.body["backups"],
:cloud_volume_backups) { |backup| parse_backup(backup) }
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def initialize(ems, options = nil)
@data = {}
@data_index = {}

@swift_service = ems.parent_manager.swift_service
@swift_service = ems.parent_manager&.swift_service
end

def ems_inv_to_hashes
Expand All @@ -34,7 +34,7 @@ def ems_inv_to_hashes
end

def object_store
return if @swift_service.blank? || @swift_service.name != :swift
return if @swift_service.nil? || @swift_service.blank? || @swift_service.name != :swift

@swift_service.handled_list(:directories).each do |dir|
result = process_collection_item(dir, :cloud_object_store_containers) { |c| parse_container(c, dir.project) }
Expand Down
1 change: 0 additions & 1 deletion app/models/mixins/cinder_manager_mixin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ module CinderManagerMixin
private

def ensure_cinder_managers
return false unless cinder_service
created = ensure_cinder_manager
cinder_manager.name = "#{name} Cinder Manager"
cinder_manager.zone_id = zone_id
Expand Down
1 change: 0 additions & 1 deletion app/models/mixins/swift_manager_mixin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ module SwiftManagerMixin
private

def ensure_swift_managers
return false unless swift_service
created = ensure_swift_manager
swift_manager.name = "#{name} Swift Manager"
swift_manager.zone_id = zone_id
Expand Down
2 changes: 1 addition & 1 deletion spec/models/manageiq/providers/cloud_manager_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
end

context "OpenStack CloudTenant Mapping" do
let(:ems_cloud) { FactoryGirl.create(:ems_openstack, :tenant_mapping_enabled => true) }
let(:ems_cloud) { FactoryGirl.create(:ems_openstack_with_authentication, :tenant_mapping_enabled => true) }
let(:ems_infra) { FactoryGirl.create(:ext_management_system) }

describe "#supports_cloud_tenant_mapping" do
Expand Down

0 comments on commit f7dff4c

Please sign in to comment.