forked from ManageIQ/manageiq-providers-azure_stack
-
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.
Versioned CloudManager and NetworkManager collectors
This commit refactors collectors for CloudManager and Networkmanager, so that the differences in collector methods due to our support for two version profiles are accounted for in seperate subclasses of manager's collector. We introduce one new class per API version profile per manager. Behavior for the latest supported profile is kept in Collector::CloudManager and Collector::NetworkManager, the profile version-specific differences are covered in their subclasses. The Inventory class now overrides `collector_class_for` method so that the appropriate version of collector is constructed for CloudManager and NetworkManager targets. Signed-off-by: Manca Bizjak <[email protected]>
- Loading branch information
1 parent
4dca041
commit ce1ea69
Showing
9 changed files
with
129 additions
and
78 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
22 changes: 22 additions & 0 deletions
22
app/models/manageiq/providers/azure_stack/inventory/collector/cloud_manager/v2017_03_09.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,22 @@ | ||
# rubocop:disable Naming/ClassAndModuleCamelCase | ||
class ManageIQ::Providers::AzureStack::Inventory::Collector::CloudManager::V2017_03_09 < ManageIQ::Providers::AzureStack::Inventory::Collector::CloudManager | ||
def vms | ||
$azure_stack_log.debug("Fetching VM ids, then fetching full data for each") | ||
azure_resources.resources.list(:filter => "resourceType eq 'Microsoft.Compute/virtualMachines'").map do |vm| | ||
azure_compute.virtual_machines.get(resource_group_name(vm.id), vm.name, :expand => 'instanceView') | ||
end | ||
end | ||
|
||
def orchestration_stacks | ||
resource_groups.flat_map do |group| | ||
azure_resources.deployments.list(group.name).map do |deployment| | ||
[ | ||
group, # resource group | ||
deployment, # deployment | ||
azure_resources.deployment_operations.list(group.name, deployment.name) # operations of the deployment | ||
] | ||
end | ||
end | ||
end | ||
end | ||
# rubocop:enable Naming/ClassAndModuleCamelCase |
4 changes: 4 additions & 0 deletions
4
app/models/manageiq/providers/azure_stack/inventory/collector/cloud_manager/v2018_03_01.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,4 @@ | ||
# rubocop:disable Naming/ClassAndModuleCamelCase | ||
class ManageIQ::Providers::AzureStack::Inventory::Collector::CloudManager::V2018_03_01 < ManageIQ::Providers::AzureStack::Inventory::Collector::CloudManager | ||
end | ||
# rubocop:enable Naming/ClassAndModuleCamelCase |
5 changes: 5 additions & 0 deletions
5
app/models/manageiq/providers/azure_stack/inventory/collector/network_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
4 changes: 4 additions & 0 deletions
4
app/models/manageiq/providers/azure_stack/inventory/collector/network_manager/v2017_03_09.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,4 @@ | ||
# rubocop:disable Naming/ClassAndModuleCamelCase | ||
class ManageIQ::Providers::AzureStack::Inventory::Collector::NetworkManager::V2017_03_09 < ManageIQ::Providers::AzureStack::Inventory::Collector::NetworkManager | ||
end | ||
# rubocop:enable Naming/ClassAndModuleCamelCase |
4 changes: 4 additions & 0 deletions
4
app/models/manageiq/providers/azure_stack/inventory/collector/network_manager/v2018_03_01.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,4 @@ | ||
# rubocop:disable Naming/ClassAndModuleCamelCase | ||
class ManageIQ::Providers::AzureStack::Inventory::Collector::NetworkManager::V2018_03_01 < ManageIQ::Providers::AzureStack::Inventory::Collector::NetworkManager | ||
end | ||
# rubocop:enable Naming/ClassAndModuleCamelCase |
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
135 changes: 71 additions & 64 deletions
135
spec/vcr_cassettes/manageiq/providers/azure_stack/cloud_manager/refresher/V2018_03_01.yml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.