infoblox 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -74,6 +74,13 @@ module Infoblox
74
74
  @adapter ||= :net_http
75
75
  end
76
76
 
77
+ ##
78
+ # Don't display the username/password in logging, etc.
79
+ #
80
+ def inspect
81
+ "#<#{self.class}:#{object_id} @host=\"#{@host}\">"
82
+ end
83
+
77
84
  private
78
85
 
79
86
  def wrap
@@ -49,7 +49,7 @@ module Infoblox
49
49
  def self.remote_attr_reader(*args)
50
50
  args.each do |a|
51
51
  attr_reader a
52
- remote_attrs << a
52
+ remote_read_only_attrs << a
53
53
  end
54
54
  end
55
55
 
@@ -61,13 +61,17 @@ module Infoblox
61
61
  @remote_write_only_attrs ||= []
62
62
  end
63
63
 
64
+ def self.remote_read_only_attrs
65
+ @remote_read_only_attrs ||= []
66
+ end
67
+
64
68
  def self.remote_post_attrs
65
69
  @remote_post_attrs ||= []
66
70
  end
67
71
 
68
72
  def self._return_fields
69
73
  remove = Infoblox.wapi_version < '1.2' ? :extattrs : :extensible_attributes
70
- (self.remote_attrs - [remove]).join(",")
74
+ ((self.remote_attrs + self.remote_read_only_attrs) - [remove]).join(",")
71
75
  end
72
76
 
73
77
  def self.default_params
@@ -122,9 +126,15 @@ module Infoblox
122
126
 
123
127
  def initialize(attrs={})
124
128
  attrs.each do |k,v|
125
- # set ivars directly here, as sometimes
126
- # we only use readers on certain fields
127
- instance_variable_set("@#{k}", v)
129
+ # Some things have specialized writers,
130
+ # like Host
131
+ if respond_to?("#{k}=")
132
+ send("#{k}=", v)
133
+
134
+ # Some things don't have writers (i.e. remote_attr_reader fields)
135
+ else
136
+ instance_variable_set("@#{k}", v)
137
+ end
128
138
  end
129
139
  end
130
140
 
@@ -3,15 +3,16 @@ module Infoblox
3
3
  class AAAArecord < Resource
4
4
  remote_attr_accessor :comment,
5
5
  :disable,
6
- :dns_name,
7
6
  :extattrs,
8
7
  :extensible_attributes,
9
8
  :ipv6addr,
10
9
  :name,
11
10
  :ttl,
12
11
  :use_ttl,
13
- :view,
14
- :zone
12
+ :view
13
+
14
+ remote_attr_reader :dns_name,
15
+ :zone
15
16
 
16
17
  wapi_object "record:aaaa"
17
18
  end
@@ -7,8 +7,9 @@ module Infoblox
7
7
  :ipv4addr,
8
8
  :name,
9
9
  :ttl,
10
- :view,
11
- :zone
10
+ :view
11
+
12
+ remote_attr_reader :zone
12
13
 
13
14
  wapi_object "record:a"
14
15
  end
@@ -6,8 +6,9 @@ module Infoblox
6
6
  :extattrs,
7
7
  :extensible_attributes,
8
8
  :name,
9
- :view,
10
- :zone
9
+ :view
10
+
11
+ remote_attr_reader :zone
11
12
 
12
13
 
13
14
  wapi_object "record:cname"
@@ -8,8 +8,9 @@ module Infoblox
8
8
  :extensible_attributes,
9
9
  :ipv4addrs,
10
10
  :name,
11
- :view,
12
- :zone
11
+ :view
12
+
13
+ remote_attr_reader :zone
13
14
 
14
15
  wapi_object "record:host"
15
16
 
@@ -3,12 +3,12 @@ module Infoblox
3
3
  remote_attr_accessor :comment,
4
4
  :extattrs,
5
5
  :extensible_attributes,
6
- :network
7
-
6
+ :network,
7
+ :network_view
8
+
9
+ remote_attr_reader :network_container
8
10
 
9
11
  remote_post_accessor :auto_create_reversezone
10
-
11
- attr_accessor :network_view, :network_container
12
12
 
13
13
  wapi_object "network"
14
14
 
@@ -2,11 +2,12 @@ module Infoblox
2
2
  class NetworkContainer < Resource
3
3
  remote_attr_accessor :extattrs,
4
4
  :extensible_attributes,
5
- :network
5
+ :network,
6
+ :network_view
6
7
 
7
8
  remote_post_accessor :auto_create_reversezone
8
9
 
9
- attr_accessor :network_view
10
+ remote_attr_reader :network_container
10
11
 
11
12
  wapi_object "networkcontainer"
12
13
  end
@@ -8,8 +8,9 @@ module Infoblox
8
8
  :ptrdname,
9
9
  :extattrs,
10
10
  :extensible_attributes,
11
- :view,
12
- :zone
11
+ :view
12
+
13
+ remote_attr_reader :zone
13
14
 
14
15
  wapi_object "record:ptr"
15
16
  end
