diff --git a/lib/smart_proxy_dhcp_infoblox/fixed_address_crud.rb b/lib/smart_proxy_dhcp_infoblox/fixed_address_crud.rb index 01499e6..643a8da 100644 --- a/lib/smart_proxy_dhcp_infoblox/fixed_address_crud.rb +++ b/lib/smart_proxy_dhcp_infoblox/fixed_address_crud.rb @@ -51,6 +51,7 @@ def find_host_and_name_by_ip(ip_address) def build_host(options) host = ::Infoblox::Fixedaddress.new(:connection => @connection) + extra_options = [{:name => 'host-name', :value => options[:hostname]}] host.name = options[:hostname] host.ipv4addr = options[:ip] host.mac = options[:mac] @@ -59,7 +60,7 @@ def build_host(options) host.bootfile = options[:filename] host.use_bootfile = true host.network_view = network_view - host.options = Proxy::DHCP::Infoblox::Plugin.settings.options + host.options = Proxy::DHCP::Infoblox::Plugin.settings.options + extra_options host end end diff --git a/test/host_and_fixedaddress_crud_test.rb b/test/host_and_fixedaddress_crud_test.rb index 57d9db9..f3354bc 100644 --- a/test/host_and_fixedaddress_crud_test.rb +++ b/test/host_and_fixedaddress_crud_test.rb @@ -206,6 +206,7 @@ def test_build_host assert_equal @filename, built.bootfile assert built.use_bootfile assert_equal @network_view, built.network_view + assert built.instance_variable_get("@options").include?({:name => 'host-name', :value => @hostname}) end def test_build_host_with_options @@ -213,7 +214,7 @@ def test_build_host_with_options Proxy::DHCP::Infoblox::Plugin.settings.options = [{"name" => "xyz"}] host = @crud.build_host(:ip => @ip, :mac => @mac, :hostname => @hostname) - assert_equal [{"name" => "xyz"}], host.instance_variable_get("@options") + assert host.instance_variable_get("@options").include?({"name" => "xyz"}) ensure Proxy::DHCP::Infoblox::Plugin.settings.options = [] end