smart_proxy_dns_infoblox 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/smart_proxy_dns_infoblox/dns_infoblox_main.rb +12 -8
- data/lib/smart_proxy_dns_infoblox/dns_infoblox_plugin.rb +2 -1
- data/lib/smart_proxy_dns_infoblox/dns_infoblox_version.rb +1 -1
- data/lib/smart_proxy_dns_infoblox/infoblox_member_dns.rb +1 -1
- data/test/infoblox_test.rb +29 -0
- data/test/integration_test.rb +3 -0
- data/test/test_helper.rb +1 -1
- metadata +5 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b3a0500e2d29b0e17690364666974cec3258457b8806c4ff743fc85179e9c67b
|
4
|
+
data.tar.gz: df9c2f18edb7a29ce56090ef1ca03f34e6454ec88d9c492c1e23d274e03717bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb8d100b528571220d9f08cda5d9772819114a2712bc2cfff82f5352d92bdeacd5163bad9465c51d6497aff9c346343d66207c7b2f579ce4c4eeee478af137bd
|
7
|
+
data.tar.gz: 916a54d5a0aa1610a4a9d034c27c913f922ad29172a10bf503f3403db182c91d2b20cbc3d250dc04a084ab8936d0f91f07cbdc454047d31fcfcde54f1b14adef
|
@@ -11,12 +11,14 @@ module Proxy::Dns::Infoblox
|
|
11
11
|
def do_create(name, value, type)
|
12
12
|
method = "ib_create_#{type.downcase}_record".to_sym
|
13
13
|
raise(Proxy::Dns::Error, "Creation of #{type} records not implemented") unless respond_to?(method, true)
|
14
|
+
|
14
15
|
send(method, name, value)
|
15
16
|
end
|
16
17
|
|
17
18
|
def do_remove(name, type)
|
18
19
|
method = "ib_remove_#{type.downcase}_record".to_sym
|
19
20
|
raise(Proxy::Dns::Error, "Deletion of #{type} records not implemented") unless respond_to?(method, true)
|
21
|
+
|
20
22
|
send(method, name)
|
21
23
|
end
|
22
24
|
|
@@ -34,6 +36,7 @@ module Proxy::Dns::Infoblox
|
|
34
36
|
|
35
37
|
return -1 if send(method, fqdn).empty?
|
36
38
|
return 0 if send(method, fqdn, address).any?
|
39
|
+
|
37
40
|
1
|
38
41
|
end
|
39
42
|
|
@@ -157,14 +160,15 @@ module Proxy::Dns::Infoblox
|
|
157
160
|
end
|
158
161
|
|
159
162
|
def ib_delete(clazz, params)
|
160
|
-
|
163
|
+
records = clazz.find(connection, params.merge(view: dns_view))
|
164
|
+
raise Proxy::Dns::NotFound, "Cannot find #{clazz.class.name} entry for #{params}" if records.empty?
|
161
165
|
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
+
records.each do |record|
|
167
|
+
record.delete
|
168
|
+
ib_clear_dns_cache(record)
|
169
|
+
end
|
166
170
|
|
167
|
-
|
171
|
+
true
|
168
172
|
end
|
169
173
|
|
170
174
|
def ib_clear_dns_cache(record)
|
@@ -174,9 +178,9 @@ module Proxy::Dns::Infoblox
|
|
174
178
|
MemberDns.all(connection).each do |member|
|
175
179
|
member.clear_dns_cache(view: record.view, domain: record.name)
|
176
180
|
end
|
177
|
-
rescue StandardError =>
|
181
|
+
rescue StandardError => e
|
178
182
|
# Failing to clear the DNS cache should never be an error
|
179
|
-
logger.warn("Exception #{
|
183
|
+
logger.warn("Exception #{e} was raised when clearing DNS cache")
|
180
184
|
end
|
181
185
|
end
|
182
186
|
end
|
@@ -2,7 +2,8 @@ module Proxy::Dns::Infoblox
|
|
2
2
|
class Plugin < ::Proxy::Provider
|
3
3
|
plugin :dns_infoblox, ::Proxy::Dns::Infoblox::VERSION
|
4
4
|
|
5
|
-
default_settings :username => 'infoblox', :password => 'infoblox', :dns_server => 'localhost',
|
5
|
+
default_settings :username => 'infoblox', :password => 'infoblox', :dns_server => 'localhost',
|
6
|
+
:dns_view => 'default', :timeout => 60
|
6
7
|
|
7
8
|
requires :dns, '>= 1.12'
|
8
9
|
|
@@ -13,7 +13,7 @@ module Proxy::Dns::Infoblox
|
|
13
13
|
post_body[:domain] = domain unless domain.nil?
|
14
14
|
post_body[:view] = view unless view.nil?
|
15
15
|
|
16
|
-
JSON.parse(connection.post(resource_uri
|
16
|
+
JSON.parse(connection.post("#{resource_uri}?_function=clear_dns_cache", post_body).body)
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
data/test/infoblox_test.rb
CHANGED
@@ -171,6 +171,35 @@ class InfobloxTest < Test::Unit::TestCase
|
|
171
171
|
@provider.do_remove(ptr, 'PTR')
|
172
172
|
end
|
173
173
|
|
174
|
+
def test_wapi_remove_multi_a_records
|
175
|
+
address1 = '192.168.1.11'
|
176
|
+
address2 = '192.168.2.22'
|
177
|
+
fqdn = 'test.example.com'
|
178
|
+
|
179
|
+
record1 = Infoblox::Arecord.new name: fqdn, :ipv4addr => address1
|
180
|
+
record1.expects(:delete).returns(record1)
|
181
|
+
record2 = Infoblox::Arecord.new name: fqdn, :ipv4addr => address2
|
182
|
+
record2.expects(:delete).returns(record2)
|
183
|
+
|
184
|
+
Infoblox::Arecord.expects(:find).returns([record1, record2])
|
185
|
+
@provider.do_remove(fqdn, 'A')
|
186
|
+
end
|
187
|
+
|
188
|
+
def test_wapi_remove_multi_ptr_records
|
189
|
+
ptr = '1.1.1.10.in-addr.arpa'
|
190
|
+
ip = '10.1.1.1'
|
191
|
+
fqdn1 = 'test1.example.com'
|
192
|
+
fqdn2 = 'test2.example.com'
|
193
|
+
|
194
|
+
record1 = Infoblox::Ptr.new name: ptr, :ptrdname => fqdn1, :ipv4addr => ip
|
195
|
+
record1.expects(:delete).returns(record1)
|
196
|
+
record2 = Infoblox::Ptr.new name: ptr, :ptrdname => fqdn2, :ipv4addr => ip
|
197
|
+
record2.expects(:delete).returns(record2)
|
198
|
+
|
199
|
+
Infoblox::Ptr.expects(:find).returns([record1, record2])
|
200
|
+
@provider.do_remove(ptr, 'PTR')
|
201
|
+
end
|
202
|
+
|
174
203
|
def test_wapi_old
|
175
204
|
fqdn = 'test.example.com'
|
176
205
|
record = Infoblox::Arecord.new name: fqdn
|
data/test/integration_test.rb
CHANGED
@@ -21,8 +21,11 @@ class IntegrationTest < ::Test::Unit::TestCase
|
|
21
21
|
include Rack::Test::Methods
|
22
22
|
|
23
23
|
class DnsProviderForTesting < Proxy::Dns::Infoblox::Record
|
24
|
+
# This explicitly doesn't want to do anything
|
25
|
+
# rubocop:disable Lint/MissingSuper Style/RedundantInitialize
|
24
26
|
def initialize
|
25
27
|
end
|
28
|
+
# rubocop:enable Lint/MissingSuper Style/RedundantInitialize
|
26
29
|
end
|
27
30
|
|
28
31
|
def app
|
data/test/test_helper.rb
CHANGED
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: 1.
|
4
|
+
version: 1.2.0
|
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: 2024-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: infoblox
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '3.0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rubocop
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 0.50.0
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: 0.50.0
|
41
27
|
description: Infoblox DNS provider plugin for Foreman's smart proxy
|
42
28
|
email:
|
43
29
|
- matthew.a.nicholson@gmail.com
|
@@ -71,19 +57,19 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
71
57
|
requirements:
|
72
58
|
- - ">="
|
73
59
|
- !ruby/object:Gem::Version
|
74
|
-
version: '
|
60
|
+
version: '2.5'
|
75
61
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
62
|
requirements:
|
77
63
|
- - ">="
|
78
64
|
- !ruby/object:Gem::Version
|
79
65
|
version: '0'
|
80
66
|
requirements: []
|
81
|
-
rubygems_version: 3.
|
67
|
+
rubygems_version: 3.3.27
|
82
68
|
signing_key:
|
83
69
|
specification_version: 4
|
84
70
|
summary: Infoblox DNS provider plugin for Foreman's smart proxy
|
85
71
|
test_files:
|
86
|
-
- test/test_helper.rb
|
87
72
|
- test/configuration_test.rb
|
88
73
|
- test/infoblox_test.rb
|
89
74
|
- test/integration_test.rb
|
75
|
+
- test/test_helper.rb
|