forked from ManageIQ/manageiq-providers-openstack
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move duplicated collector code into helper module
- Loading branch information
Showing
4 changed files
with
30 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
app/models/manageiq/providers/openstack/inventory/collector/helper_methods.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
module ManageIQ::Providers::Openstack::Inventory::Collector::HelperMethods | ||
def orchestration_stack_by_resource_id(resource_id) | ||
@resources ||= {} | ||
if @resources.empty? | ||
orchestration_stacks.each do |stack| | ||
resources = orchestration_resources(stack) | ||
resources.each do |r| | ||
@resources[r.physical_resource_id] = r | ||
end | ||
end | ||
end | ||
@resources[resource_id] | ||
end | ||
|
||
def tenant_ids_with_flavor_access(flavor_id) | ||
unparsed_tenants = safe_get { connection.list_tenants_with_flavor_access(flavor_id) } | ||
flavor_access = unparsed_tenants.try(:data).try(:[], :body).try(:[], "flavor_access") || [] | ||
flavor_access.map! { |t| t['tenant_id'] } | ||
rescue | ||
[] | ||
else | ||
flavor_access | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters