bind9mgr 0.3.11 → 0.3.12

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -73,8 +73,12 @@
73
73
 
74
74
  * bug fixes
75
75
 
76
- === 0.3.11
76
+ === 0.3.11 / 2011-12-13
77
77
 
78
78
  * Zone db file generation fix (bad new lines)
79
79
  * NamedConf#add_zone adds default records wthen called with string
80
80
  * Tests update
81
+
82
+ === 0.3.11 / 2011-12-26
83
+
84
+ * Missing newLine after rr in generated zone db files bug fix
data/lib/bind9mgr.rb CHANGED
@@ -6,7 +6,7 @@ require File.join( File.dirname(__FILE__), 'resource_record' )
6
6
  require File.join( File.dirname(__FILE__), 'parser' )
7
7
 
8
8
  module Bind9mgr
9
- VERSION = '0.3.11'
9
+ VERSION = '0.3.12'
10
10
 
11
11
  ZONES_BIND_SUBDIR = 'primary'
12
12
 
data/lib/zone.rb CHANGED
@@ -84,7 +84,7 @@ module Bind9mgr
84
84
 
85
85
  rrhash.keys.each do |rr_type|
86
86
  cont << ";;; #{rr_type} ;;;\n"
87
- cont << rrhash[rr_type].map{ |r| r.gen_rr_string }.join
87
+ cont << rrhash[rr_type].map{ |r| r.gen_rr_string }.join("\n")
88
88
  cont << "\n"
89
89
  end
90
90
 
@@ -92,6 +92,7 @@ module Bind9mgr
92
92
  end
93
93
 
94
94
  def write_db_file
95
+ raise ArgumentError, "File not specified" if @file.nil? || @file.length < 1
95
96
  db_dir = File.dirname( @file )
96
97
  raise( Errno::ENOENT, "No such dir: #{db_dir}" ) unless File.exists? db_dir
97
98
  File.open( @file, 'w' ){|f| f.write( gen_db_content )}
@@ -99,6 +100,7 @@ module Bind9mgr
99
100
 
100
101
  def add_default_rrs
101
102
  raise ArgumentError, "Main ns not specified" unless @options[:main_ns]
103
+ # TODO main server ip should be renamed to default server ip (or what?)
102
104
  raise ArgumentError, "Main server ip not specified" unless @options[:main_server_ip]
103
105
 
104
106
  ensure_soa_rr( default_soa )
@@ -190,7 +192,8 @@ zone "#{name}" {
190
192
  end
191
193
 
192
194
  def initialized?
193
- raise( ArgumentError, "zone not initialized" ) if @origin.nil? || @file.nil?
195
+ raise( ArgumentError, "zone not initialized" ) if @origin.nil?
196
+ puts "WARNING: @file undefined" unless @file.nil?
194
197
  end
195
198
 
196
199
  end
data/spec/zone_spec.rb CHANGED
@@ -35,6 +35,16 @@ alias1 IN CNAME ns
35
35
  Bind9mgr::Zone.new.should be_kind_of( Bind9mgr::Zone )
36
36
  end
37
37
 
38
+ it "should generate default rrs without @file association" do
39
+ zone = Bind9mgr::Zone.new
40
+ zone.name = 'test.ru'
41
+ zone.options[:main_ns] = 'ns.test.ru'
42
+ zone.options[:main_server_ip] = '123.123.123.123'
43
+ zone.options[:support_email] = 'adm@test.ru'
44
+ zone.records.count.should == 0
45
+ expect{ zone.add_default_rrs }.not_to raise_error
46
+ zone.records.count.should == 4
47
+ end
38
48
 
39
49
  it "should fill itself with data on load method call" do
40
50
  @zone.load
@@ -43,13 +53,19 @@ alias1 IN CNAME ns
43
53
 
44
54
  pending "should fail to generate db file content unless mandatory options filled"
45
55
  pending "should raise if wrong rr type specified"
46
- pending "should not write repeating rrs"
56
+
57
+ it "should not write file unless file specified" do
58
+ @zone.file = nil
59
+ expect{ @zone.write_db_file }.to raise_error
60
+ end
61
+
47
62
  it "should generate db file content" do
48
63
  @zone.load
49
64
  cont = @zone.gen_db_content
50
65
  cont.should be_kind_of( String )
51
66
  cont.match(/#{@zone.origin}/m).should be
52
67
  end
68
+
53
69
  pending "should generate zone entry content"
54
70
 
55
71
  describe "records creation & validation" 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.11
4
+ version: 0.3.12
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-13 00:00:00.000000000Z
12
+ date: 2011-12-27 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: hoe
16
- requirement: &15371660 !ruby/object:Gem::Requirement
16
+ requirement: &24340360 !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: *15371660
24
+ version_requirements: *24340360
25
25
  description: This gem contains some classes to manage bind9 zone files
26
26
  email:
27
27
  - mikhail@mad-box.ru