smart_proxy_dhcp_infoblox 0.0.15 → 0.0.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -2
- data/config/dhcp_infoblox.yml.example +9 -0
- data/lib/smart_proxy_dhcp_infoblox/common_crud.rb +3 -1
- data/lib/smart_proxy_dhcp_infoblox/dhcp_infoblox_plugin.rb +2 -1
- data/lib/smart_proxy_dhcp_infoblox/dhcp_infoblox_version.rb +1 -1
- data/lib/smart_proxy_dhcp_infoblox/fixed_address_crud.rb +2 -0
- data/lib/smart_proxy_dhcp_infoblox/plugin_configuration.rb +1 -1
- data/test/host_and_fixedaddress_crud_test.rb +11 -0
- data/test/plugin_configuration_test.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 386bb53985d3965e87d2ed0b4928858efe542d1a6bc28e1147795aae21871691
|
4
|
+
data.tar.gz: fffe1218aacbb214c899c01f72900756d3c92d13ec64b019e75fdc1307df0712
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e6e8069b8151c468aa55e93aacb28bb657ce7b08a5b8ad2fb3a487b016672fb96dcf4c5c32be628d2a2500d890ab498be486c00aad4a94e3a08dac6e918041c
|
7
|
+
data.tar.gz: a63c13ca94c2e74a5fc7ffc0819d2df23a087c8650e817df7d303a695e56140f605a426108982be65fab94b5c3aa6547c578be701cb602c51cb009a9812052cf
|
data/README.md
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
# SmartProxyDhcpInfoblox
|
2
2
|
|
3
|
-
[![Build Status](https://travis-ci.org/theforeman/smart_proxy_dhcp_infoblox.svg?branch=master)](https://travis-ci.org/theforeman/smart_proxy_dhcp_infoblox)
|
4
|
-
|
5
3
|
This plugin adds a new DHCP provider for managing records with infoblox servers
|
6
4
|
|
7
5
|
## Installation
|
@@ -22,3 +22,12 @@
|
|
22
22
|
# Number of seconds to wait after successful Grid restart (make sure to increase Foreman and CLI timeouts).
|
23
23
|
# Set to 0 to disable the delay.
|
24
24
|
#:wait_after_restart: 10
|
25
|
+
|
26
|
+
# DHCP custom options (name, num, value and vendor_class). Set to blank to ignore.
|
27
|
+
# This is only used for 'fixedaddress' record types.
|
28
|
+
#:options:
|
29
|
+
#-
|
30
|
+
#name: "DHCP option name"
|
31
|
+
#num: 1234
|
32
|
+
#value: "A value"
|
33
|
+
#vendor_class: "A vendor class"
|
@@ -17,6 +17,8 @@ module ::Proxy::DHCP::Infoblox
|
|
17
17
|
def all_leases(network_address, subnet)
|
18
18
|
address_range_regex = NetworkAddressesRegularExpressionGenerator.new.generate_regex(network_address)
|
19
19
|
::Infoblox::Lease.find(@connection, 'address~' => address_range_regex).map do |lease|
|
20
|
+
# Infoblox can return MAC address set to nil
|
21
|
+
next unless lease.hardware
|
20
22
|
Proxy::DHCP::Lease.new(
|
21
23
|
lease.client_hostname,
|
22
24
|
lease.address,
|
@@ -27,7 +29,7 @@ module ::Proxy::DHCP::Infoblox
|
|
27
29
|
lease.binding_state,
|
28
30
|
:hostname => lease.client_hostname
|
29
31
|
)
|
30
|
-
end
|
32
|
+
end.compact
|
31
33
|
end
|
32
34
|
|
33
35
|
def find_record(subnet_address, an_address)
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'yaml'
|
1
2
|
require 'smart_proxy_dhcp_infoblox/common_crud'
|
2
3
|
|
3
4
|
module ::Proxy::DHCP::Infoblox
|
@@ -58,6 +59,7 @@ module ::Proxy::DHCP::Infoblox
|
|
58
59
|
host.bootfile = options[:filename]
|
59
60
|
host.use_bootfile = true
|
60
61
|
host.network_view = network_view
|
62
|
+
host.options = Proxy::DHCP::Infoblox::Plugin.settings.options
|
61
63
|
host
|
62
64
|
end
|
63
65
|
end
|
@@ -14,7 +14,7 @@ module Proxy::DHCP::Infoblox
|
|
14
14
|
c.dependency :connection, (lambda {
|
15
15
|
::Infoblox.wapi_version = '2.0'
|
16
16
|
::Infoblox::Connection.new(:username => settings[:username], :password => settings[:password],
|
17
|
-
:host => settings[:server], :ssl_opts => { :verify =>
|
17
|
+
:host => settings[:server], :ssl_opts => { :verify => !ENV['FOREMAN_INFOBLOX_NOSSLVERIFY'] },
|
18
18
|
:logger => ::Proxy::LogBuffer::Decorator.instance)
|
19
19
|
})
|
20
20
|
|
@@ -208,6 +208,17 @@ class FixedaddressCrudTest < Test::Unit::TestCase
|
|
208
208
|
assert_equal @network_view, built.network_view
|
209
209
|
end
|
210
210
|
|
211
|
+
def test_build_host_with_options
|
212
|
+
begin
|
213
|
+
Proxy::DHCP::Infoblox::Plugin.settings.options = [{"name" => "xyz"}]
|
214
|
+
|
215
|
+
host = @crud.build_host(:ip => @ip, :mac => @mac, :hostname => @hostname)
|
216
|
+
assert_equal [{"name" => "xyz"}], host.instance_variable_get("@options")
|
217
|
+
ensure
|
218
|
+
Proxy::DHCP::Infoblox::Plugin.settings.options = []
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
211
222
|
def test_add_record_with_collision
|
212
223
|
@crud.expects(:build_host).with(:ip => @ip, :mac => @mac, :hostname => @hostname).returns(@host)
|
213
224
|
@host.expects(:post).raises(Infoblox::Error.new("IB.Data.Conflict"))
|
@@ -16,6 +16,7 @@ class PluginDefaultConfigurationTest < Test::Unit::TestCase
|
|
16
16
|
:blacklist_duration_minutes => 30 * 60,
|
17
17
|
:wait_after_restart => 10,
|
18
18
|
:dns_view => "default",
|
19
|
+
:options => [],
|
19
20
|
:network_view => "default" },
|
20
21
|
Proxy::DHCP::Infoblox::Plugin.default_settings)
|
21
22
|
end
|
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.
|
4
|
+
version: 0.0.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Klaas Demter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: infoblox
|