Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refresh Physical Servers #16344

Merged
merged 1 commit into from
Oct 31, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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