infoblox 0.2.15 → 0.2.17

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- ZGFjZDM3ODQzMTJiNjkzY2NiNGZmOTdmZGJkMDg0NjNiZWYxODVmYg==
5
- data.tar.gz: !binary |-
6
- MzE2MDU2ZDY5MWY2N2M4NTc2YjRmYTUwMDNkYmU5NTNmY2Y1N2Q2OA==
2
+ SHA1:
3
+ metadata.gz: 9291ffbbb04ccd30957ab4595afbb4d40a3202f5
4
+ data.tar.gz: c8ff09f09f2f9488673fc22ba8c3e2cf5ae779cd
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- MDIzMTA2NmFjMDY2OGQyMGJhMWNjMmVjN2VjZDBiYTEyNWNjMzhlZGU1Yjc4
10
- YjRjNGUyZTM1NDI3YzM4NjA3ZmI0MTJlNmM2Y2ZjMTkyN2QwZmIyMjRiYWY4
11
- YTFmMWE4ZjhlZTkyMmM1MTY3OThlOGZiNDcxNDI3ZjBlMjk3ZTg=
12
- data.tar.gz: !binary |-
13
- NTUzNmZlZjUxNDlhMWMyYjliODYwOTlmMmVmZTgxMGVlNjRhNDMyZDRiZmYw
14
- YTJmZDY2MmMzMzE4MTBhZTQxNDk0YzdlNDU5YTUzMTZmMzQxY2MxNWM0YTcw
15
- Zjg3YjAyNjQzNDlmZWY0MjViMjgxNzYyZWIzODA4N2UwMWQ1ZDA=
6
+ metadata.gz: 1106ab54d860e4ea1b4adeec5e3a7e94394b44c43c3985ace953587ee5ba76e276e26bf32128366c97d0de181fa02b17725cba258eebafd3eec16efac5da8993
7
+ data.tar.gz: 1379aa6079e7dacb6c208ca3eaf6bd210b5add9b1690044705d93c845932e261f3c2a28bc80b82b3628b0a166797f4d5c9049efb5694a7af03791e8006d78bca
data/.travis.yml CHANGED
@@ -1,12 +1,11 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.1.2
3
+ - 2.1.5
4
4
  - 1.9.3
5
5
  - jruby-19mode
6
- - ruby-head
7
6
  - jruby-head
8
7
  script: bundle exec rspec
9
8
  notifications:
10
9
  webhooks: https://gd-radiator.ngrok.com/hubot/travis?room=devlab@conference.im.office.gdi
11
10
  on_success: change
12
- on_failure: always
11
+ on_failure: always
data/README.md CHANGED
@@ -65,6 +65,40 @@ To change the IP of an existing host, you have to poke around in the ipv4addrs c
65
65
  host.ipv4addrs[0].ipv4addr = "10.10.10.10"
66
66
  host.put
67
67
 
68
+ ## Basic CRUD examples
69
+
70
+ To do basic create/update/delete operations on an a_record/ptr_record set:
71
+
72
+ Create:
73
+
74
+ a_record = Infoblox::Arecord.new(:connection => connection, :name => <fqdn>, :ipv4addr => <ip_address>)
75
+ a_record.post
76
+
77
+ ptr_record = Infoblox::Ptr.new(:connection => connection, :ptrdname => <fqdn>, :ipv4addr => <ip_address>)
78
+ ptr_record.post
79
+
80
+ Update:
81
+
82
+ a_record = Infoblox::Arecord.find(connection, {:name => <fqdn>, :ipv4addr => resource_version_last_published.ip_address}).first
83
+ a_record.name = <fqdn>
84
+ a_record.ipv4addr = <ip_address>
85
+ a_record.view = nil
86
+ a_record.put
87
+
88
+ ptr_record = Infoblox::Ptr.find(connection, {:ptrdname => <fqdn>, :ipv4addr => resource_version_last_published.ip_address}).first
89
+ ptr_record.ptrdname = <fqdn>
90
+ ptr_record.ipv4addr = <ip_address>
91
+ ptr_record.view = nil
92
+ ptr_record.put
93
+
94
+ Delete:
95
+
96
+ a_record = Infoblox::Arecord.find(connection, {:name => <fqdn>, :ipv4addr => <ip_address>}).first
97
+ a_record.delete
98
+
99
+ ptr_record = Infoblox::Ptr.find(connection, {:ptrdname => <fqdn>, :ipv4addr => <ip_address>}).first
100
+ ptr_record.delete
101
+
68
102
  ## Contributing
69
103
 
70
104
  1. Fork it
@@ -1,12 +1,15 @@
1
1
  module Infoblox
