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

Update client to use renamed NetworkDiscovery #227

Merged
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
4 changes: 2 additions & 2 deletions app/models/manageiq/providers/openstack/discovery.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
require 'manageiq/network/port'
require 'manageiq/network_discovery/port'

module ManageIQ::Providers::Openstack
class Discovery
IRONIC_PORT = 6385

def self.probe(ost)
# Openstack InfraManager (TripleO/Director) discovery
if ManageIQ::Network::Port.open?(ost, IRONIC_PORT)
if ManageIQ::NetworkDiscovery::Port.open?(ost, IRONIC_PORT)
res = ""
Socket.tcp(ost.ipaddr, 6385) do |s|
s.print("GET / HTTP/1.0\r\n\r\n")
Expand Down
10 changes: 10 additions & 0 deletions spec/models/manageiq/providers/openstack/discovery_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
describe ManageIQ::Providers::Openstack::Discovery do
it ".probe" do
require 'ostruct'
allow(ManageIQ::NetworkDiscovery::Port).to receive(:open?).and_return(true)
allow(Socket).to receive(:tcp).and_yield(double(:print => nil, :close_write => nil, :read => "OpenStack Ironic API"))
ost = OpenStruct.new(:ipaddr => "172.168.0.1", :hypervisor => [])
described_class.probe(ost)
expect(ost.hypervisor).to eq [:openstack_infra]
end
end