@@ -2,12 +2,13 @@ module Infoblox
2
2
  class ZoneAuth < Resource
3
3
  attr_accessor :fqdn
4
4
 
5
- remote_attr_accessor :address,
6
- :comment,
5
+ remote_attr_accessor :comment,
7
6
  :disable,
8
- :extattrs,
9
- :network_view
7
+ :extattrs
10
8
 
9
+ remote_attr_reader :address,
10
+ :network_view
11
+
11
12
  wapi_object "zone_auth"
12
13
  end
13
14
  end
@@ -1,3 +1,3 @@
1
1
  module Infoblox
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
data/spec/host_spec.rb CHANGED
@@ -9,6 +9,16 @@ describe Infoblox::Host, "#add_ipv4addr" do
9
9
  expect(host.ipv4addrs[0].ipv4addr).to eq("10.10.10.10")
10
10
  end
11
11
 
12
+ it "initializes correctly" do
13
+ data = {
14
+ :name => 'silly-little-host',
15
+ :ipv4addrs => [{:ipv4addr => '10.10.10.10'}]
16
+ }
17
+ host = Infoblox::Host.new(data)
18
+ expect(host.ipv4addrs[0]).to be_a(Infoblox::HostIpv4addr)
19
+ expect(host.name).to eq('silly-little-host')
20
+ end
21
+
12
22
  it "posts correctly" do
13
23
  conn = double
14
24
  uri = Infoblox.base_path + Infoblox::Host.wapi_object
@@ -0,0 +1,12 @@
1
+ if ENV['INTEGRATION']
2
+ describe 'Infoblox::Arecord' do
3
+ describe '.find' do
4
+ it 'should work' do
5
+ each_version do
6
+ # the empty result will be [], so nil is bad.
7
+ expect(Infoblox::Arecord.find(connection, :_max_results => 1)).to_not be_nil
8
+ end
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ if ENV['INTEGRATION']
2
+ describe 'Infoblox::Cname' do
3
+ describe '.find' do
4
+ it 'should work' do
5
+ each_version do
6
+ # the empty result will be [], so nil is bad.
7
+ expect(Infoblox::Cname.find(connection, :_max_results => 1)).to_not be_nil
8
+ end
9
+ end
10
+ end
11
+ end
12
+ end
@@ -1,12 +1,33 @@
1
1
  if ENV['INTEGRATION']
2
2
  describe 'Infoblox::Host' do
3
3
  describe '.find' do
4
- it 'should work' do
4
+ it 'should find' do
5
5
  each_version do
6
6
  # the empty result will be [], so nil is bad.
7
- expect(Infoblox::Host.find(connection, :max_results => 1)).to_not be_nil
7
+ expect(Infoblox::Host.find(connection, :_max_results => 1)).to_not be_nil
8
8
  end
9
9
  end
10
+ it 'should create, update, and destroy' do
11
+ failure = false
12
+ each_version do
13
+ @host = Infoblox::Host.new(connection: connection)
14
+ begin
15
+ @host.add_ipv4addr('10.30.30.30')
16
+ @host.name = "poc-infobloxgem-test1.ep.gdi"
17
+ @host.post
18
+
19
+ @host = Infoblox::Host.find(connection, {"ipv4addr" => "10.30.30.30"}).first
20
+ @host.name = "poc-infobloxgem-test2.ep.gdi"
21
+ @host.put
22
+ rescue Exception => e
23
+ puts e
24
+ failure = true
25
+ ensure
26
+ @host.delete
27
+ end
28
+ end
29
+ fail if failure
30
+ end
10
31
  end
11
32
  end
12
33
  end
metadata CHANGED
@@ -1,87 +1,119 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: infoblox
3
- version: !ruby/object:Gem::Version
4
- version: 0.4.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.4.1
5
+ prerelease:
5
6
  platform: ruby
6
- authors:
7
+ authors:
7
8
  - Billy Reisinger
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
-
12
- date: 2015-06-17 00:00:00 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
15
- prerelease: false
16
- requirement: &id001 !ruby/object:Gem::Requirement
17
- requirements:
18
- - &id002
19
- - ">="
20
- - !ruby/object:Gem::Version
21
- version: "0"
22
- type: :runtime
23
- name: json
24
- version_requirements: *id001
25
- - !ruby/object:Gem::Dependency
26
- prerelease: false
27
- requirement: &id003 !ruby/object:Gem::Requirement
28
- requirements:
29
- - *id002
30
- type: :runtime
12
+ date: 2015-06-18 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
31
15
  name: faraday
32
- version_requirements: *id003
33
- - !ruby/object:Gem::Dependency
34
- prerelease: false
35
- requirement: &id004 !ruby/object:Gem::Requirement
36
- requirements:
37
- - *id002
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
38
22
  type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
39
31
  name: faraday_middleware
40
- version_requirements: *id004
41
- - !ruby/object:Gem::Dependency
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
42
39
  prerelease: false
43
- requirement: &id005 !ruby/object:Gem::Requirement
44
- requirements:
45
- - *id002
46
- type: :development
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
47
  name: rspec
