smart_proxy_dhcp_infoblox 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1a07a8c599733c506c451ce081884584dc9501eb
4
- data.tar.gz: a07bed8a8a3b384a5670cff0c0c0f72005ebbc17
3
+ metadata.gz: 158f2e07407799d7f26f84493be677087f46d61a
4
+ data.tar.gz: e94a02ad181dab62027fc1cd50ae3cc080cdcb7f
5
5
  SHA512:
6
- metadata.gz: b3156dbd4113a50c8c48a5305813ddd290336478ab5ab64dccc94b084a9972bd11e403e4c064970f11196400bedb1b2569856f9ae284defecd840173cad5db62
7
- data.tar.gz: 99715f24471a04a0d0126e1f750ea23d66e88dbef2d5d956e5ca1cb2574ee34673fdbc636aa784fdcd83e05d35805bb852ada89b813dcf69f45b307dbfd15855
6
+ metadata.gz: 22d13b1f5077bbf79b9f11fcc49b4be0eff7f6f11b75bd3489d4e2665a514937f02f8d3e6d7a9188d55fb380408601d9b0628b41480f92dce47cc3dc8d77801b
7
+ data.tar.gz: 725b239a63a1ddfd0e7416f3b4e81b55717f67d9eca5da3c0ab147f12d340f8a4946643a5c16f6e26c62cbb42d6c335ff03d614822294f95844c18e2fb55eb60
@@ -1,7 +1,7 @@
1
1
  module Proxy
2
2
  module DHCP
3
3
  module Infoblox
4
- VERSION = '0.0.8'
4
+ VERSION = '0.0.9'
5
5
  end
6
6
  end
7
7
  end
@@ -26,7 +26,8 @@ module ::Proxy::DHCP::Infoblox
26
26
  def find_records_by_ip(subnet_address, ip_address)
27
27
  found = find_hosts({'ipv4addr' => ip_address}, 2147483646)
28
28
  return [] if found.empty?
29
- found.map {|record| build_reservation(record.name, record, subnet_address)}
29
+ to_return = found.map {|record| build_reservation(record.name, record, subnet_address)}
30
+ to_return.compact
30
31
  end
31
32
 
32
33
  def find_record_by_mac(subnet_address, mac_address)
@@ -34,7 +34,8 @@ module ::Proxy::DHCP::Infoblox
34
34
  def find_records_by_ip(subnet_address, ip_address)
35
35
  found = find_hosts({'ipv4addr' => ip_address}, 2147483646)
36
36
  return [] if found.empty?
37
- found.map {|record| build_reservation(record.name, record.ipv4addrs.find {|ip| ip.ipv4addr == ip_address}, subnet_address)}
37
+ to_return = found.map {|record| build_reservation(record.name, record.ipv4addrs.find {|ip| ip.ipv4addr == ip_address}, subnet_address)}
38
+ to_return.compact
38
39
  end
39
40
 
40
41
  def find_record_by_mac(subnet_address, mac_address)
@@ -1,4 +1,5 @@
1
1
  require 'test_helper'
2
+ require 'ostruct'
2
3
  require 'infoblox'
3
4
  require 'dhcp_common/dhcp_common'
4
5
  require 'dhcp_common/record/reservation'
@@ -21,6 +22,16 @@ module CommoncrudTests
21
22
  assert @crud.find_records_by_ip('192.168.42.0/24', '192.168.42.1').empty?
22
23
  end
23
24
 
25
+ def test_find_records_by_ip_returns_empty_array_when_host_has_no_dhcp_record
26
+ found_record = OpenStruct.new(:name => 'testing',
27
+ :ipv4addrs => [OpenStruct.new(:ipv4addr => '192.168.42.1',
28
+ :mac => '00:01:02:03:04:05',
29
+ :configure_for_dhcp => false)])
30
+ @entity.expects(:find).
31
+ with(@connection, search_condition('ipv4addr' => '192.168.42.1', '_max_results' => 2147483646)).returns([found_record])
32
+ assert @crud.find_records_by_ip('192.168.42.0/24', '192.168.42.1').empty?
33
+ end
34
+
24
35
  def test_find_record_using_mac
25
36
  @entity.expects(:find).with(@connection, search_condition('mac' => '00:01:02:03:05:06', '_max_results' => 1)).returns([@host])
26
37
  assert_equal @reservation, @crud.find_record_by_mac('192.168.42.0/24', '00:01:02:03:05:06')
@@ -150,6 +161,8 @@ class HostCrudTest < Test::Unit::TestCase
150
161
  end
151
162
 
152
163
  class FixedaddressCrudTest < Test::Unit::TestCase
164
+ include CommoncrudTests
165
+
153
166
  def setup
154
167
  @connection = Object.new
155
168
  @network_view = "something"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smart_proxy_dhcp_infoblox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Klaas Demter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-22 00:00:00.000000000 Z
11
+ date: 2018-01-15 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Infoblox DHCP provider plugin for Foreman's smart proxy
14
14
  email:
@@ -61,15 +61,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
61
61
  version: '0'
62
62
  requirements: []
63
63
  rubyforge_project:
64
- rubygems_version: 2.6.12
64
+ rubygems_version: 2.6.14
65
65
  signing_key:
66
66
  specification_version: 4
67
67
  summary: Infoblox DHCP provider plugin for Foreman's smart proxy
68
68
  test_files:
69
+ - test/infoblox_provider_test.rb
69
70
  - test/plugin_configuration_test.rb
70
- - test/unused_ip_test.rb
71
- - test/host_and_fixedaddress_crud_test.rb
71
+ - test/regex_generator_test.rb
72
72
  - test/record_type_validator_test.rb
73
73
  - test/test_helper.rb
74
- - test/infoblox_provider_test.rb
75
- - test/regex_generator_test.rb
74
+ - test/unused_ip_test.rb
75
+ - test/host_and_fixedaddress_crud_test.rb