Skip to content

Commit

Permalink
Merge pull request #17067 from jerryk55/fix_swift_refresher_when_no_s…
Browse files Browse the repository at this point in the history
…wift

Fail Cinder/Swift Ensures if Service not Present
(cherry picked from commit 9b54d98)

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1560692
  • Loading branch information
roliveri authored and simaishi committed Mar 26, 2018
1 parent 9eab6ed commit 866de69
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
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
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 Down
2 changes: 1 addition & 1 deletion spec/models/manageiq/providers/cloud_manager_spec.rb
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 866de69

Please sign in to comment.