48
- version_requirements: *id005
49
- - !ruby/object:Gem::Dependency
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
50
55
  prerelease: false
51
- requirement: &id006 !ruby/object:Gem::Requirement
52
- requirements:
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: bundler
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
53
67
  - - ~>
54
- - !ruby/object:Gem::Version
55
- version: "1.3"
68
+ - !ruby/object:Gem::Version
69
+ version: '1.3'
56
70
  type: :development
57
- name: bundler
58
- version_requirements: *id006
59
- - !ruby/object:Gem::Dependency
60
71
  prerelease: false
61
- requirement: &id007 !ruby/object:Gem::Requirement
62
- requirements:
63
- - *id002
64
- type: :development
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: '1.3'
78
+ - !ruby/object:Gem::Dependency
65
79
  name: rake
66
- version_requirements: *id007
67
- - !ruby/object:Gem::Dependency
68
- prerelease: false
69
- requirement: &id008 !ruby/object:Gem::Requirement
70
- requirements:
71
- - *id002
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
72
86
  type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
73
95
  name: pry
74
- version_requirements: *id008
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
75
110
  description: A Ruby wrapper to the Infoblox WAPI
76
- email:
111
+ email:
77
112
  - billy.reisinger@govdelivery.com
78
113
  executables: []
79
-
80
114
  extensions: []
81
-
82
115
  extra_rdoc_files: []
83
-
84
- files:
116
+ files:
85
117
  - .gitignore
86
118
  - .rspec
87
119
  - .travis.yml
@@ -113,6 +145,8 @@ files:
113
145
  - spec/connection_spec.rb
114
146
  - spec/host_ipv4addr_spec.rb
115
147
  - spec/host_spec.rb
148
+ - spec/integration/arecord_spec.rb
149
+ - spec/integration/cname_spec.rb
116
150
  - spec/integration/host_ipv4addr_spec.rb
117
151
  - spec/integration/host_spec.rb
118
152
  - spec/range_spec.rb
@@ -120,32 +154,43 @@ files:
120
154
  - spec/search_spec.rb
121
155
  - spec/spec_helper.rb
122
156
  homepage: https://github.com/govdelivery/infoblox
123
- licenses:
157
+ licenses:
124
158
  - MIT
125
- metadata: {}
126
-
127
159
  post_install_message:
128
160
  rdoc_options: []
129
-
130
- require_paths:
161
+ require_paths:
131
162
  - lib
132
- required_ruby_version: !ruby/object:Gem::Requirement
133
- requirements:
134
- - *id002
135
- required_rubygems_version: !ruby/object:Gem::Requirement
136
- requirements:
137
- - *id002
163
+ required_ruby_version: !ruby/object:Gem::Requirement
164
+ none: false
165
+ requirements:
166
+ - - ! '>='
167
+ - !ruby/object:Gem::Version
168
+ version: '0'
169
+ segments:
170
+ - 0
171
+ hash: 1017556541912433420
172
+ required_rubygems_version: !ruby/object:Gem::Requirement
173
+ none: false
174
+ requirements:
175
+ - - ! '>='
176
+ - !ruby/object:Gem::Version
177
+ version: '0'
178
+ segments:
179
+ - 0
180
+ hash: 1017556541912433420
138
181
  requirements: []
139
-
140
182
  rubyforge_project:
141
- rubygems_version: 2.0.17
183
+ rubygems_version: 1.8.25
142
184
  signing_key:
143
- specification_version: 4
144
- summary: This gem is a Ruby interface to the Infoblox WAPI. Using the gem, you can query, create, update, and delete DNS records in your Infoblox instance.
145
- test_files:
185
+ specification_version: 3
186
+ summary: This gem is a Ruby interface to the Infoblox WAPI. Using the gem, you can
187
+ query, create, update, and delete DNS records in your Infoblox instance.
188
+ test_files:
146
189
  - spec/connection_spec.rb
147
190
  - spec/host_ipv4addr_spec.rb
148
191
  - spec/host_spec.rb
192
+ - spec/integration/arecord_spec.rb
193
+ - spec/integration/cname_spec.rb
149
194
  - spec/integration/host_ipv4addr_spec.rb
150
195
  - spec/integration/host_spec.rb
151
196
  - spec/range_spec.rb
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA512:
3
- data.tar.gz: 9523aef2db73841cfd832f7016585e21877560c0b6c6acf68d9dac97c376010b38159fbed244477cd6c702382df308030e8276e0aad6eb6913fa4fa060a3109c
4
- metadata.gz: 9a743acf2e90903b18966884fa5d8f1acb82d78b97f9b5a992cc77fbb28faa6de95f10b4378480902323ad4d3426ca35fe534cdb9e1ac6b0bbab299096a9f85c
5
- SHA1:
6
- data.tar.gz: 5e8cfd4c91bf44aa902f0f4fd7157d8e3a34290b
7
- metadata.gz: 87e376a6a12e29d85500d9302cec32b7b2d19104