smart_proxy_dns_infoblox 0.0.7 → 0.0.8
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 +4 -4
- data/lib/smart_proxy_dns_infoblox/dns_infoblox_main.rb +17 -1
- data/lib/smart_proxy_dns_infoblox/dns_infoblox_version.rb +1 -1
- data/lib/smart_proxy_dns_infoblox/infoblox_member_dns.rb +19 -0
- data/lib/smart_proxy_dns_infoblox/plugin_configuration.rb +1 -0
- data/test/infoblox_test.rb +33 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 786631c2c2929335d895bb171f087fb3481c84a0e9b0c365431ae6de0e22adcc
|
4
|
+
data.tar.gz: 9fec1c9e89928b02a9e405f852996042795e2b7add7411458c015c40817a814e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5f1e9f182f123bd9aebc8489ae8d402f3f3ac91e2ba8aa36bcbc947ffe6441ce743508c41bd63206c2353ef3a944e8a59629b4e96b62b9546af650842ed820d
|
7
|
+
data.tar.gz: 2a8d73c0fdeda7c3c74cb3181aae682ae193b5fbbba9a1160ea6df38008e06f8feabc0d9239a0abded82e9d26bef8ccbf3da0ead4deae13cde83ce4e89073475
|
@@ -74,7 +74,23 @@ module Proxy::Dns::Infoblox
|
|
74
74
|
record = clazz.find(connection, params.merge(:_max_results => 1)).first
|
75
75
|
|
76
76
|
raise Proxy::Dns::NotFound, "Cannot find #{clazz.class.name} entry for #{params}" if record.nil?
|
77
|
-
record.delete || (raise Proxy::Dns::NotFound, "Cannot find #{clazz.class.name} entry for #{params}")
|
77
|
+
ret_value = record.delete || (raise Proxy::Dns::NotFound, "Cannot find #{clazz.class.name} entry for #{params}")
|
78
|
+
|
79
|
+
ib_clear_dns_cache(record)
|
80
|
+
|
81
|
+
ret_value
|
82
|
+
end
|
83
|
+
|
84
|
+
def ib_clear_dns_cache(record)
|
85
|
+
# Created in WAPI version 2.6
|
86
|
+
return if Gem::Version.new(Infoblox.wapi_version) < Gem::Version.new('2.6')
|
87
|
+
|
88
|
+
MemberDns.all(connection).each do |member|
|
89
|
+
member.clear_dns_cache(view: record.view, domain: record.name)
|
90
|
+
end
|
91
|
+
rescue StandardError => ex
|
92
|
+
# Failing to clear the DNS cache should never be an error
|
93
|
+
logger.warn("Exception #{ex} was raised when clearing DNS cache")
|
78
94
|
end
|
79
95
|
end
|
80
96
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Proxy::Dns::Infoblox
|
2
|
+
class MemberDns < Infoblox::Resource
|
3
|
+
remote_attr_reader :host_name
|
4
|
+
|
5
|
+
wapi_object 'member:dns'
|
6
|
+
|
7
|
+
def clear_dns_cache(clear_full_tree: false,
|
8
|
+
domain: nil,
|
9
|
+
view: nil)
|
10
|
+
post_body = {
|
11
|
+
clear_full_tree: clear_full_tree
|
12
|
+
}
|
13
|
+
post_body[:domain] = domain unless domain.nil?
|
14
|
+
post_body[:view] = view unless view.nil?
|
15
|
+
|
16
|
+
JSON.parse(connection.post(resource_uri + "?_function=clear_dns_cache", post_body).body)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -4,6 +4,7 @@ module Proxy::Dns::Infoblox
|
|
4
4
|
require 'infoblox'
|
5
5
|
require 'dns_common/dns_common'
|
6
6
|
require 'smart_proxy_dns_infoblox/dns_infoblox_main'
|
7
|
+
require 'smart_proxy_dns_infoblox/infoblox_member_dns'
|
7
8
|
end
|
8
9
|
|
9
10
|
def load_dependency_injection_wirings(container_instance, settings)
|
data/test/infoblox_test.rb
CHANGED
@@ -2,6 +2,7 @@ require 'test_helper'
|
|
2
2
|
require 'dns_common/dns_common'
|
3
3
|
require 'infoblox'
|
4
4
|
require 'smart_proxy_dns_infoblox/dns_infoblox_main'
|
5
|
+
require 'smart_proxy_dns_infoblox/infoblox_member_dns'
|
5
6
|
|
6
7
|
class InfobloxTest < Test::Unit::TestCase
|
7
8
|
class DummyRecord
|
@@ -90,4 +91,36 @@ class InfobloxTest < Test::Unit::TestCase
|
|
90
91
|
@provider.expects(:ib_delete).with(Infoblox::Ptr, :ipv6addr => ip)
|
91
92
|
@provider.do_remove(ptr, 'PTR')
|
92
93
|
end
|
94
|
+
|
95
|
+
def test_wapi_old
|
96
|
+
fqdn = 'test.example.com'
|
97
|
+
record = Infoblox::Arecord.new name: fqdn
|
98
|
+
record.stubs(:delete).returns(record)
|
99
|
+
|
100
|
+
old_version = Infoblox.wapi_version
|
101
|
+
Infoblox.wapi_version = '2.0'
|
102
|
+
|
103
|
+
Infoblox::Arecord.expects(:find).returns([record])
|
104
|
+
Proxy::Dns::Infoblox::MemberDns.expects(:all).never
|
105
|
+
@provider.do_remove(fqdn, 'A')
|
106
|
+
ensure
|
107
|
+
Infoblox.wapi_version = old_version
|
108
|
+
end
|
109
|
+
|
110
|
+
def test_wapi_new
|
111
|
+
fqdn = 'test.example.com'
|
112
|
+
record = Infoblox::Arecord.new name: fqdn, view: 'test'
|
113
|
+
record.stubs(:delete).returns(record)
|
114
|
+
member = Proxy::Dns::Infoblox::MemberDns.new name: 'ns1.example.com'
|
115
|
+
|
116
|
+
old_version = Infoblox.wapi_version
|
117
|
+
Infoblox.wapi_version = '2.7'
|
118
|
+
|
119
|
+
Infoblox::Arecord.expects(:find).returns([record])
|
120
|
+
Proxy::Dns::Infoblox::MemberDns.expects(:all).returns([member])
|
121
|
+
member.expects(:clear_dns_cache).with(view: 'test', domain: fqdn)
|
122
|
+
@provider.do_remove(fqdn, 'A')
|
123
|
+
ensure
|
124
|
+
Infoblox.wapi_version = old_version
|
125
|
+
end
|
93
126
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smart_proxy_dns_infoblox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Nicholson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -39,6 +39,7 @@ files:
|
|
39
39
|
- lib/smart_proxy_dns_infoblox/dns_infoblox_main.rb
|
40
40
|
- lib/smart_proxy_dns_infoblox/dns_infoblox_plugin.rb
|
41
41
|
- lib/smart_proxy_dns_infoblox/dns_infoblox_version.rb
|
42
|
+
- lib/smart_proxy_dns_infoblox/infoblox_member_dns.rb
|
42
43
|
- lib/smart_proxy_dns_infoblox/plugin_configuration.rb
|
43
44
|
- test/configuration_test.rb
|
44
45
|
- test/infoblox_test.rb
|