Skip to content

Commit

Permalink
Add methods to process the refesh action for a PhysicalSwitch
Browse files Browse the repository at this point in the history
  • Loading branch information
saulotoledo committed May 11, 2018
1 parent a937a31 commit dad194d
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions app/models/physical_switch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,23 @@ class PhysicalSwitch < Switch
has_one :hardware, :dependent => :destroy, :foreign_key => :switch_id, :inverse_of => :physical_switch

belongs_to :ext_management_system, :foreign_key => :ems_id, :inverse_of => :physical_switches

def my_zone
ems = ext_management_system
ems ? ems.my_zone : MiqServer.my_zone
end

def refresh_ems
unless ext_management_system
raise _("No Provider defined")
end
unless ext_management_system.has_credentials?
raise _("No Provider credentials defined")
end
unless ext_management_system.authentication_status_ok?
raise _("Provider failed last authentication check")
end

EmsRefresh.queue_refresh(ext_management_system)
end
end

0 comments on commit dad194d

Please sign in to comment.