powerdns_db_cli 0.0.2 → 0.0.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 041f7b796c0fbc1aa45969382b429fd77b8f43f5
4
- data.tar.gz: 29e85135c8226e9211eb79451245bb23ef357b31
3
+ metadata.gz: 2f90ea9914b10e0c13277076fa5869eaf3feb25a
4
+ data.tar.gz: e7e6ce64246c35f98a208e3c3771b3d2c40cb5e5
5
5
  SHA512:
6
- metadata.gz: 62e12b5ca43fa88d5781d718e99300f235d840cbe6b9e5cbaa8b9ff4ba2825fafe0af0aa3369723e51877360e29a6876bbd41bf8423467e38863fe6cdb88c72c
7
- data.tar.gz: d14579a3a107701f2d92b5c04a80dae00c03b9d8196fe0540113fe2c99d1dd02b6266aee0bc1031d31bb8aa6c46afe239f57a0c38647432c2356b80254678873
6
+ metadata.gz: dfa32a7ba227274b9e7dd7c764c2be2216c76553c1251893a346031b60ac3ab405d69e7ee24283050e94af6f576df2317cd0c700c665428daedc09fb601b7250
7
+ data.tar.gz: 19353ec5cb177fbe901d2ec9025e24159603063fee8534f1c983696a2038e00b7b269bad31493b9fd6bec7ff8a318d24a8659641b0a5012d76a99328e1e56dc0
data/Gemfile CHANGED
@@ -1,4 +1,2 @@
1
1
  source 'https://rubygems.org'
2
2
  gemspec
3
-
4
- gem 'pg'
data/README.md CHANGED
@@ -17,4 +17,12 @@ Or from rubygems.org:
17
17
  Usage
18
18
  -----
19
19
 
20
- For now, only the [Active Record Query Interface](http://guides.rubyonrails.org/active_record_querying.html) works which is invoked by `pdns -i`.
20
+ pdns domain list
21
+ pdns domain create <name>
22
+ pdns domain remove <name>
23
+
24
+ pdns record list <domain>
25
+ pdns record create <domain> <name> <type> <content> [prio] [ttl] [auth]
26
+ pdns record remove <domain> <name> <type> [content] [prio]
27
+
28
+ With `pdns -i`, it is also possible to interact with the database direcly using the [Active Record Query Interface](http://guides.rubyonrails.org/active_record_querying.html).
@@ -9,13 +9,14 @@ module PowerDNS
9
9
  PATH = File.expand_path('~/.config/PowerDNS/db_cli.yml')
10
10
 
11
11
  DEFAULT = {
12
- adapter: 'postgresql',
13
- host: 'localhost',
14
- port: 5432,
15
- database: 'pdns',
16
- username: 'postgres',
17
- password: '',
18
- default_soa: 'ns.example.com. dns.example.com. 1970010100 60 3600 604800 40000'
12
+ 'adapter' => 'postgresql',
13
+ 'host' => 'localhost',
14
+ 'port' => 5432,
15
+ 'database' => 'pdns',
16
+ 'username' => 'postgres',
17
+ 'password' => '',
18
+ 'default_soa' => 'ns.example.com. dns.example.com. 1970010100 60 3600 604800 40000',
19
+ 'default_ns' => []
19
20
  }
20
21
 
21
22
  def initialize
@@ -7,6 +7,7 @@ module PowerDNS
7
7
  has_many :records, dependent: :destroy
8
8
 
9
9
  after_create :create_soa_record
10
+ after_create :create_ns_records
10
11
 
11
12
  self.inheritance_column = :sti
12
13
 
@@ -40,11 +41,23 @@ module PowerDNS
40
41
 
41
42
  private
42
43
 
44
+ def create_ns_records
45
+ Config.instance['default_ns'].each do |server|
46
+ records.create! \
47
+ name: self.name,
48
+ type: 'NS',
49
+ content: server,
50
+ ttl: 38400,
51
+ prio: 0,
52
+ auth: true
53
+ end
54
+ end
55
+
43
56
  def create_soa_record
44
57
  records.create! \
45
58
  name: self.name,
46
59
  type: 'SOA',
47
- content: Config.instance[:default_soa],
60
+ content: Config.instance['default_soa'],
48
61
  ttl: 38400,
49
62
  prio: 0,
50
63
  auth: true
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'powerdns_db_cli'
3
- s.version = '0.0.2'
3
+ s.version = '0.0.3'
4
4
  s.authors = ['henning mueller']
5
5
  s.email = ['mail@nning.io']
6
6
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: powerdns_db_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - henning mueller