infoblocks 0.0.2 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +2 -0
- data/bin/infoblocks +20 -5
- data/infoblocks.gemspec +2 -1
- data/lib/infoblocks/version.rb +1 -1
- metadata +20 -4
data/.gitignore
CHANGED
data/bin/infoblocks
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'gli'
|
3
|
-
require '
|
3
|
+
require 'highline/import'
|
4
4
|
require 'infoblox'
|
5
|
+
require 'infoblocks'
|
5
6
|
|
6
7
|
include GLI::App
|
7
8
|
|
@@ -18,7 +19,7 @@ flag [:user,:u]
|
|
18
19
|
|
19
20
|
desc 'Password for Infoblox WAPI'
|
20
21
|
arg_name '<password>'
|
21
|
-
flag [:pass,:p]
|
22
|
+
flag [:pass,:p], :mask => true
|
22
23
|
|
23
24
|
desc 'Host or base URL for Infoblox WAPI'
|
24
25
|
arg_name '<hostname>'
|
@@ -31,14 +32,27 @@ command :host do |c|
|
|
31
32
|
c.desc 'Adds host object'
|
32
33
|
c.arg_name '<hostname> <ip_address>'
|
33
34
|
c.command :add do |subadd|
|
35
|
+
|
36
|
+
subadd.switch [:dns], :desc => 'Enables/Disables DNS for this record.', :default_value => true, :negatable => true
|
37
|
+
subadd.flag [:dhcpmac,:m], :desc => 'Mac address to enable DHCP.', :must_match => /^((\h{2}([:-]|$)){6})|(\h{12})$/
|
38
|
+
subadd.flag [:aliases,:a], :desc => 'List of CNAMES for this record.', :type => Array
|
39
|
+
|
34
40
|
subadd.action do |global_options,options,args|
|
35
41
|
raise ArgumentError, "Invalid arguments" if args.length != 2
|
36
42
|
|
43
|
+
# the [0] on [:dhcpmac] is to deal with a bug in gli returning an array with :must_match option
|
44
|
+
ipv4addr = { :ipv4addr => args[1] }
|
45
|
+
ipv4addr.merge!({
|
46
|
+
:mac => options[:dhcpmac][0].scan(/\h{2}/).join(':'), # infoblox only takes : seperated macs
|
47
|
+
:configure_for_dhcp => true
|
48
|
+
}) unless options[:dhcpmac].nil?
|
49
|
+
|
37
50
|
hostobj = Infoblox::Host.new({
|
38
51
|
:connection => @connection,
|
39
52
|
:name => args[0],
|
40
|
-
:ipv4addrs => [
|
41
|
-
:configure_for_dns =>
|
53
|
+
:ipv4addrs => [ipv4addr],
|
54
|
+
:configure_for_dns => options[:dns],
|
55
|
+
:aliases => options[:aliases],
|
42
56
|
:view => options[:view]
|
43
57
|
})
|
44
58
|
hostobj.post
|
@@ -90,9 +104,10 @@ command :search do |c|
|
|
90
104
|
end
|
91
105
|
|
92
106
|
pre do |global,command,options,args|
|
93
|
-
[:user,:
|
107
|
+
[:user,:host].each do |required|
|
94
108
|
raise ArgumentError, "Missing #{required} argument." unless global[required]
|
95
109
|
end
|
110
|
+
global[:pass] ||= ask("Password:") { |q| q.echo = false }
|
96
111
|
@connection = Infoblox::Connection.new(:username => global[:user], :password => global[:pass], :host => global[:host])
|
97
112
|
true
|
98
113
|
end
|
data/infoblocks.gemspec
CHANGED
@@ -22,5 +22,6 @@ spec = Gem::Specification.new do |s|
|
|
22
22
|
s.add_development_dependency('rdoc')
|
23
23
|
s.add_development_dependency('aruba')
|
24
24
|
s.add_runtime_dependency('gli','2.9.0')
|
25
|
-
s.add_runtime_dependency('infoblox','0.2.
|
25
|
+
s.add_runtime_dependency('infoblox','0.2.11')
|
26
|
+
s.add_runtime_dependency('highline','1.6.21')
|
26
27
|
end
|
data/lib/infoblocks/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: infoblocks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-04-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -82,7 +82,7 @@ dependencies:
|
|
82
82
|
requirements:
|
83
83
|
- - '='
|
84
84
|
- !ruby/object:Gem::Version
|
85
|
-
version: 0.2.
|
85
|
+
version: 0.2.11
|
86
86
|
type: :runtime
|
87
87
|
prerelease: false
|
88
88
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -90,7 +90,23 @@ dependencies:
|
|
90
90
|
requirements:
|
91
91
|
- - '='
|
92
92
|
- !ruby/object:Gem::Version
|
93
|
-
version: 0.2.
|
93
|
+
version: 0.2.11
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: highline
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - '='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: 1.6.21
|
102
|
+
type: :runtime
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - '='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 1.6.21
|
94
110
|
description: A frontend built in GLI that uses the Infoblox gem to make WAPI calls
|
95
111
|
against any infoblox device.
|
96
112
|
email: srees@enova.com
|