Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Save new AWS labels to the ManageIQ database. #194

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions app/models/manageiq/providers/amazon/refresh_helper_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,31 @@ module ClassMethods
def ems_inv_to_hashes(ems, options = nil)
new(ems, options).ems_inv_to_hashes
end

def queue_save_new_labels(resource_id, resource_type, labels, ems)
MiqQueue.put(
:queue_name => MiqEmsRefreshWorker.queue_name_for_ems(ems),
:class_name => 'ManageIQ::Providers::Amazon::CloudManager::RefreshParser',
:method_name => 'save_new_label_inventory',
:role => "ems_inventory",
:zone => ems.my_zone,
:args => [resource_id, resource_type, labels],
)
end

def save_new_label_inventory(resource_id, resource_type, labels)
resource = resource_type.constantize.find_by(:id => resource_id)
return if resource.nil?

resource_labels = []
labels.each do |l|
$aws_log.info("L #{l.inspect}")
l[:section] = 'labels'
l[:source] = 'amazon'
resource_labels << l
end

EmsRefresh.save_labels_inventory(resource, resource_labels )
end
end
end