Skip to content

Commit

Permalink
Azure ResourceGroup model
Browse files Browse the repository at this point in the history
  • Loading branch information
Bronagh Sorota committed Oct 23, 2015
1 parent 6a24142 commit 4d789b0
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
17 changes: 16 additions & 1 deletion app/models/ems_refresh/save_inventory_cloud.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ def save_ems_cloud_inventory(ems, hashes, target = nil)
:floating_ips,
:cloud_resource_quotas,
:cloud_object_store_containers,
:cloud_object_store_objects
:cloud_object_store_objects,
:resource_groups
]

# Save and link other subsections
Expand Down Expand Up @@ -332,4 +333,18 @@ def save_cloud_object_store_objects_inventory(ems, hashes, target = nil)
save_inventory_multi(:cloud_object_store_objects, ems, hashes, deletes, [:ems_ref], nil, [:tenant, :container])
store_ids_for_new_records(ems.cloud_object_store_objects, hashes, :ems_ref)
end

def save_resource_groups_inventory(ems, hashes, target = nil)
target = ems if target.nil?

ems.resource_groups(true)
deletes = if (target == ems)
ems.resource_groups.dup
else
[]
end

save_inventory_multi(:resource_groups, ems, hashes, deletes, [:ems_ref])
store_ids_for_new_records(ems.resource_groups, hashes, :ems_ref)
end
end
2 changes: 2 additions & 0 deletions app/models/manageiq/providers/azure/cloud_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ class ManageIQ::Providers::Azure::CloudManager < ManageIQ::Providers::CloudManag

alias_attribute :azure_tenant_id, :uid_ems

has_many :resource_groups, :foreign_key => :ems_id, :dependent => :destroy

def self.ems_type
@ems_type ||= "azure".freeze
end
Expand Down
2 changes: 2 additions & 0 deletions app/models/resource_group.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class ResourceGroup < ActiveRecord::Base
end

0 comments on commit 4d789b0

Please sign in to comment.