smart_proxy_dhcp_remote_isc 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bundler.d/dhcp_remote_isc.rb +3 -1
- data/lib/smart_proxy_dhcp_remote_isc/dhcp_remote_isc_plugin.rb +1 -1
- data/lib/smart_proxy_dhcp_remote_isc/plugin_configuration.rb +4 -5
- data/lib/smart_proxy_dhcp_remote_isc/subnet_service_initializer.rb +13 -25
- data/lib/smart_proxy_dhcp_remote_isc/version.rb +1 -1
- data/test/plugin_configuration_test.rb +7 -13
- metadata +18 -5
- data/lib/smart_proxy_dhcp_remote_isc/file_parser.rb +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 021abeb56914c9d2e1fd5e3775067d992ed9ca09
|
4
|
+
data.tar.gz: bcfdd528255e0d59306a3132361bfcae0bdf6d17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3615316ed7c67220e18de8d94f53377e6ee3681987b75061a60e976efd050d8bc600c238033b5aaf39b9ddded25e30b8b18701b6293fac463b307a6fb4ad8a02
|
7
|
+
data.tar.gz: d0693ee71b6c372f928410e93b2c1c63600d7d8a1e9c28981ca9032c82a9214afc56e01c27d27f8325df18cfb82588aee170d200d8183a02ac3ac5201943aecd
|
@@ -2,7 +2,7 @@ module Proxy::DHCP::RemoteISC
|
|
2
2
|
class Plugin < ::Proxy::Provider
|
3
3
|
plugin :dhcp_remote_isc, ::Proxy::DHCP::RemoteISC::VERSION
|
4
4
|
|
5
|
-
requires :dhcp, '>= 1.
|
5
|
+
requires :dhcp, '>= 1.16'
|
6
6
|
default_settings :config => '/etc/dhcp/dhcpd.conf', :leases => '/var/lib/dhcpd/dhcpd.leases',
|
7
7
|
:omapi_port => '7911'
|
8
8
|
|
@@ -7,10 +7,9 @@ module Proxy::DHCP::RemoteISC
|
|
7
7
|
container.get_dependency(:memory_store), container.get_dependency(:memory_store),
|
8
8
|
container.get_dependency(:memory_store), container.get_dependency(:memory_store))
|
9
9
|
end)
|
10
|
-
container.dependency :parser, lambda {::Proxy::DHCP::
|
11
|
-
container.dependency :config_file, lambda {::Proxy::DHCP::CommonISC::IscConfigurationFile.new(settings[:config], container.get_dependency(:parser))}
|
10
|
+
container.dependency :parser, lambda {::Proxy::DHCP::CommonISC::ConfigurationParser.new}
|
12
11
|
container.dependency :subnet_service_initializer, (lambda do
|
13
|
-
::Proxy::DHCP::RemoteISC::SubnetServiceInitializer.new(
|
12
|
+
::Proxy::DHCP::RemoteISC::SubnetServiceInitializer.new(settings[:config], settings[:leases],
|
14
13
|
container.get_dependency(:parser), container.get_dependency(:subnet_service))
|
15
14
|
end)
|
16
15
|
container.dependency :initialized_subnet_service, lambda {container.get_dependency(:subnet_service_initializer).initialized_subnet_service }
|
@@ -25,8 +24,8 @@ module Proxy::DHCP::RemoteISC
|
|
25
24
|
def load_classes
|
26
25
|
require 'dhcp_common/subnet_service'
|
27
26
|
require 'dhcp_common/isc/omapi_provider'
|
28
|
-
require 'dhcp_common/isc/
|
29
|
-
require '
|
27
|
+
require 'dhcp_common/isc/configuration_parser'
|
28
|
+
require 'dhcp_common/isc/subnet_service_initialization'
|
30
29
|
require 'smart_proxy_dhcp_remote_isc/subnet_service_initializer'
|
31
30
|
end
|
32
31
|
end
|
@@ -1,41 +1,29 @@
|
|
1
1
|
require 'dhcp_common/isc/subnet_service_initialization'
|
2
2
|
|
3
3
|
module Proxy::DHCP::RemoteISC
|
4
|
-
class SubnetServiceInitializer
|
5
|
-
include ::Proxy::DHCP::CommonISC::IscSubnetServiceInitialization
|
4
|
+
class SubnetServiceInitializer < ::Proxy::DHCP::CommonISC::IscSubnetServiceInitialization
|
6
5
|
include Proxy::Log
|
7
6
|
|
8
|
-
attr_reader :
|
7
|
+
attr_reader :config_file_path, :leases_file_path
|
9
8
|
|
10
|
-
def initialize(
|
11
|
-
@
|
12
|
-
@
|
13
|
-
|
14
|
-
@service = subnet_service
|
9
|
+
def initialize(config_file_path, leases_file_path, parser, subnet_service)
|
10
|
+
@config_file_path = config_file_path
|
11
|
+
@leases_file_path = leases_file_path
|
12
|
+
super(subnet_service, parser)
|
15
13
|
end
|
16
14
|
|
17
15
|
def initialized_subnet_service
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
update_subnet_service_with_dhcp_records(hosts_and_leases_from_leases(service, leases_path))
|
22
|
-
|
23
|
-
service
|
24
|
-
end
|
25
|
-
|
26
|
-
def load_subnets
|
27
|
-
service.add_subnets(*config_file.subnets)
|
16
|
+
load_configuration_file(read_config_file, config_file_path)
|
17
|
+
load_leases_file(read_leases_file, leases_file_path)
|
18
|
+
subnet_service
|
28
19
|
end
|
29
20
|
|
30
|
-
def
|
31
|
-
|
21
|
+
def read_leases_file
|
22
|
+
File.read(File.expand_path(leases_file_path))
|
32
23
|
end
|
33
24
|
|
34
|
-
def
|
35
|
-
|
36
|
-
parser.parse_config_and_leases_for_records(subnet_service, fd.read)
|
37
|
-
ensure
|
38
|
-
fd.close unless fd.nil?
|
25
|
+
def read_config_file
|
26
|
+
File.read(File.expand_path(config_file_path))
|
39
27
|
end
|
40
28
|
end
|
41
29
|
end
|
@@ -5,8 +5,9 @@ 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
7
|
require 'dhcp_common/isc/omapi_provider'
|
8
|
-
require '
|
9
|
-
require '
|
8
|
+
require 'rsec'
|
9
|
+
require 'dhcp_common/isc/configuration_parser'
|
10
|
+
require 'dhcp_common/isc/subnet_service_initialization'
|
10
11
|
require 'smart_proxy_dhcp_remote_isc/subnet_service_initializer'
|
11
12
|
|
12
13
|
class ConfigurationTest < ::Test::Unit::TestCase
|
@@ -38,13 +39,6 @@ class ProductionDiWiringsTest < Test::Unit::TestCase
|
|
38
39
|
assert_equal ::Proxy::DHCP::SubnetService, provider.service.class
|
39
40
|
end
|
40
41
|
|
41
|
-
def test_config_file_initialization
|
42
|
-
config_file = @container.get_dependency(:config_file)
|
43
|
-
|
44
|
-
assert_equal @settings[:config], config_file.path
|
45
|
-
assert config_file.parser
|
46
|
-
end
|
47
|
-
|
48
42
|
def test_parser_initialization
|
49
43
|
assert @container.get_dependency(:parser)
|
50
44
|
end
|
@@ -53,10 +47,10 @@ class ProductionDiWiringsTest < Test::Unit::TestCase
|
|
53
47
|
service_initializer = @container.get_dependency(:subnet_service_initializer)
|
54
48
|
|
55
49
|
assert service_initializer
|
56
|
-
assert_equal ::Proxy::DHCP::SubnetService, service_initializer.
|
57
|
-
assert_equal ::Proxy::DHCP::
|
58
|
-
assert_equal
|
59
|
-
assert_equal @settings[:leases], service_initializer.
|
50
|
+
assert_equal ::Proxy::DHCP::SubnetService, service_initializer.subnet_service.class
|
51
|
+
assert_equal ::Proxy::DHCP::CommonISC::ConfigurationParser, service_initializer.parser.class
|
52
|
+
assert_equal @settings[:config], service_initializer.config_file_path
|
53
|
+
assert_equal @settings[:leases], service_initializer.leases_file_path
|
60
54
|
end
|
61
55
|
|
62
56
|
def test_initialized_subnet_service
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
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.
|
4
|
+
version: 0.0.3
|
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-
|
12
|
-
dependencies:
|
11
|
+
date: 2017-05-30 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rsec
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
description: Smart-Proxy dhcp module provider for NFS-accessible ISC dhcpd installations
|
14
28
|
email:
|
15
29
|
- dmitri@appliedlogic.ca
|
@@ -23,7 +37,6 @@ files:
|
|
23
37
|
- config/dhcp_remote_isc.yml.example
|
24
38
|
- lib/smart_proxy_dhcp_remote_isc.rb
|
25
39
|
- lib/smart_proxy_dhcp_remote_isc/dhcp_remote_isc_plugin.rb
|
26
|
-
- lib/smart_proxy_dhcp_remote_isc/file_parser.rb
|
27
40
|
- lib/smart_proxy_dhcp_remote_isc/plugin_configuration.rb
|
28
41
|
- lib/smart_proxy_dhcp_remote_isc/subnet_service_initializer.rb
|
29
42
|
- lib/smart_proxy_dhcp_remote_isc/version.rb
|
@@ -49,7 +62,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
49
62
|
version: '0'
|
50
63
|
requirements: []
|
51
64
|
rubyforge_project:
|
52
|
-
rubygems_version: 2.
|
65
|
+
rubygems_version: 2.6.10
|
53
66
|
signing_key:
|
54
67
|
specification_version: 4
|
55
68
|
summary: Smart-Proxy dhcp module provider for NFS-accessible ISC dhcpd installations
|
@@ -1,14 +0,0 @@
|
|
1
|
-
require 'dhcp_common/isc/file_parser'
|
2
|
-
|
3
|
-
module ::Proxy::DHCP::RemoteISC
|
4
|
-
class IscFileParser < ::Proxy::DHCP::CommonISC::IscFileParser
|
5
|
-
def initialize
|
6
|
-
super(nil)
|
7
|
-
end
|
8
|
-
|
9
|
-
def parse_config_and_leases_for_records(subnet_service, conf)
|
10
|
-
@service = subnet_service
|
11
|
-
super(conf)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|