smart_proxy_dhcp_remote_isc 0.0.3 → 0.0.4

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: 021abeb56914c9d2e1fd5e3775067d992ed9ca09
4
- data.tar.gz: bcfdd528255e0d59306a3132361bfcae0bdf6d17
3
+ metadata.gz: 9573da004f6366a2b3ef71e4215101d63564dc52
4
+ data.tar.gz: 98c1ca6e725252813d5987eaa6b018c12c5c83ee
5
5
  SHA512:
6
- metadata.gz: 3615316ed7c67220e18de8d94f53377e6ee3681987b75061a60e976efd050d8bc600c238033b5aaf39b9ddded25e30b8b18701b6293fac463b307a6fb4ad8a02
7
- data.tar.gz: d0693ee71b6c372f928410e93b2c1c63600d7d8a1e9c28981ca9032c82a9214afc56e01c27d27f8325df18cfb82588aee170d200d8183a02ac3ac5201943aecd
6
+ metadata.gz: 1b1caa58f6371c4afcdfb5c95b42618b8becd6490bd8a3419ce6bf4d33453490d986cbd6092238922c7d931bbbb2b8d1fc3e8bfc3224abd2fc44a169c4b09c3c
7
+ data.tar.gz: 93c09c1bbd822f9e1da50030634dbc895b1286f63c748bad314267639c4f832f65a213f82cadf9242e292684d518e21510d7b7dc8d75c9bc8260046c70f790ff
@@ -4,11 +4,13 @@ module Proxy::DHCP::RemoteISC
4
4
 
5
5
  requires :dhcp, '>= 1.16'
6
6
  default_settings :config => '/etc/dhcp/dhcpd.conf', :leases => '/var/lib/dhcpd/dhcpd.leases',
7
- :omapi_port => '7911'
7
+ :omapi_port => '7911', :blacklist_duration_minutes => 30*60
8
8
 
9
9
  validate_readable :config, :leases
10
10
 
11
11
  load_classes ::Proxy::DHCP::RemoteISC::PluginConfiguration
12
12
  load_dependency_injection_wirings ::Proxy::DHCP::RemoteISC::PluginConfiguration
13
+
14
+ start_services :free_ips
13
15
  end
14
16
  end
@@ -13,16 +13,18 @@ module Proxy::DHCP::RemoteISC
13
13
  container.get_dependency(:parser), container.get_dependency(:subnet_service))
14
14
  end)
15
15
  container.dependency :initialized_subnet_service, lambda {container.get_dependency(:subnet_service_initializer).initialized_subnet_service }
16
+ container.singleton_dependency :free_ips, lambda {::Proxy::DHCP::FreeIps.new(settings[:blacklist_duration_minutes]) }
16
17
 
17
18
  container.dependency :dhcp_provider, (lambda do
18
19
  Proxy::DHCP::CommonISC::IscOmapiProvider.new(
19
20
  settings[:server], settings[:omapi_port], settings[:subnets], settings[:key_name], settings[:key_secret],
20
- container.get_dependency(:initialized_subnet_service))
21
+ container.get_dependency(:initialized_subnet_service), container.get_dependency(:free_ips))
21
22
  end)
22
23
  end
23
24
 
24
25
  def load_classes
25
26
  require 'dhcp_common/subnet_service'
27
+ require 'dhcp_common/free_ips'
26
28
  require 'dhcp_common/isc/omapi_provider'
27
29
  require 'dhcp_common/isc/configuration_parser'
28
30
  require 'dhcp_common/isc/subnet_service_initialization'
@@ -1,7 +1,7 @@
1
1
  module Proxy
2
2
  module DHCP
3
3
  module RemoteISC
4
- VERSION = '0.0.3'
4
+ VERSION = '0.0.4'
5
5
  end
6
6
  end
7
7
  end
@@ -4,6 +4,7 @@ require 'tempfile'
4
4
  require 'smart_proxy_dhcp_remote_isc/plugin_configuration'
5
5
  require 'smart_proxy_dhcp_remote_isc/dhcp_remote_isc_plugin'
6
6
  require 'dhcp_common/subnet_service'
7
+ require 'dhcp_common/free_ips'
7
8
  require 'dhcp_common/isc/omapi_provider'
8
9
  require 'rsec'
9
10
  require 'dhcp_common/isc/configuration_parser'
@@ -23,7 +24,7 @@ class ProductionDiWiringsTest < Test::Unit::TestCase
23
24
  def setup
24
25
  @settings = {:server => "a_server", :omapi_port => 7911, :key_name => "key_name", :key_secret => "key_secret",
25
26
  :subnets => ["192.168.0.0/255.255.255.0"], :config => Tempfile.new('config').path,
26
- :leases => Tempfile.new('leases').path}
27
+ :leases => Tempfile.new('leases').path, :blacklist_duration_minutes => 100}
27
28
  @container = ::Proxy::DependencyInjection::Container.new
28
29
  ::Proxy::DHCP::RemoteISC::PluginConfiguration.new.load_dependency_injection_wirings(@container, @settings)
29
30
  end
@@ -37,6 +38,7 @@ class ProductionDiWiringsTest < Test::Unit::TestCase
37
38
  assert_equal @settings[:key_secret], provider.key_secret
38
39
  assert_equal Set.new(@settings[:subnets]), provider.managed_subnets
39
40
  assert_equal ::Proxy::DHCP::SubnetService, provider.service.class
41
+ assert_equal ::Proxy::DHCP::FreeIps, provider.free_ips.class
40
42
  end
41
43
 
42
44
  def test_parser_initialization
@@ -56,4 +58,11 @@ class ProductionDiWiringsTest < Test::Unit::TestCase
56
58
  def test_initialized_subnet_service
57
59
  assert @container.get_dependency(:initialized_subnet_service)
58
60
  end
61
+
62
+ def test_free_ips_configuration
63
+ free_ips = @container.get_dependency(:free_ips)
64
+
65
+ assert free_ips
66
+ assert_equal @settings[:blacklist_duration_minutes], free_ips.blacklist_interval
67
+ end
59
68
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smart_proxy_dhcp_remote_isc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitri Dolguikh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-30 00:00:00.000000000 Z
11
+ date: 2018-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rsec
@@ -62,10 +62,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
62
62
  version: '0'
63
63
  requirements: []
64
64
  rubyforge_project:
65
- rubygems_version: 2.6.10
65
+ rubygems_version: 2.6.14
66
66
  signing_key:
67
67
  specification_version: 4
68
68
  summary: Smart-Proxy dhcp module provider for NFS-accessible ISC dhcpd installations
69
69
  test_files:
70
- - test/test_helper.rb
71
70
  - test/plugin_configuration_test.rb
71
+ - test/test_helper.rb