bind9mgr 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +7 -1
- data/lib/bind9mgr.rb +1 -1
- data/lib/named_conf.rb +1 -1
- data/lib/zone.rb +16 -2
- data/spec/zone_spec.rb +21 -0
- metadata +4 -4
data/History.txt
CHANGED
data/lib/bind9mgr.rb
CHANGED
data/lib/named_conf.rb
CHANGED
@@ -99,7 +99,7 @@ module Bind9mgr
|
|
99
99
|
if zone_or_name.kind_of?( Zone )
|
100
100
|
raise ArgumentError, "file_name should be nil if instance of Zone supplied" unless file_name.nil?
|
101
101
|
zone = zone_or_name
|
102
|
-
elsif zone_or_name.kind_of?( String ) && ( zone_or_name.length >
|
102
|
+
elsif zone_or_name.kind_of?( String ) && ( zone_or_name.length > 4 ) # at last 'a.a.'
|
103
103
|
raise ArgumentError, "Main ns not secified" unless @main_ns
|
104
104
|
# raise ArgumentError, "Secondary ns not secified" unless @secondary_ns
|
105
105
|
raise ArgumentError, "Support email not secified" unless @support_email
|
data/lib/zone.rb
CHANGED
@@ -11,12 +11,12 @@ module Bind9mgr
|
|
11
11
|
'PTR'
|
12
12
|
]
|
13
13
|
|
14
|
-
attr_accessor :
|
14
|
+
attr_accessor :default_ttl
|
15
15
|
attr_accessor :file, :options
|
16
16
|
attr_reader :records
|
17
17
|
|
18
18
|
def initialize( zone_name = nil, zone_db_file = nil, options = { } )
|
19
|
-
|
19
|
+
self.origin = zone_name
|
20
20
|
@file = zone_db_file
|
21
21
|
@options = options
|
22
22
|
|
@@ -30,6 +30,20 @@ module Bind9mgr
|
|
30
30
|
clear_records
|
31
31
|
end
|
32
32
|
|
33
|
+
def origin
|
34
|
+
@origin
|
35
|
+
end
|
36
|
+
|
37
|
+
def origin= zone_origin
|
38
|
+
if zone_origin.kind_of?( String ) && zone_origin.length > 0
|
39
|
+
@origin = zone_origin.clone
|
40
|
+
@origin << '.' unless @origin[-1] == '.'
|
41
|
+
else
|
42
|
+
@origin = zone_origin
|
43
|
+
end
|
44
|
+
@origin
|
45
|
+
end
|
46
|
+
|
33
47
|
def name
|
34
48
|
@origin.sub(/\.$/, '')
|
35
49
|
end
|
data/spec/zone_spec.rb
CHANGED
@@ -56,4 +56,25 @@ alias1 IN CNAME ns
|
|
56
56
|
})
|
57
57
|
end
|
58
58
|
|
59
|
+
it "should add dot to zone name on creation unless there is no one" do
|
60
|
+
zone = Bind9mgr::Zone.new( 'example.com', 'example.com.db',
|
61
|
+
{ :main_ns => '192.168.1.1',
|
62
|
+
:secondary_ns => '192.168.1.2',
|
63
|
+
:main_server_ip => '192.168.1.3',
|
64
|
+
:support_email => 'qwe@qwe.ru'
|
65
|
+
})
|
66
|
+
zone.origin.should eql('example.com.')
|
67
|
+
zone.name.should eql('example.com')
|
68
|
+
end
|
69
|
+
|
70
|
+
it "should raise error when undefined rr target added" do
|
71
|
+
# examples
|
72
|
+
# 1:
|
73
|
+
# @ NS ns.example.com # here is no dot at the end of line -> error!
|
74
|
+
#
|
75
|
+
# 2:
|
76
|
+
# ns.example.com CNAME @
|
77
|
+
# @ NS ns.example.com # here is no dot at the end of line but this is not error: subdomain really defined
|
78
|
+
end
|
79
|
+
|
59
80
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bind9mgr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,12 +9,12 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-09-
|
12
|
+
date: 2011-09-21 00:00:00.000000000 +04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: hoe
|
17
|
-
requirement: &
|
17
|
+
requirement: &24156520 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ~>
|
@@ -22,7 +22,7 @@ dependencies:
|
|
22
22
|
version: '2.12'
|
23
23
|
type: :development
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *24156520
|
26
26
|
description: This gem contains some classes to manage bind9 zone files
|
27
27
|
email:
|
28
28
|
- mikhail@mad-box.ru
|