bind9mgr 0.3.10 → 0.3.11

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -68,3 +68,13 @@
68
68
  * MX validations
69
69
  * A validations
70
70
  * spec update
71
+
72
+ === 0.3.10
73
+
74
+ * bug fixes
75
+
76
+ === 0.3.11
77
+
78
+ * Zone db file generation fix (bad new lines)
79
+ * NamedConf#add_zone adds default records wthen called with string
80
+ * Tests update
data/README.txt CHANGED
@@ -25,6 +25,7 @@ TODO: more configuration features
25
25
  TODO: more conventions(feedback welcomed!)
26
26
  TODO: true domain names validations
27
27
  TODO: RFC records validations
28
+ TODO: ignore bad zone db files
28
29
 
29
30
  == SYNOPSIS:
30
31
 
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.10'
9
+ VERSION = '0.3.11'
10
10
 
11
11
  ZONES_BIND_SUBDIR = 'primary'
12
12
 
@@ -14,7 +14,7 @@ module Bind9mgr
14
14
  ALLOWED_TYPES = %w{A CNAME MX TXT PTR NS SRV SOA}
15
15
 
16
16
  class Bind9mgrError < RuntimeError; end
17
-
17
+ class InvalidZoneError < RuntimeError; end
18
18
  class ParserError < Bind9mgrError; end
19
19
  class MalformedResourceRecord < Bind9mgrError; end
20
20
  end
data/lib/named_conf.rb CHANGED
@@ -30,6 +30,7 @@ module Bind9mgr
30
30
  def load
31
31
  init_zones
32
32
  parse File.read( @file ) if File.exists?(@file)
33
+ zones
33
34
  end
34
35
 
35
36
  # Load just one zone and return it
@@ -99,9 +100,9 @@ module Bind9mgr
99
100
  if zone_or_name.kind_of?( Zone )
100
101
  raise ArgumentError, "file_name should be nil if instance of Zone supplied" unless file_name.nil?
101
102
  zone = zone_or_name
102
- elsif zone_or_name.kind_of?( String ) && ( zone_or_name.length > 4 ) # at last 'a.a.'
103
+ elsif zone_or_name.kind_of?( String )
103
104
  raise ArgumentError, "Main ns not secified" unless @main_ns
104
- # raise ArgumentError, "Secondary ns not secified" unless @secondary_ns
105
+ # TODO what to do with sec. ns? # raise ArgumentError, "Secondary ns not secified" unless @secondary_ns
105
106
  raise ArgumentError, "Support email not secified" unless @support_email
106
107
  raise ArgumentError, "Main server ip not secified" unless @main_server_ip
107
108
 
@@ -112,10 +113,13 @@ module Bind9mgr
112
113
  :support_email => @support_email,
113
114
  :main_server_ip => @main_server_ip,
114
115
  :mail_server_ip => @mail_server_ip)
116
+ zone.add_default_rrs
115
117
  else
116
118
  raise( RuntimeError, "BindZone or String instance expected, but #{zone_or_name.inspect} got")
117
119
  end
118
120
 
121
+ raise InvalidZoneError, zone.inspect unless zone.valid?
122
+
119
123
  del_zone! zone.origin
120
124
  @zones.push zone
121
125
 
@@ -68,9 +68,9 @@ module Bind9mgr
68
68
  cont << "\t#{rdata[4]} ; retry\n"
69
69
  cont << "\t#{rdata[5]} ; expire\n"
70
70
  cont << "\t#{rdata[6]} ; minimum\n"
71
- cont << ")"
71
+ cont << ")\n"
72
72
  else
73
- "#{@owner}\t#{@ttl}\t#{@klass}\t#{@type}\t#{[@rdata].flatten.join(' ')}"
73
+ "#{@owner}\t#{@ttl}\t#{@klass}\t#{@type}\t#{[@rdata].flatten.join(' ')}\n"
74
74
  end
75
75
  end
76
76
  end
data/lib/zone.rb CHANGED
@@ -84,7 +84,8 @@ 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("\n")
87
+ cont << rrhash[rr_type].map{ |r| r.gen_rr_string }.join
88
+ cont << "\n"
88
89
  end
89
90
 
90
91
  cont
@@ -172,8 +172,6 @@ alias1 IN CNAME ns
172
172
  @nc.zones.last.add_rr( 'cname', nil, nil, 'CNAME', '@' )
173
173
  @nc.zones.count.should == 3 # we specified 2 zones in "before"
174
174
  @nc.add_zone( 'example.com' )
175
- @nc.zones.last.records.count.should == 0
176
- @nc.zones.last.add_default_rrs
177
175
  @nc.zones.last.records.count.should == 5 # new zone should have SOA, A, CNAME(www) and 2*NS records
178
176
  end
179
177
 
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.10
4
+ version: 0.3.11
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-11-06 00:00:00.000000000Z
12
+ date: 2011-12-13 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: hoe
16
- requirement: &11719380 !ruby/object:Gem::Requirement
16
+ requirement: &15371660 !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: *11719380
24
+ version_requirements: *15371660
25
25
  description: This gem contains some classes to manage bind9 zone files
26
26
  email:
27
27
  - mikhail@mad-box.ru