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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a8897b410d2961cdad8b275971188063eee2f43eb36d887acf3bb7b51acc4749
4
- data.tar.gz: ab1c93e8b44f9e9583037d9e9ad770a667d81c56371148219f41b0b52e097119
3
+ metadata.gz: b3a0500e2d29b0e17690364666974cec3258457b8806c4ff743fc85179e9c67b
4
+ data.tar.gz: df9c2f18edb7a29ce56090ef1ca03f34e6454ec88d9c492c1e23d274e03717bb
5
5
  SHA512:
6
- metadata.gz: eabe002514aeb1a4519ed1efccebf8f9ba6e28e5b5d474611d81cc9dcc0b57145554d75f3d3f6503d4448765dbd616f2bcfa1a0f6421de75f99e94de08c12254
7
- data.tar.gz: 88aed8b900b4db24e55e5230be6afdc53a819ec87030cd49449f334c307531a9c4535e742bcad3667c10a063719e8f974a268144b6fb7f1af090591298d55855
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
- record = clazz.find(connection, params.merge(_max_results: 1, view: dns_view)).first
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
- raise Proxy::Dns::NotFound, "Cannot find #{clazz.class.name} entry for #{params}" if record.nil?
163
- ret_value = record.delete || (raise Proxy::Dns::NotFound, "Cannot find #{clazz.class.name} entry for #{params}")
164
-
165
- ib_clear_dns_cache(record)
166
+ records.each do |record|
167
+ record.delete
168
+ ib_clear_dns_cache(record)
169
+ end
166
170
 
167
- ret_value
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 => ex
181
+ rescue StandardError => e
178
182
  # Failing to clear the DNS cache should never be an error
179
- logger.warn("Exception #{ex} was raised when clearing DNS cache")
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', :dns_view => 'default', :timeout => 60
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
 
@@ -1,7 +1,7 @@
1
1
  module Proxy
2
2
  module Dns
3
3
  module Infoblox
4
- VERSION = '1.1.0'.freeze
4
+ VERSION = '1.2.0'.freeze
5
5
  end
6
6
  end
7
7
  end
@@ -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 + "?_function=clear_dns_cache", post_body).body)
16
+ JSON.parse(connection.post("#{resource_uri}?_function=clear_dns_cache", post_body).body)
17
17
  end
18
18
  end
19
19
  end
@@ -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
@@ -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
@@ -1,5 +1,5 @@
1
1
  require 'test/unit'
2
- require 'mocha/setup'
2
+ require 'mocha/test_unit'
3
3
  require 'json'
4
4
  require 'ostruct'
5
5
 
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.1.0
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: 2020-05-21 00:00:00.000000000 Z
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: '0'
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.0.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