Skip to content

Commit

Permalink
refresh physical servers
Browse files Browse the repository at this point in the history
  • Loading branch information
MaysaMacedo committed Oct 30, 2017
1 parent b60ef1f commit 35bbd78
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/ems_refresh.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def self.get_target_objects(target, single_id = nil)
target_class = target_class.to_s.constantize unless target_class.kind_of?(Class)

if ManagerRefresh::Inventory.persister_class_for(target_class).blank? &&
[VmOrTemplate, Host, ExtManagementSystem, ManagerRefresh::Target].none? { |k| target_class <= k }
[VmOrTemplate, Host, PhysicalServer, ExtManagementSystem, ManagerRefresh::Target].none? { |k| target_class <= k }
_log.warn("Unknown target type: [#{target_class}].")
next
end
Expand Down
19 changes: 19 additions & 0 deletions app/models/physical_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,23 @@ def my_zone
def event_where_clause(assoc = :ems_events)
["#{events_table_name(assoc)}.physical_server_id = ?", id]
end

def self.refresh_ems(physical_server_ids)
physical_server_ids = [physical_server_ids] unless physical_server_ids.kind_of?(Array)
physical_server_ids = physical_server_ids.collect { |id| [PhysicalServer, id] }
EmsRefresh.queue_refresh(physical_server_ids)
end

def refresh_ems
unless ext_management_system
raise _("No %{table} defined") % {:table => ui_lookup(:table => "ext_management_systems")}
end
unless ext_management_system.has_credentials?
raise _("No %{table} credentials defined") % {:table => ui_lookup(:table => "ext_management_systems")}
end
unless ext_management_system.authentication_status_ok?
raise _("%{table} failed last authentication check") % {:table => ui_lookup(:table => "ext_management_systems")}
end
EmsRefresh.queue_refresh(self)
end
end

0 comments on commit 35bbd78

Please sign in to comment.