Skip to content

Commit

Permalink
Implement discovery and set empty data for new ems
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielsvinha committed Jul 14, 2017
1 parent 98e8860 commit bae774a
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions app/models/manageiq/providers/lenovo/manager_mixin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,16 @@ def discover(ipAddress, port)

if XClarityClient::Discover.responds?(ipAddress, port)
new_ems = create!(
:name => "Discovered Provider #{ManageIQ::Providers::Lenovo::PhysicalInfraManager.count + 1}",
:hostname => ipAddress
:name => "Discovered Provider ##{self.count + 1}",
:hostname => URI('https://' + ipAddress),
:zone => Zone.default_zone
)

#Set empty authentications
create_default_authentications(new_ems)

_log.info("Reached Lenovo XClarity Appliance with endpoint: #{ipAddress}")
_log.info("Created EMS: #{new_ems.name} with id: #{new_ems.id}")
end

EmsRefresh.queue_refresh(new_ems) unless new_ems.blank?
Expand All @@ -74,7 +81,16 @@ def discover_queue(username, password, zone = nil)
private

def discover_from_queue(username, password)
discover(username, MiqPassword.decrypt(password))
discover(username, '')
end

def create_default_authentications(ems)
auth = Authentication.new
auth.userid = ''
auth.password = ''
auth.resource_id = ems.id
auth.save!
end

end
end

0 comments on commit bae774a

Please sign in to comment.