-
Notifications
You must be signed in to change notification settings - Fork 898
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into add_notification
- Loading branch information
Showing
57 changed files
with
521 additions
and
357 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
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
2 changes: 1 addition & 1 deletion
2
app/models/manageiq/providers/embedded_ansible/inventory/collector/automation_manager.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,3 +1,3 @@ | ||
class ManageIQ::Providers::EmbeddedAnsible::Inventory::Collector::AutomationManager < ManagerRefresh::Inventory::Collector | ||
class ManageIQ::Providers::EmbeddedAnsible::Inventory::Collector::AutomationManager < ManageIQ::Providers::Inventory::Collector | ||
include ManageIQ::Providers::AnsibleTower::Shared::Inventory::Collector::AutomationManager | ||
end |
2 changes: 1 addition & 1 deletion
2
...ls/manageiq/providers/embedded_ansible/inventory/collector/configuration_script_source.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,3 +1,3 @@ | ||
class ManageIQ::Providers::EmbeddedAnsible::Inventory::Collector::ConfigurationScriptSource < ManagerRefresh::Inventory::Collector | ||
class ManageIQ::Providers::EmbeddedAnsible::Inventory::Collector::ConfigurationScriptSource < ManageIQ::Providers::Inventory::Collector | ||
include ManageIQ::Providers::AnsibleTower::Shared::Inventory::Collector::ConfigurationScriptSource | ||
end |
2 changes: 1 addition & 1 deletion
2
app/models/manageiq/providers/embedded_ansible/inventory/parser/automation_manager.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,3 +1,3 @@ | ||
class ManageIQ::Providers::EmbeddedAnsible::Inventory::Parser::AutomationManager < ManagerRefresh::Inventory::Parser | ||
class ManageIQ::Providers::EmbeddedAnsible::Inventory::Parser::AutomationManager < ManageIQ::Providers::Inventory::Parser | ||
include ManageIQ::Providers::AnsibleTower::Shared::Inventory::Parser::AutomationManager | ||
end |
2 changes: 1 addition & 1 deletion
2
...odels/manageiq/providers/embedded_ansible/inventory/parser/configuration_script_source.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,3 +1,3 @@ | ||
class ManageIQ::Providers::EmbeddedAnsible::Inventory::Parser::ConfigurationScriptSource < ManagerRefresh::Inventory::Parser | ||
class ManageIQ::Providers::EmbeddedAnsible::Inventory::Parser::ConfigurationScriptSource < ManageIQ::Providers::Inventory::Parser | ||
include ManageIQ::Providers::AnsibleTower::Shared::Inventory::Parser::ConfigurationScriptSource | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
module ManageIQ::Providers | ||
class Inventory | ||
require_nested :Collector | ||
require_nested :Parser | ||
require_nested :Persister | ||
|
||
attr_accessor :collector, :parsers, :persister | ||
|
||
# Based on the given provider/manager class, this returns correct parser class | ||
# | ||
# @param klass class of the Provider/Manager | ||
# @return [Class] Correct class name of the Parser | ||
def self.parser_class_for(klass) | ||
provider_module = ManageIQ::Providers::Inflector.provider_module(klass) | ||
"#{provider_module}::Inventory::Parser::#{klass.name.demodulize}".safe_constantize | ||
rescue ManageIQ::Providers::Inflector::ObjectNotNamespacedError => _err | ||
nil | ||
end | ||
|
||
# Based on the given provider/manager class, this returns correct persister class | ||
# | ||
# @param klass class of the Provider/Manager | ||
# @return [Class] Correct class name of the persister | ||
def self.persister_class_for(klass) | ||
provider_module = ManageIQ::Providers::Inflector.provider_module(klass) | ||
"#{provider_module}::Inventory::Persister::#{klass.name.demodulize}".safe_constantize | ||
rescue ManageIQ::Providers::Inflector::ObjectNotNamespacedError => _err | ||
nil | ||
end | ||
|
||
# @param persister [ManageIQ::Providers::Inventory::Persister] A Persister object | ||
# @param collector [ManageIQ::Providers::Inventory::Collector] A Collector object | ||
# @param parsers [ManageIQ::Providers::Inventory::Parser|Array] A Parser object or an array of | ||
# ManageIQ::Providers::Inventory::Parser objects | ||
def initialize(persister, collector, parsers) | ||
@collector = collector | ||
@persister = persister | ||
@parsers = parsers.kind_of?(Array) ? parsers : [parsers] | ||
end | ||
|
||
# Invokes all associated parsers storing parsed data into persister.inventory_collections | ||
# | ||
# @return [ManageIQ::Providers::Inventory::Persister] persister object, to allow chaining | ||
def parse | ||
parsers.each do |parser| | ||
parser.collector = collector | ||
parser.persister = persister | ||
parser.parse | ||
end | ||
|
||
persister | ||
end | ||
|
||
# Returns all InventoryCollections contained in persister | ||
# | ||
# @return [Array<ManagerRefresh::InventoryCollection>] List of InventoryCollections objects | ||
def inventory_collections | ||
parse.inventory_collections | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
class ManageIQ::Providers::Inventory::Collector | ||
attr_reader :manager, :target | ||
|
||
include Vmdb::Logging | ||
|
||
# @param manager [ManageIQ::Providers::BaseManager] A manager object | ||
# @param refresh_target [Object] A refresh Target object | ||
def initialize(manager, refresh_target) | ||
@manager = manager | ||
@target = refresh_target | ||
end | ||
|
||
# @return [Config::Options] Options for the manager type | ||
def options | ||
@options ||= Settings.ems_refresh[manager.class.ems_type] | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
class ManageIQ::Providers::Inventory::Parser | ||
attr_accessor :collector | ||
attr_accessor :persister | ||
|
||
include Vmdb::Logging | ||
|
||
def parse | ||
raise NotImplementedError, _("must be implemented in a subclass") | ||
end | ||
end |
Oops, something went wrong.