f5-icontrol 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/f5/cli/application.rb +22 -7
- data/lib/f5/icontrol/api.rb +4 -10
- data/lib/f5/icontrol/version.rb +1 -1
- data/spec/models/api_spec.rb +4 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8587b7f410c3f3d017acf7dad53a35b7a525fde
|
4
|
+
data.tar.gz: fd6bac18d27da90beacda52a8184da3a7ad34c72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3495c946b952f5f223699c6d3f66178b86e75c08fa266a97a015726423e04a582143ba419be5005c29996d1f204dd194d54432f9214a8fa79d7e8ce51f88d67
|
7
|
+
data.tar.gz: f35e767af028beae255bcf924f744ad13e37e44b6fc3d1e6498faa87674c06615e94152b49bc07b986d89ab83c25df465da7b3eef42c2070ecda75fed813eace
|
data/CHANGELOG.md
ADDED
data/lib/f5/cli/application.rb
CHANGED
@@ -37,7 +37,9 @@ module F5
|
|
37
37
|
pool_names: { item: [ pool ] },
|
38
38
|
members: { item: [ members ] }
|
39
39
|
)
|
40
|
-
statuses =
|
40
|
+
statuses = response[:item][:item]
|
41
|
+
statuses = [ statuses ] if statuses.is_a? Hash
|
42
|
+
|
41
43
|
puts "%20s %25s %25s" % ["Address", "Availability", "Enabled"]
|
42
44
|
statuses.each_with_index do |s, idx|
|
43
45
|
puts "%20s %25s %25s" % [ members[idx][:address], s[:availability_status].split(/_/).last, s[:enabled_status].split(/_/).last ]
|
@@ -56,9 +58,16 @@ module F5
|
|
56
58
|
session_states: { item: [ set.map { "STATE_ENABLED" } ] }
|
57
59
|
)
|
58
60
|
|
61
|
+
response = client.LocalLB.Pool.set_member_monitor_state(
|
62
|
+
pool_names: { item: [ pool ] },
|
63
|
+
members: { item: [ set ] },
|
64
|
+
monitor_states: { item: [ set.map { "STATE_ENABLED" } ] }
|
65
|
+
)
|
66
|
+
|
59
67
|
end
|
60
68
|
|
61
69
|
desc "disable POOL MEMBERS", "Disables the given members"
|
70
|
+
method_option :force, default: false, desc: "Forces the node offline (only active connections allowed)"
|
62
71
|
def disable(pool, *members)
|
63
72
|
set = pool_members(pool).select do |m|
|
64
73
|
members.include? m[:address]
|
@@ -69,13 +78,24 @@ module F5
|
|
69
78
|
members: { item: [ set ] },
|
70
79
|
session_states: { item: [ set.map { "STATE_DISABLED" } ] }
|
71
80
|
)
|
81
|
+
|
82
|
+
if options[:force]
|
83
|
+
response = client.LocalLB.Pool.set_member_monitor_state(
|
84
|
+
pool_names: { item: [ pool ] },
|
85
|
+
members: { item: [ set ] },
|
86
|
+
monitor_states: { item: [ set.map { "STATE_DISABLED" } ] }
|
87
|
+
)
|
88
|
+
end
|
72
89
|
end
|
73
90
|
|
74
91
|
private
|
75
92
|
|
76
93
|
def pool_members(pool)
|
77
94
|
response = client.LocalLB.Pool.get_member_v2(pool_names: { item: [ pool ] } )
|
78
|
-
|
95
|
+
|
96
|
+
members = response[:item][:item]
|
97
|
+
members = [ members ] if members.is_a? Hash
|
98
|
+
|
79
99
|
members.map { |m| { address: m[:address], port: m[:port] } }
|
80
100
|
end
|
81
101
|
|
@@ -86,11 +106,6 @@ module F5
|
|
86
106
|
end
|
87
107
|
|
88
108
|
class Application < Thor
|
89
|
-
desc 'hello', 'says hi'
|
90
|
-
|
91
|
-
def hello(test)
|
92
|
-
puts "hello #{test}"
|
93
|
-
end
|
94
109
|
|
95
110
|
desc "pool SUBCOMMAND ...ARGS", "manage pools"
|
96
111
|
subcommand "pool", Pool
|
data/lib/f5/icontrol/api.rb
CHANGED
@@ -12,8 +12,7 @@ module F5
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def method_missing(method, args = nil, &block)
|
15
|
-
if terminal_node?
|
16
|
-
if supported_method?(method)
|
15
|
+
if terminal_node? && supported_method?(method)
|
17
16
|
response_key = "#{method.to_s}_response".to_sym
|
18
17
|
|
19
18
|
response = client.call(method) do
|
@@ -24,15 +23,10 @@ module F5
|
|
24
23
|
|
25
24
|
response.to_hash[response_key][:return]
|
26
25
|
|
27
|
-
|
28
|
-
|
29
|
-
end
|
26
|
+
elsif supported_path? append_path(method)
|
27
|
+
self.class.new append_path(method)
|
30
28
|
else
|
31
|
-
|
32
|
-
self.class.new append_path(method)
|
33
|
-
else
|
34
|
-
raise NameError, "#{append_path(method)} is not supported"
|
35
|
-
end
|
29
|
+
raise NameError, "#{method} is not supported by #{@api_path}"
|
36
30
|
end
|
37
31
|
end
|
38
32
|
|
data/lib/f5/icontrol/version.rb
CHANGED
data/spec/models/api_spec.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: f5-icontrol
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Walberg
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10
|
11
|
+
date: 2014-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: savon
|
@@ -132,6 +132,7 @@ extra_rdoc_files: []
|
|
132
132
|
files:
|
133
133
|
- ".gitignore"
|
134
134
|
- ".travis.yml"
|
135
|
+
- CHANGELOG.md
|
135
136
|
- Gemfile
|
136
137
|
- LICENSE
|
137
138
|
- LICENSE.txt
|