-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #123 from aiperon/amazon-s3-objects-parsing
Amazon S3 objects inventoring
- Loading branch information
Showing
9 changed files
with
214 additions
and
47 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
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
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
56 changes: 29 additions & 27 deletions
56
app/models/manageiq/providers/amazon/storage_manager/s3/refresher.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 |
---|---|---|
@@ -1,39 +1,41 @@ | ||
class ManageIQ::Providers::Amazon::StorageManager::S3::Refresher < ManageIQ::Providers::BaseManager::Refresher | ||
include ::EmsRefresh::Refreshers::EmsRefresherMixin | ||
module ManageIQ::Providers | ||
class Amazon::StorageManager::S3::Refresher < ManageIQ::Providers::BaseManager::Refresher | ||
include ::EmsRefresh::Refreshers::EmsRefresherMixin | ||
|
||
def collect_inventory_for_targets(ems, targets) | ||
targets_with_data = targets.collect do |target| | ||
target_name = target.try(:name) || target.try(:event_type) | ||
def collect_inventory_for_targets(ems, targets) | ||
targets_with_data = targets.collect do |target| | ||
target_name = target.try(:name) || target.try(:event_type) | ||
|
||
_log.info "Filtering inventory for #{target.class} [#{target_name}] id: [#{target.id}]..." | ||
_log.info "Filtering inventory for #{target.class} [#{target_name}] id: [#{target.id}]..." | ||
|
||
if refresher_options.try(:[], :inventory_object_refresh) | ||
inventory = ManageIQ::Providers::Amazon::Builder.build_inventory(ems, target) | ||
if refresher_options.try(:[], :inventory_object_refresh) | ||
inventory = ManageIQ::Providers::Amazon::Builder.build_inventory(ems, target) | ||
end | ||
|
||
_log.info "Filtering inventory...Complete" | ||
[target, inventory] | ||
end | ||
|
||
_log.info "Filtering inventory...Complete" | ||
[target, inventory] | ||
targets_with_data | ||
end | ||
|
||
targets_with_data | ||
end | ||
|
||
def parse_targeted_inventory(ems, _target, inventory) | ||
log_header = format_ems_for_logging(ems) | ||
_log.debug "#{log_header} Parsing inventory..." | ||
hashes, = Benchmark.realtime_block(:parse_inventory) do | ||
if refresher_options.try(:[], :inventory_object_refresh) | ||
inventory.inventory_collections | ||
else | ||
ManageIQ::Providers::Amazon::StorageManager::S3::RefreshParser.ems_inv_to_hashes(ems, refresher_options) | ||
def parse_targeted_inventory(ems, _target, inventory) | ||
log_header = format_ems_for_logging(ems) | ||
_log.debug "#{log_header} Parsing inventory..." | ||
hashes, = Benchmark.realtime_block(:parse_inventory) do | ||
if refresher_options.try(:[], :inventory_object_refresh) | ||
inventory.inventory_collections | ||
else | ||
ManageIQ::Providers::Amazon::StorageManager::S3::RefreshParser.ems_inv_to_hashes(ems, refresher_options) | ||
end | ||
end | ||
end | ||
_log.debug "#{log_header} Parsing inventory...Complete" | ||
_log.debug "#{log_header} Parsing inventory...Complete" | ||
|
||
hashes | ||
end | ||
hashes | ||
end | ||
|
||
def post_process_refresh_classes | ||
[] | ||
def post_process_refresh_classes | ||
[] | ||
end | ||
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
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