2
+ class Error < StandardError
3
+ end
4
+
2
5
  class Connection
3
- attr_accessor :adapter,
6
+ attr_accessor :adapter,
4
7
  :adapter_block,
5
- :connection,
6
- :host,
7
- :logger,
8
- :password,
9
- :ssl_opts,
8
+ :connection,
9
+ :host,
10
+ :logger,
11
+ :password,
12
+ :ssl_opts,
10
13
  :username
11
14
 
12
15
  def get(href, params={})
@@ -44,7 +47,7 @@ module Infoblox
44
47
  self.password = opts[:password]
45
48
  self.host = opts[:host]
46
49
  self.logger = opts[:logger]
47
- self.ssl_opts = opts[:ssl_opts]
50
+ self.ssl_opts = opts[:ssl_opts]
48
51
  end
49
52
 
50
53
  def connection
@@ -76,7 +79,7 @@ module Infoblox
76
79
  def wrap
77
80
  yield.tap do |response|
78
81
  unless response.status < 300
79
- raise Exception.new("Error: #{response.status} #{response.body}")
82
+ raise Infoblox::Error.new("Error: #{response.status} #{response.body}")
80
83
  end
81
84
  end
82
85
  end
@@ -1,3 +1,3 @@
1
1
  module Infoblox
2
- VERSION = "0.2.15"
2
+ VERSION = "0.2.17"
3
3
  end
@@ -2,9 +2,9 @@ require 'spec_helper'
2
2
  describe Infoblox::Connection do
3
3
 
4
4
  ["localhost", "127.0.0.1", "http://localhost:3000", "https://localhost", "http://localhost:3000/"].each do |host|
5
- it "should build URL without failure" do
5
+ it "should build URL #{host} without failure" do
6
6
  conn_params = {
7
- username: "billy",
7
+ username: "billy",
8
8
  password: "boi",
9
9
  host: host
10
10
  }
@@ -19,9 +19,27 @@ describe Infoblox::Connection do
19
19
  end
20
20
  end
21
21
 
22
- def stub_get(uri)
22
+ it "should raise Infobloxon invalid response" do
23
+ host = 'localhost'
24
+ conn_params = {
25
+ username: "billy",
26
+ password: "boi",
27
+ host: host
28
+ }
29
+ uri = "/wapi/v1.0/record:host"
30
+
31
+ ic = Infoblox::Connection.new(conn_params)
32
+ ic.adapter = :test
33
+ ic.adapter_block = stub_get(uri, 404)
34
+
35
+ # execute the request. There should be no "URI::BadURIError: both URI are relative" error
36
+
37
+ expect { ic.get(uri) }.to raise_error(Infoblox::Error)
38
+ end
39
+
40
+ def stub_get(uri, status=200)
23
41
  Proc.new do |stub|
24
- stub.get(uri) { [ 200, {}, 'Yay!'] }
42
+ stub.get(uri) { [ status, {}, 'Yay!'] }
25
43
  end
26
44
  end
27
45
  end
metadata CHANGED
@@ -1,97 +1,97 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: infoblox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.15
4
+ version: 0.2.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Billy Reisinger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-03 00:00:00.000000000 Z
11
+ date: 2014-12-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ! '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: faraday_middleware
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ! '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ! '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ! '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ! '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '1.3'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.3'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ! '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ! '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: pry
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ! '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ! '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  description: A Ruby wrapper to the Infoblox WAPI
@@ -101,9 +101,9 @@ executables: []
101
101
  extensions: []
102
102
  extra_rdoc_files: []
103
103
  files:
104
- - .gitignore
105
- - .rspec
106
- - .travis.yml
104
+ - ".gitignore"
105
+ - ".rspec"
106
+ - ".travis.yml"
107
107
  - Gemfile
108
108
  - LICENSE.txt
109
109
  - README.md
@@ -141,12 +141,12 @@ require_paths:
141
141
  - lib
142
142
  required_ruby_version: !ruby/object:Gem::Requirement
143
143
  requirements:
144
- - - ! '>='
144
+ - - ">="
145
145
  - !ruby/object:Gem::Version
146
146
  version: '0'
147
147
  required_rubygems_version: !ruby/object:Gem::Requirement
148
148
  requirements:
149
- - - ! '>='
149
+ - - ">="
150
150
  - !ruby/object:Gem::Version
151
151
  version: '0'
152
152
  requirements: []
@@ -163,4 +163,3 @@ test_files:
163
163
  - spec/resource_spec.rb
164
164
  - spec/search_spec.rb
165
165
  - spec/spec_helper.rb
166
- has_rdoc: