infoblox 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/infoblox/resource.rb +13 -1
- data/lib/infoblox/resource/arecord.rb +8 -5
- data/lib/infoblox/resource/cname.rb +4 -1
- data/lib/infoblox/resource/fixedaddress.rb +7 -4
- data/lib/infoblox/resource/host.rb +10 -7
- data/lib/infoblox/resource/host_ipv4addr.rb +3 -1
- data/lib/infoblox/resource/ipv4address.rb +20 -13
- data/lib/infoblox/resource/network.rb +3 -1
- data/lib/infoblox/resource/ptr.rb +9 -5
- data/lib/infoblox/version.rb +1 -1
- data/spec/host_ipv4addr_spec.rb +1 -1
- data/spec/resource_spec.rb +13 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c25a0a8c232a93161b8317af5238429446a78779
|
4
|
+
data.tar.gz: 48d577a599c4a404ea571cc7fe26619a95387c16
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 866fb518bdae0ae892386ecfeaef74b6f7394f0243c0bcf6d69a151f05912e567cc5d7b852e36f4fa9fca3843ac3a05fa3a66f83f9235b4327da2ad5360a428a
|
7
|
+
data.tar.gz: 33e941c47b1ee9f258c3317be8921231741b1da1388d59f9fd71705adc4d1e71d6b1780ab0ce01bd3252a5eba5e0f8eb3bf595ff443c8639151b45d2ae0a4e93
|
data/lib/infoblox/resource.rb
CHANGED
@@ -43,6 +43,16 @@ module Infoblox
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
+
##
|
47
|
+
# Define a read-only attribute
|
48
|
+
#
|
49
|
+
def self.remote_attr_reader(*args)
|
50
|
+
args.each do |a|
|
51
|
+
attr_reader a
|
52
|
+
remote_attrs << a
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
46
56
|
def self.remote_attrs
|
47
57
|
@remote_attrs ||= []
|
48
58
|
end
|
@@ -112,7 +122,9 @@ module Infoblox
|
|
112
122
|
|
113
123
|
def initialize(attrs={})
|
114
124
|
attrs.each do |k,v|
|
115
|
-
|
125
|
+
# set ivars directly here, as sometimes
|
126
|
+
# we only use readers on certain fields
|
127
|
+
instance_variable_set("@#{k}", v)
|
116
128
|
end
|
117
129
|
end
|
118
130
|
|
@@ -1,11 +1,14 @@
|
|
1
1
|
module Infoblox
|
2
2
|
class Arecord < Resource
|
3
|
-
remote_attr_accessor :
|
4
|
-
:
|
5
|
-
:
|
3
|
+
remote_attr_accessor :comment,
|
4
|
+
:disable,
|
5
|
+
:extattrs,
|
6
|
+
:extensible_attributes,
|
7
|
+
:ipv4addr,
|
8
|
+
:name,
|
6
9
|
:ttl,
|
7
|
-
:view,
|
8
|
-
:
|
10
|
+
:view,
|
11
|
+
:zone
|
9
12
|
|
10
13
|
wapi_object "record:a"
|
11
14
|
end
|
@@ -2,11 +2,14 @@ module Infoblox
|
|
2
2
|
# minimum WAPI version: 1.1
|
3
3
|
class Fixedaddress < Resource
|
4
4
|
remote_attr_accessor :extattrs,
|
5
|
-
:ipv4addr,
|
6
|
-
:mac,
|
7
|
-
:name,
|
5
|
+
:ipv4addr,
|
6
|
+
:mac,
|
7
|
+
:name,
|
8
|
+
:network,
|
9
|
+
:network_view,
|
8
10
|
:options,
|
9
|
-
:match_client
|
11
|
+
:match_client,
|
12
|
+
:comment
|
10
13
|
|
11
14
|
wapi_object "fixedaddress"
|
12
15
|
end
|
@@ -1,12 +1,15 @@
|
|
1
1
|
module Infoblox
|
2
2
|
class Host < Resource
|
3
|
-
remote_attr_accessor :
|
4
|
-
:
|
5
|
-
:
|
6
|
-
:
|
7
|
-
:
|
8
|
-
:
|
9
|
-
:
|
3
|
+
remote_attr_accessor :aliases,
|
4
|
+
:comment,
|
5
|
+
:configure_for_dns,
|
6
|
+
:disable,
|
7
|
+
:extattrs,
|
8
|
+
:extensible_attributes,
|
9
|
+
:ipv4addrs,
|
10
|
+
:name,
|
11
|
+
:view,
|
12
|
+
:zone
|
10
13
|
|
11
14
|
wapi_object "record:host"
|
12
15
|
|
@@ -1,25 +1,32 @@
|
|
1
1
|
module Infoblox
|
2
2
|
class Ipv4address < Resource
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
3
|
+
remote_attr_reader :dhcp_client_identifier,
|
4
|
+
:ip_address,
|
5
|
+
:is_conflict,
|
6
|
+
:lease_state,
|
7
|
+
:mac_address,
|
8
|
+
:names,
|
9
|
+
:network,
|
10
|
+
:network_view,
|
11
|
+
:objects,
|
12
|
+
:status,
|
13
|
+
:types,
|
14
|
+
:usage,
|
15
|
+
:username
|
16
16
|
|
17
|
+
remote_attr_accessor :extattrs, :extensible_attributes
|
18
|
+
|
17
19
|
wapi_object "ipv4address"
|
18
20
|
|
19
21
|
def delete
|
20
22
|
raise "Not supported"
|
21
23
|
end
|
22
24
|
|
25
|
+
##
|
26
|
+
# as per the WAPI doc:
|
27
|
+
# This object is created only as part of the record.host object,
|
28
|
+
# it cannot be created directly.
|
29
|
+
#
|
23
30
|
def create
|
24
31
|
raise "Not supported"
|
25
32
|
end
|
@@ -1,11 +1,15 @@
|
|
1
1
|
module Infoblox
|
2
2
|
class Ptr < Resource
|
3
|
-
remote_attr_accessor :
|
4
|
-
:
|
5
|
-
:
|
6
|
-
:
|
3
|
+
remote_attr_accessor :comment,
|
4
|
+
:disable,
|
5
|
+
:ipv4addr,
|
6
|
+
:ipv6addr,
|
7
7
|
:name,
|
8
|
-
:ptrdname
|
8
|
+
:ptrdname,
|
9
|
+
:extattrs,
|
10
|
+
:extensible_attributes,
|
11
|
+
:view,
|
12
|
+
:zone
|
9
13
|
|
10
14
|
wapi_object "record:ptr"
|
11
15
|
end
|
data/lib/infoblox/version.rb
CHANGED
data/spec/host_ipv4addr_spec.rb
CHANGED
@@ -5,7 +5,7 @@ describe Infoblox::HostIpv4addr do
|
|
5
5
|
expected = [:host]
|
6
6
|
expect(Infoblox::HostIpv4addr.remote_post_attrs).to eq(expected)
|
7
7
|
|
8
|
-
expected = [:
|
8
|
+
expected = [:bootfile, :configure_for_dhcp, :ipv4addr, :mac, :network, :nextserver, :use_bootfile, :use_nextserver].sort
|
9
9
|
expect(Infoblox::HostIpv4addr.remote_attrs.sort).to eq(expected)
|
10
10
|
end
|
11
11
|
end
|
data/spec/resource_spec.rb
CHANGED
@@ -3,7 +3,7 @@ class FooResource < Infoblox::Resource
|
|
3
3
|
remote_attr_accessor :name, :junction, :extattrs, :extensible_attributes
|
4
4
|
remote_attr_writer :do_it
|
5
5
|
remote_post_accessor :sect
|
6
|
-
|
6
|
+
remote_attr_reader :readonly_thing
|
7
7
|
attr_accessor :animal
|
8
8
|
wapi_object "foo:animal"
|
9
9
|
end
|
@@ -23,15 +23,15 @@ describe Infoblox::Resource, "#add_ipv4addr" do
|
|
23
23
|
it "handles extattrs correctly in return fields" do
|
24
24
|
expect(Infoblox).to receive(:wapi_version).and_return("1.0")
|
25
25
|
hsh = FooResource._return_fields
|
26
|
-
expect(hsh).to eq('name,junction,extensible_attributes')
|
26
|
+
expect(hsh).to eq('name,junction,extensible_attributes,readonly_thing')
|
27
27
|
|
28
28
|
expect(Infoblox).to receive(:wapi_version).and_return("1.2")
|
29
29
|
hsh = FooResource._return_fields
|
30
|
-
expect(hsh).to eq('name,junction,extattrs')
|
30
|
+
expect(hsh).to eq('name,junction,extattrs,readonly_thing')
|
31
31
|
|
32
32
|
expect(Infoblox).to receive(:wapi_version).and_return("2.0")
|
33
33
|
hsh = FooResource._return_fields
|
34
|
-
expect(hsh).to eq('name,junction,extattrs')
|
34
|
+
expect(hsh).to eq('name,junction,extattrs,readonly_thing')
|
35
35
|
end
|
36
36
|
|
37
37
|
it "should have a correct resource_uri" do
|
@@ -45,14 +45,14 @@ describe Infoblox::Resource, "#add_ipv4addr" do
|
|
45
45
|
it "should find with default attributes" do
|
46
46
|
conn = double
|
47
47
|
uri = Infoblox.base_path + "foo:animal"
|
48
|
-
allow(conn).to receive(:get).with(uri, {:_return_fields => "name,junction,extensible_attributes"}).and_return(FooResponse.new("[]"))
|
48
|
+
allow(conn).to receive(:get).with(uri, {:_return_fields => "name,junction,extensible_attributes,readonly_thing"}).and_return(FooResponse.new("[]"))
|
49
49
|
expect(FooResource.all(conn)).to eq([])
|
50
50
|
end
|
51
51
|
|
52
52
|
it "should allow .all with return fields or max results" do
|
53
53
|
conn = double
|
54
54
|
uri = Infoblox.base_path + "foo:animal"
|
55
|
-
allow(conn).to receive(:get).with(uri, {:_return_fields => "name,junction,extensible_attributes", :_max_results => -70}).and_return(FooResponse.new("[]"))
|
55
|
+
allow(conn).to receive(:get).with(uri, {:_return_fields => "name,junction,extensible_attributes,readonly_thing", :_max_results => -70}).and_return(FooResponse.new("[]"))
|
56
56
|
expect(FooResource.all(conn, :_max_results => -70)).to eq([])
|
57
57
|
end
|
58
58
|
|
@@ -83,6 +83,13 @@ describe Infoblox::Resource, "#add_ipv4addr" do
|
|
83
83
|
expect(f._ref).to eq('abcdefg')
|
84
84
|
end
|
85
85
|
|
86
|
+
it 'should set all attributes including readonly attrs' do
|
87
|
+
f = FooResource.new(:readonly_thing => 45, :do_it => false, :sect => :larry)
|
88
|
+
expect(f.readonly_thing).to eq(45)
|
89
|
+
expect(f.do_it).to be(false)
|
90
|
+
expect(f.sect).to eq(:larry)
|
91
|
+
end
|
92
|
+
|
86
93
|
it 'should map wapi objects to classes' do
|
87
94
|
@expected = {}
|
88
95
|
ObjectSpace.each_object(Class) do |p|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: infoblox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Billy Reisinger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|