Skip to content

Commit

Permalink
Merge pull request #17409 from saulotoledo/supporting_switches_refres…
Browse files Browse the repository at this point in the history
…h_action

Add methods to process the refesh action for a PhysicalSwitch
  • Loading branch information
agrare authored May 14, 2018
2 parents 9780b75 + dad194d commit 5a4ab9f
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 @@ -4,4 +4,23 @@ class PhysicalSwitch < Switch
has_many :physical_network_ports, :dependent => :destroy, :foreign_key => :switch_id

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 5a4ab9f

Please sign in to comment.