bind9mgr 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/bind9mgr.rb +1 -1
- data/lib/named_conf.rb +9 -2
- data/spec/named_conf_spec.rb +15 -0
- metadata +4 -4
data/lib/bind9mgr.rb
CHANGED
data/lib/named_conf.rb
CHANGED
@@ -66,9 +66,16 @@ module Bind9mgr
|
|
66
66
|
|
67
67
|
def write_zones
|
68
68
|
@zones.uniq.each do |z|
|
69
|
-
z.file ||= gen_zone_file_name;
|
70
|
-
zones_subdir = File.dirname(z.file)
|
69
|
+
z.file ||= gen_zone_file_name( z.origin );
|
70
|
+
zones_subdir = File.dirname( z.file )
|
71
71
|
Dir.mkdir( zones_subdir ) unless File.exists?( zones_subdir )
|
72
|
+
|
73
|
+
# OPTIMIZE this
|
74
|
+
z.options[:main_ns] ||= @main_ns
|
75
|
+
z.options[:secondary_ns] ||= @secondary_ns
|
76
|
+
z.options[:support_email] ||= @support_email
|
77
|
+
z.options[:main_server_ip] ||= @main_server_ip
|
78
|
+
|
72
79
|
z.write_db_file
|
73
80
|
end if @zones.size > 0
|
74
81
|
end
|
data/spec/named_conf_spec.rb
CHANGED
@@ -65,6 +65,9 @@ alias1 IN CNAME ns
|
|
65
65
|
File.stub(:read).with("testfile.conf").and_return(@test_conf_content)
|
66
66
|
File.stub(:read).with("testdomain.com.db").and_return(@test_db_content)
|
67
67
|
|
68
|
+
File.stub(:open).with(anything(),anything()).and_return(true)
|
69
|
+
Dir.stub(:mkdir).with(anything()).and_return(true)
|
70
|
+
|
68
71
|
@nc = Bind9mgr::NamedConf.new
|
69
72
|
@nc.file = 'testfile.conf'
|
70
73
|
@nc.bind_location = ''
|
@@ -79,6 +82,18 @@ alias1 IN CNAME ns
|
|
79
82
|
expect { Bind9mgr::NamedConf.new }.to_not raise_error
|
80
83
|
end
|
81
84
|
|
85
|
+
it "should fill zone parametrs after add" do
|
86
|
+
@nc.add_zone "example.com"
|
87
|
+
@nc.zones.last.options[:main_ns].should eql("ns1.example.com")
|
88
|
+
end
|
89
|
+
|
90
|
+
it "should update undefined zone options on write" do
|
91
|
+
Bind9mgr::Zone.any_instance.stub(:write_db_file)
|
92
|
+
@nc.zones << Bind9mgr::Zone.new("emptyzone.com")
|
93
|
+
@nc.write_zones
|
94
|
+
@nc.zones.last.options[:main_ns].should eql("ns1.example.com")
|
95
|
+
end
|
96
|
+
|
82
97
|
it "should fail to add_zone(some_string) unless bind_location filled" do
|
83
98
|
@nc.bind_location = nil
|
84
99
|
expect { @nc.add_zone('example.com') }.to raise_error(ArgumentError)
|
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.2.
|
4
|
+
version: 0.2.7
|
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-16 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: &13259340 !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: *13259340
|
26
26
|
description: This gem contains some classes to manage bind9 zone files
|
27
27
|
email:
|
28
28
|
- mikhail@mad-box.ru
|