infrataster-plugin-dns 0.0.1
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 +7 -0
- data/.gitignore +16 -0
- data/.rubocop.yml +15 -0
- data/.travis.yml +8 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +70 -0
- data/Rakefile +62 -0
- data/infrataster-plugin-dns.gemspec +30 -0
- data/lib/infrataster/contexts/dns_context.rb +15 -0
- data/lib/infrataster/helpers/dns_resource_helper.rb +61 -0
- data/lib/infrataster/resources/dns_resource.rb +10 -0
- data/lib/infrataster-plugin-dns.rb +5 -0
- data/lib/infrataster_plugin_dns/version.rb +8 -0
- data/spec/dns_spec.rb +13 -0
- data/spec/integration/dns_spec.rb +13 -0
- data/spec/integration/spec_helper.rb +7 -0
- data/spec/integration/vm/.vagrant/machines/dns/virtualbox/action_provision +1 -0
- data/spec/integration/vm/192.0.2.rev.zone +11 -0
- data/spec/integration/vm/Vagrantfile +13 -0
- data/spec/integration/vm/example.com.zone +14 -0
- data/spec/integration/vm/named.conf +69 -0
- data/spec/integration/vm/prepare_dns_service.sh +11 -0
- data/spec/spec_helper.rb +4 -0
- data/spec/unit/lib/infrataster/contexts/dns_contexts_spec.rb +17 -0
- data/spec/unit/lib/infrataster/helpers/dns_resource_helper_spec.rb +50 -0
- data/spec/unit/lib/infrataster/resources/dns_resource_spec.rb +13 -0
- data/spec/unit/spec_helper.rb +25 -0
- metadata +197 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0ff6fe7d502f4ea12bd52643bf8276fe7a072673
|
4
|
+
data.tar.gz: dcb5f5468891a45898581332779ee09b536db8d5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 563c3c2700b267e7a5dcea39d60032f9142a53aa707859d1613f65ccf7eb634b4b4815c25812a887bd0b40792987e341fa3b706e4b9dfffb4ad8edfde809d8ee
|
7
|
+
data.tar.gz: a1353aca99c002af6683290b80c11453e8f577208a90bd07d8896e0b558f30619fe2f39a113906faeea07c76614005f3a114edc7d1a7fa2928d7530e078afd26
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# Avoid methods longer than 10 lines of code
|
2
|
+
MethodLength:
|
3
|
+
Enabled: false
|
4
|
+
|
5
|
+
# Avoid classes longer than 100 lines of code
|
6
|
+
ClassLength:
|
7
|
+
Enabled: false
|
8
|
+
|
9
|
+
# allow is_a? or have_* method_name
|
10
|
+
Style/PredicateName:
|
11
|
+
Enabled: false
|
12
|
+
|
13
|
+
# allow lib/infrataster-plugin-dns.rb
|
14
|
+
Style/FileName:
|
15
|
+
Enabled: false
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 OTA Hiroshi
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
# Infrataster::Plugin::Dns
|
2
|
+
[](https://travis-ci.org/otahi/infrataster-plugin-dns)
|
3
|
+
[](https://coveralls.io/r/otahi/infrataster)
|
4
|
+
|
5
|
+
DNS plugin for Infrataster with [rspec-dns](https://github.com/spotify/rspec-dns).
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'infrataster-plugin-dns'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install infrataster-plugin-dns
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
The usage is as same as [Infrataster](https://github.com/ryotarai/infrataster).
|
26
|
+
|
27
|
+
You can use `have_entry` matcher as an alternative of
|
28
|
+
[rspec-dns](https://github.com/spotify/rspec-dns) `have_dns` matcher.
|
29
|
+
You can also use all chains for `have_dns` matcher.
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
require 'infrataster-plugin-dns'
|
33
|
+
|
34
|
+
describe server(:dns) do
|
35
|
+
describe dns('www.example.com') do
|
36
|
+
it { is_expected.to have_entry.with_type('A').and_address('192.0.2.4') }
|
37
|
+
end
|
38
|
+
describe dns('192.0.2.4') do
|
39
|
+
it do
|
40
|
+
is_expected.to have_entry.with_type('PTR')
|
41
|
+
.and_domainname('www.example.com')
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
```
|
46
|
+
|
47
|
+
You can get following result:
|
48
|
+
|
49
|
+
```
|
50
|
+
$ bundle exec rspec
|
51
|
+
|
52
|
+
server 'dns'
|
53
|
+
dns 'www.example.com'
|
54
|
+
should have the correct dns entries with {:type=>"A", :address=>"192.0.2.4"}
|
55
|
+
dns '192.0.2.4'
|
56
|
+
should have the correct dns entries with {:type=>"PTR", :domainname=>"www.example.com"}
|
57
|
+
|
58
|
+
Finished in 0.03599 seconds (files took 0.93903 seconds to load)
|
59
|
+
2 examples, 0 failures
|
60
|
+
$
|
61
|
+
```
|
62
|
+
|
63
|
+
|
64
|
+
## Contributing
|
65
|
+
|
66
|
+
1. Fork it ( https://github.com/otahi/infrataster-plugin-dns/fork )
|
67
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
68
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
69
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
70
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
require 'open-uri'
|
4
|
+
require 'coveralls/rake/task'
|
5
|
+
require 'rubocop/rake_task'
|
6
|
+
|
7
|
+
task :default => ['spec:unit', :quality]
|
8
|
+
|
9
|
+
def yellow(str)
|
10
|
+
"\e[33m#{str}\e[m"
|
11
|
+
end
|
12
|
+
|
13
|
+
cwd = File.expand_path('spec/integration/vm')
|
14
|
+
|
15
|
+
desc 'Run unit and integration tests'
|
16
|
+
task :spec => ['spec:unit', 'spec:integration']
|
17
|
+
|
18
|
+
namespace :spec do
|
19
|
+
RSpec::Core::RakeTask.new('unit') do |task|
|
20
|
+
task.pattern = './spec/unit{,/*/**}/*_spec.rb'
|
21
|
+
end
|
22
|
+
|
23
|
+
RSpec::Core::RakeTask.new('integration') do |task|
|
24
|
+
task.pattern = './spec/integration{,/*/**}/*_spec.rb'
|
25
|
+
end
|
26
|
+
|
27
|
+
namespace :integration do
|
28
|
+
integration_dir = 'spec/integration'
|
29
|
+
|
30
|
+
desc 'Clean'
|
31
|
+
task :clean => ['destroy_vm'] do
|
32
|
+
end
|
33
|
+
|
34
|
+
desc 'Prepare'
|
35
|
+
task :prepare => ['start_vm'] do
|
36
|
+
end
|
37
|
+
|
38
|
+
task :start_vm do
|
39
|
+
puts yellow('Starting VM...')
|
40
|
+
Dir.chdir(cwd) do
|
41
|
+
system 'vagrant', 'reload', '--provision'
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
task :destroy_vm do
|
46
|
+
puts yellow('Destroying VM...')
|
47
|
+
Dir.chdir(cwd) do
|
48
|
+
system 'vagrant', 'destroy', '-f'
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
RuboCop::RakeTask.new(:rubocop) do |task|
|
56
|
+
task.patterns = %w(lib/**/*.rb spec/unit/**/*.rb)
|
57
|
+
end
|
58
|
+
|
59
|
+
task :quality => :rubocop do
|
60
|
+
Coveralls::RakeTask.new
|
61
|
+
end
|
62
|
+
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'infrataster_plugin_dns/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'infrataster-plugin-dns'
|
8
|
+
spec.version = Infrataster::Plugin::Dns::VERSION
|
9
|
+
spec.authors = ['Hiroshi Ota']
|
10
|
+
spec.email = ['otahi.pub@gmail.com']
|
11
|
+
spec.summary = 'DNS plugin for Infrataster'
|
12
|
+
spec.description = 'DNS plugin for Infrataster with rspec-dns'
|
13
|
+
spec.homepage = 'https://github.com/otahi/infrataster-plugin-dns'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_runtime_dependency 'infrataster', '~> 0.2.0'
|
22
|
+
spec.add_runtime_dependency 'rspec-dns', '~> 0.1.3'
|
23
|
+
|
24
|
+
spec.add_development_dependency 'bundler', '~> 1.7'
|
25
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
26
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
27
|
+
spec.add_development_dependency 'rubocop', '0.28.0'
|
28
|
+
spec.add_development_dependency 'coveralls', '~> 0.7'
|
29
|
+
spec.add_development_dependency 'byebug' if RUBY_VERSION >= '2.0'
|
30
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'infrataster'
|
2
|
+
require 'rspec-dns'
|
3
|
+
|
4
|
+
module Infrataster
|
5
|
+
module Contexts
|
6
|
+
# Infrataster DNS context
|
7
|
+
class DnsContext < BaseContext
|
8
|
+
include RSpec::Matchers
|
9
|
+
|
10
|
+
def have_entry(*_args)
|
11
|
+
have_dns.config(nameserver: server.address)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require 'infrataster/resources'
|
3
|
+
require 'dnsruby/name'
|
4
|
+
require 'ipaddr'
|
5
|
+
|
6
|
+
module Infrataster
|
7
|
+
module Helpers
|
8
|
+
# Infrataster resource helper
|
9
|
+
module ResourceHelper
|
10
|
+
def dns(*args)
|
11
|
+
Dns.create_target(args.first)
|
12
|
+
end
|
13
|
+
|
14
|
+
# Infrataster DNS resource helper
|
15
|
+
# RSpec tend to parent's described class if described class is String
|
16
|
+
# But rspec-dns needs String class or Dnsruby::Name class
|
17
|
+
# To avoid using parent's decribed class, define methods to immitate
|
18
|
+
module Dns
|
19
|
+
def self.create_target(name)
|
20
|
+
target = create_name(name)
|
21
|
+
define_methods(target)
|
22
|
+
target
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def self.define_methods(target)
|
28
|
+
def target.is_a?(klass)
|
29
|
+
super || Resources::DnsResource == klass ||
|
30
|
+
Resources::BaseResource == klass
|
31
|
+
end
|
32
|
+
|
33
|
+
def target.to_s
|
34
|
+
"dns '#{@original}'"
|
35
|
+
end
|
36
|
+
|
37
|
+
def target.context_class
|
38
|
+
Contexts.const_get('DnsContext')
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.create_name(string)
|
43
|
+
if ip?(string)
|
44
|
+
name = Dnsruby::Name.create(IPAddr.new(string).reverse)
|
45
|
+
else
|
46
|
+
name = Dnsruby::Name.create(string)
|
47
|
+
end
|
48
|
+
name.instance_variable_set(:@original, string)
|
49
|
+
name
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.ip?(string)
|
53
|
+
IPAddr.new(string)
|
54
|
+
true
|
55
|
+
rescue
|
56
|
+
false
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
data/spec/dns_spec.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe server(:dns) do
|
4
|
+
describe dns('www.example.com') do
|
5
|
+
it { is_expected.to have_entry.with_type('A').and_address('192.0.2.4') }
|
6
|
+
end
|
7
|
+
describe dns('192.0.2.4') do
|
8
|
+
it do
|
9
|
+
is_expected.to have_entry.with_type('PTR')
|
10
|
+
.and_domainname('www.example.com')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe server(:dns) do
|
4
|
+
describe dns('www.example.com') do
|
5
|
+
it { is_expected.to have_entry.with_type('A').and_address('192.0.2.4') }
|
6
|
+
end
|
7
|
+
describe dns('192.0.2.4') do
|
8
|
+
it do
|
9
|
+
is_expected.to have_entry.with_type('PTR')
|
10
|
+
.and_domainname('www.example.com')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
1.5:fb18d838-b283-47d5-ac34-fbdb08ad7704
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# Vagrantfile
|
2
|
+
Vagrant.configure("2") do |config|
|
3
|
+
config.vm.box = "hfm4/centos7"
|
4
|
+
|
5
|
+
config.vm.define :dns do |c|
|
6
|
+
c.vm.network 'private_network', ip: '192.168.33.10'
|
7
|
+
end
|
8
|
+
config.vm.provider 'virtualbox' do |v|
|
9
|
+
v.customize ['modifyvm', :id, '--memory', '256']
|
10
|
+
end
|
11
|
+
|
12
|
+
config.vm.provision :shell, path: 'prepare_dns_service.sh'
|
13
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
//
|
2
|
+
// named.conf
|
3
|
+
//
|
4
|
+
// Provided by Red Hat bind package to configure the ISC BIND named(8) DNS
|
5
|
+
// server as a caching only nameserver (as a localhost DNS resolver only).
|
6
|
+
//
|
7
|
+
// See /usr/share/doc/bind*/sample/ for example named configuration files.
|
8
|
+
//
|
9
|
+
|
10
|
+
options {
|
11
|
+
// listen-on port 53 { 127.0.0.1; };
|
12
|
+
// listen-on-v6 port 53 { ::1; };
|
13
|
+
directory "/var/named";
|
14
|
+
dump-file "/var/named/data/cache_dump.db";
|
15
|
+
statistics-file "/var/named/data/named_stats.txt";
|
16
|
+
memstatistics-file "/var/named/data/named_mem_stats.txt";
|
17
|
+
//allow-query { localhost; };
|
18
|
+
allow-query { 0.0.0.0/0; };
|
19
|
+
|
20
|
+
/*
|
21
|
+
- If you are building an AUTHORITATIVE DNS server, do NOT enable recursion.
|
22
|
+
- If you are building a RECURSIVE (caching) DNS server, you need to enable
|
23
|
+
recursion.
|
24
|
+
- If your recursive DNS server has a public IP address, you MUST enable access
|
25
|
+
control to limit queries to your legitimate users. Failing to do so will
|
26
|
+
cause your server to become part of large scale DNS amplification
|
27
|
+
attacks. Implementing BCP38 within your network would greatly
|
28
|
+
reduce such attack surface
|
29
|
+
*/
|
30
|
+
recursion yes;
|
31
|
+
|
32
|
+
dnssec-enable yes;
|
33
|
+
dnssec-validation yes;
|
34
|
+
dnssec-lookaside auto;
|
35
|
+
|
36
|
+
/* Path to ISC DLV key */
|
37
|
+
bindkeys-file "/etc/named.iscdlv.key";
|
38
|
+
|
39
|
+
managed-keys-directory "/var/named/dynamic";
|
40
|
+
|
41
|
+
pid-file "/run/named/named.pid";
|
42
|
+
session-keyfile "/run/named/session.key";
|
43
|
+
};
|
44
|
+
|
45
|
+
logging {
|
46
|
+
channel default_debug {
|
47
|
+
file "data/named.run";
|
48
|
+
severity dynamic;
|
49
|
+
};
|
50
|
+
};
|
51
|
+
|
52
|
+
zone "." IN {
|
53
|
+
type hint;
|
54
|
+
file "named.ca";
|
55
|
+
};
|
56
|
+
|
57
|
+
zone "example.com." IN {
|
58
|
+
type master;
|
59
|
+
file "example.com.zone";
|
60
|
+
};
|
61
|
+
|
62
|
+
zone "2.0.192.in-addr.arpa" IN {
|
63
|
+
type master;
|
64
|
+
file "192.0.2.rev.zone";
|
65
|
+
};
|
66
|
+
|
67
|
+
include "/etc/named.rfc1912.zones";
|
68
|
+
include "/etc/named.root.key";
|
69
|
+
|
@@ -0,0 +1,11 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
yum install bind -y
|
3
|
+
|
4
|
+
install -m640 -oroot -gnamed /vagrant/named.conf /etc/
|
5
|
+
install -m640 -oroot -gnamed /vagrant/example.com.zone /var/named/
|
6
|
+
install -m640 -oroot -gnamed /vagrant/192.0.2.rev.zone /var/named/
|
7
|
+
|
8
|
+
firewall-cmd --permanent --zone=trusted --add-service=dns
|
9
|
+
firewall-cmd --zone=trusted --change-interface=eth1
|
10
|
+
firewall-cmd --reload
|
11
|
+
systemctl restart named.service
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'unit/spec_helper'
|
2
|
+
|
3
|
+
module Infrataster
|
4
|
+
# Infrataster contexts
|
5
|
+
module Contexts
|
6
|
+
describe DnsContext do
|
7
|
+
let(:server) { Server.new('ns.example.com', '192.168.33.10', :dns) }
|
8
|
+
subject { described_class.new(server, nil) }
|
9
|
+
it 'should have `have_entry` method' do
|
10
|
+
matcher = double('matcher')
|
11
|
+
allow(matcher).to receive(:config)
|
12
|
+
allow(subject).to receive(:have_dns).and_return(matcher)
|
13
|
+
subject.have_entry
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'unit/spec_helper'
|
2
|
+
|
3
|
+
module Infrataster
|
4
|
+
# Infrataster Helpers
|
5
|
+
module Helpers
|
6
|
+
# Infrataster Helpers Implementation
|
7
|
+
class ResourceHelperImpl
|
8
|
+
include ResourceHelper
|
9
|
+
end
|
10
|
+
|
11
|
+
describe ResourceHelper do
|
12
|
+
context 'created resource by #dns' do
|
13
|
+
subject { ResourceHelperImpl.new.dns('www.example.com') }
|
14
|
+
|
15
|
+
it 'should be a Dnsruby::Name' do
|
16
|
+
expect(subject.is_a?(Dnsruby::Name)).to be true
|
17
|
+
end
|
18
|
+
it 'should be a Resources::DnsResource' do
|
19
|
+
expect(subject.is_a?(Resources::DnsResource)).to be true
|
20
|
+
end
|
21
|
+
it 'should be a Resources::BaseResource' do
|
22
|
+
expect(subject.is_a?(Resources::BaseResource)).to be true
|
23
|
+
end
|
24
|
+
it 'should be a Resources::BaseResource' do
|
25
|
+
expect(subject.is_a?(Resources::BaseResource)).to be true
|
26
|
+
end
|
27
|
+
it %q(should be "dns 'string'") do
|
28
|
+
expect(subject.to_s).to eq("dns 'www.example.com'")
|
29
|
+
end
|
30
|
+
it 'should have Contexts::DnsContext' do
|
31
|
+
expect(subject.context_class).to eq(Contexts::DnsContext)
|
32
|
+
end
|
33
|
+
context 'with host name' do
|
34
|
+
subject { ResourceHelperImpl.new.dns('www.example.com') }
|
35
|
+
|
36
|
+
it 'should be a host name' do
|
37
|
+
expect(subject.to_s).to eq("dns 'www.example.com'")
|
38
|
+
end
|
39
|
+
end
|
40
|
+
context 'with IP address' do
|
41
|
+
subject { ResourceHelperImpl.new.dns('192.0.2.4') }
|
42
|
+
|
43
|
+
it 'should be a host name' do
|
44
|
+
expect(subject.to_s).to eq("dns '192.0.2.4'")
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'coveralls'
|
2
|
+
Coveralls.wear!
|
3
|
+
|
4
|
+
require 'simplecov'
|
5
|
+
|
6
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
7
|
+
SimpleCov::Formatter::HTMLFormatter,
|
8
|
+
Coveralls::SimpleCov::Formatter
|
9
|
+
]
|
10
|
+
SimpleCov.start do
|
11
|
+
add_filter '.bundle/'
|
12
|
+
end
|
13
|
+
|
14
|
+
require 'rspec'
|
15
|
+
require 'infrataster-plugin-dns'
|
16
|
+
|
17
|
+
def stub_records(strings)
|
18
|
+
records = strings.map { |s| Dnsruby::RR.new_from_string(s) }
|
19
|
+
resolver = Dnsruby::Resolver.new
|
20
|
+
allow(Dnsruby::Resolver).to receive(:new) do
|
21
|
+
yield if block_given?
|
22
|
+
resolver
|
23
|
+
end
|
24
|
+
allow(resolver).to receive_message_chain(:query, :answer).and_return(records)
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,197 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: infrataster-plugin-dns
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Hiroshi Ota
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-01-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: infrataster
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.2.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.2.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec-dns
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.1.3
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.1.3
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.7'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.7'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.28.0
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.28.0
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: coveralls
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0.7'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0.7'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: byebug
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
description: DNS plugin for Infrataster with rspec-dns
|
126
|
+
email:
|
127
|
+
- otahi.pub@gmail.com
|
128
|
+
executables: []
|
129
|
+
extensions: []
|
130
|
+
extra_rdoc_files: []
|
131
|
+
files:
|
132
|
+
- ".gitignore"
|
133
|
+
- ".rubocop.yml"
|
134
|
+
- ".travis.yml"
|
135
|
+
- Gemfile
|
136
|
+
- LICENSE.txt
|
137
|
+
- README.md
|
138
|
+
- Rakefile
|
139
|
+
- infrataster-plugin-dns.gemspec
|
140
|
+
- lib/infrataster-plugin-dns.rb
|
141
|
+
- lib/infrataster/contexts/dns_context.rb
|
142
|
+
- lib/infrataster/helpers/dns_resource_helper.rb
|
143
|
+
- lib/infrataster/resources/dns_resource.rb
|
144
|
+
- lib/infrataster_plugin_dns/version.rb
|
145
|
+
- spec/dns_spec.rb
|
146
|
+
- spec/integration/dns_spec.rb
|
147
|
+
- spec/integration/spec_helper.rb
|
148
|
+
- spec/integration/vm/.vagrant/machines/dns/virtualbox/action_provision
|
149
|
+
- spec/integration/vm/192.0.2.rev.zone
|
150
|
+
- spec/integration/vm/Vagrantfile
|
151
|
+
- spec/integration/vm/example.com.zone
|
152
|
+
- spec/integration/vm/named.conf
|
153
|
+
- spec/integration/vm/prepare_dns_service.sh
|
154
|
+
- spec/spec_helper.rb
|
155
|
+
- spec/unit/lib/infrataster/contexts/dns_contexts_spec.rb
|
156
|
+
- spec/unit/lib/infrataster/helpers/dns_resource_helper_spec.rb
|
157
|
+
- spec/unit/lib/infrataster/resources/dns_resource_spec.rb
|
158
|
+
- spec/unit/spec_helper.rb
|
159
|
+
homepage: https://github.com/otahi/infrataster-plugin-dns
|
160
|
+
licenses:
|
161
|
+
- MIT
|
162
|
+
metadata: {}
|
163
|
+
post_install_message:
|
164
|
+
rdoc_options: []
|
165
|
+
require_paths:
|
166
|
+
- lib
|
167
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
168
|
+
requirements:
|
169
|
+
- - ">="
|
170
|
+
- !ruby/object:Gem::Version
|
171
|
+
version: '0'
|
172
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
173
|
+
requirements:
|
174
|
+
- - ">="
|
175
|
+
- !ruby/object:Gem::Version
|
176
|
+
version: '0'
|
177
|
+
requirements: []
|
178
|
+
rubyforge_project:
|
179
|
+
rubygems_version: 2.2.2
|
180
|
+
signing_key:
|
181
|
+
specification_version: 4
|
182
|
+
summary: DNS plugin for Infrataster
|
183
|
+
test_files:
|
184
|
+
- spec/dns_spec.rb
|
185
|
+
- spec/integration/dns_spec.rb
|
186
|
+
- spec/integration/spec_helper.rb
|
187
|
+
- spec/integration/vm/.vagrant/machines/dns/virtualbox/action_provision
|
188
|
+
- spec/integration/vm/192.0.2.rev.zone
|
189
|
+
- spec/integration/vm/Vagrantfile
|
190
|
+
- spec/integration/vm/example.com.zone
|
191
|
+
- spec/integration/vm/named.conf
|
192
|
+
- spec/integration/vm/prepare_dns_service.sh
|
193
|
+
- spec/spec_helper.rb
|
194
|
+
- spec/unit/lib/infrataster/contexts/dns_contexts_spec.rb
|
195
|
+
- spec/unit/lib/infrataster/helpers/dns_resource_helper_spec.rb
|
196
|
+
- spec/unit/lib/infrataster/resources/dns_resource_spec.rb
|
197
|
+
- spec/unit/spec_helper.rb
|