bind9mgr 0.3.9 → 0.3.10
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/README.txt +3 -1
- data/lib/bind9mgr.rb +1 -1
- data/lib/named_conf.rb +1 -0
- data/lib/zone.rb +7 -0
- data/spec/zone_spec.rb +22 -1
- metadata +4 -4
data/README.txt
CHANGED
@@ -17,12 +17,14 @@ Features:
|
|
17
17
|
* add zone intaeface
|
18
18
|
* delete zone interface
|
19
19
|
* automatic zone options management (origin, default NS, default A, "www" CNAME etc)
|
20
|
+
* zones and records validations
|
20
21
|
|
21
22
|
Please look into specs for more detailed info.
|
22
23
|
|
23
24
|
TODO: more configuration features
|
24
25
|
TODO: more conventions(feedback welcomed!)
|
25
|
-
TODO:
|
26
|
+
TODO: true domain names validations
|
27
|
+
TODO: RFC records validations
|
26
28
|
|
27
29
|
== SYNOPSIS:
|
28
30
|
|
data/lib/bind9mgr.rb
CHANGED
data/lib/named_conf.rb
CHANGED
data/lib/zone.rb
CHANGED
@@ -17,6 +17,8 @@ module Bind9mgr
|
|
17
17
|
@options[:default_ttl] ||= 86400
|
18
18
|
|
19
19
|
clear_records
|
20
|
+
|
21
|
+
self
|
20
22
|
end
|
21
23
|
|
22
24
|
def origin
|
@@ -158,8 +160,13 @@ zone "#{name}" {
|
|
158
160
|
true
|
159
161
|
end
|
160
162
|
|
163
|
+
def self.domain_name_syntax_valid( string )
|
164
|
+
! string.match(/^([\w\d\-]{2,}\.)+(\w{2,})\.?$/).nil?
|
165
|
+
end
|
166
|
+
|
161
167
|
def valid?
|
162
168
|
return false if @records.size < 1
|
169
|
+
return false unless Bind9mgr::Zone.domain_name_syntax_valid( self.origin )
|
163
170
|
@records.select{ |z| !z.valid? }.size == 0
|
164
171
|
end
|
165
172
|
|
data/spec/zone_spec.rb
CHANGED
@@ -30,6 +30,11 @@ alias1 IN CNAME ns
|
|
30
30
|
it "should be instanceable" do
|
31
31
|
expect{ Bind9mgr::Zone.new }.not_to raise_error
|
32
32
|
end
|
33
|
+
|
34
|
+
it "should return self on instantiation" do
|
35
|
+
Bind9mgr::Zone.new.should be_kind_of( Bind9mgr::Zone )
|
36
|
+
end
|
37
|
+
|
33
38
|
|
34
39
|
it "should fill itself with data on load method call" do
|
35
40
|
@zone.load
|
@@ -54,7 +59,23 @@ alias1 IN CNAME ns
|
|
54
59
|
:secondary_ns => '192.168.1.2',
|
55
60
|
:main_server_ip => '192.168.1.3',
|
56
61
|
:support_email => 'qwe@qwe.ru'
|
57
|
-
})
|
62
|
+
} )
|
63
|
+
end
|
64
|
+
|
65
|
+
it "should has method to check domain name syntax" do
|
66
|
+
Bind9mgr::Zone.domain_name_syntax_valid( "qw.ru" ).should be_true
|
67
|
+
Bind9mgr::Zone.domain_name_syntax_valid( "rew.qw.ru" ).should be_true
|
68
|
+
Bind9mgr::Zone.domain_name_syntax_valid( "werwer-qw.ru" ).should be_true
|
69
|
+
Bind9mgr::Zone.domain_name_syntax_valid( "q.ru" ).should be_false
|
70
|
+
Bind9mgr::Zone.domain_name_syntax_valid( "11qweqwe.ru" ).should be_true
|
71
|
+
Bind9mgr::Zone.domain_name_syntax_valid( "q.r" ).should be_false
|
72
|
+
Bind9mgr::Zone.domain_name_syntax_valid( "q.11" ).should be_false
|
73
|
+
end
|
74
|
+
|
75
|
+
it "should validate domain name" do
|
76
|
+
subject.origin = 'qwe qwe qwe.com'
|
77
|
+
subject.add_default_rrs
|
78
|
+
subject.should_not be_valid
|
58
79
|
end
|
59
80
|
|
60
81
|
it "should add default rrs before generate db content" do
|
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.10
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-
|
12
|
+
date: 2011-11-06 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: hoe
|
16
|
-
requirement: &
|
16
|
+
requirement: &11719380 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '2.12'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *11719380
|
25
25
|
description: This gem contains some classes to manage bind9 zone files
|
26
26
|
email:
|
27
27
|
- mikhail@mad-box.ru
|