f5-icontrol 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b41af60e6a4f2679ddf9c5cadedf90677f0ad54f
4
- data.tar.gz: 4d8912cb7bba726e570e3ee78a172fc08c5ff74f
3
+ metadata.gz: 51e1dd154ac05834c5bf6155a48cbf9d415454c7
4
+ data.tar.gz: 3b5b67c1f8ef58a33683e0c5f3a71625d7dbb50b
5
5
  SHA512:
6
- metadata.gz: d2f31200ca7c977dafbbf6b3eddcc496b6896cdcb41b28dcfeda1ca124058a0113decc58cc420a46fc3011169dbb7eb8beed4e64d247dd1d161d0ee252aeb57e
7
- data.tar.gz: e39a4d2fa1a3743ea8d181bb719a8bbf430050f56750ffd67315c2051ab4bbc03ca8839c072894aa53b4fa2aff845bfe79a0d4393b9311e9e55d44bb381a8dd4
6
+ metadata.gz: '069bd45ae69fd3439eeda0d3eebebfdca592be929c2693cef9e66ab82337d3e0022446057999a4558150563df320fbf1e9d4de6d4b01a722c6083f98fd2539bd'
7
+ data.tar.gz: 04ce250260edc91e65f80a89fd39217bf4aaf7f3d0f5c0e168acf713fe73b3e3b2c877cb0805c7582564eabe0874bee5d947c93c6830dfb1b57d479e0d91a32e
data/CHANGELOG.md CHANGED
@@ -1,4 +1,6 @@
1
1
  # Changelog
2
+ ## 0.2.5
3
+ swalberg - support setting pool member connection limits
2
4
  ## 0.2.4
3
5
  swalberg - support setting pool member ratios
4
6
  ## 0.2.3
@@ -319,8 +319,8 @@ module F5
319
319
  end
320
320
  end
321
321
 
322
- desc "setratio --ratio RATIO POOL MEMBERS", "Sets the dynamic ratio of the given members to RATIO"
323
- method_option :ratio, type: :numeric, desc: "The node's new dynamic ratio", required: true
322
+ desc "setratio POOL MEMBERS", "Sets the ratio of the given members to RATIO"
323
+ method_option :ratio, type: :numeric, desc: "The node's new ratio", required: true
324
324
  def setratio(pool, *members)
325
325
  set = address_port_list_from_pool(pool, members)
326
326
  response = client.LocalLB.Pool.set_member_ratio(
@@ -328,7 +328,17 @@ module F5
328
328
  members: { item: [ set ] },
329
329
  ratios: { item: [ set.map { options[:ratio] } ] }
330
330
  )
331
+ end
331
332
 
333
+ desc "setconnections POOL MEMBERS", "Sets the connection limit on MEMBERS to LIMIT"
334
+ method_option :limit, type: :numeric, desc: "The node's new connection limit", required: true
335
+ def setconnections(pool, *members)
336
+ set = address_port_list_from_pool(pool, members)
337
+ response = client.LocalLB.Pool.set_member_connection_limit(
338
+ pool_names: { item: [ pool ] },
339
+ members: { item: [ set ] },
340
+ limits: { item: [ set.map { options[:limit] } ] }
341
+ )
332
342
  end
333
343
 
334
344
  private
@@ -1,5 +1,5 @@
1
1
  module F5
2
2
  module Icontrol
3
- VERSION = "0.2.4"
3
+ VERSION = "0.2.5"
4
4
  end
5
5
  end
@@ -8,6 +8,56 @@ describe F5::Cli::Pool do
8
8
 
9
9
  let(:client) { double }
10
10
 
11
+ context "setconnections" do
12
+ let(:pool) { double("Pool") }
13
+ let(:out) { 'yup' }
14
+
15
+ before do
16
+ allow(pool).to receive(:get_member_v2).and_return(members)
17
+ allow(client).to receive_message_chain("LocalLB", "Pool") { pool }
18
+ subject.options = { limit: 42 }
19
+ end
20
+
21
+ context "one member" do
22
+ let(:expected) {
23
+ {
24
+ pool_names: { item: [ 'mypool' ] },
25
+ members: { item: [ [ { address: '/Common/node1', port: '80' } ] ] },
26
+ limits: { item: [ [ 42 ] ] }
27
+ }
28
+ }
29
+ let(:members) {
30
+ {:item=>{:item=>{:address=>"/Common/node1", :port=>"80"}, :"@a:array_type"=>"iControl:Common.AddressPort[1]"}, :"@s:type"=>"A:Array", :"@a:array_type"=>"iControl:Common.AddressPort[][1]"}
31
+ }
32
+
33
+ it "calls the API to set the member" do
34
+ expect(pool).to receive(:set_member_connection_limit).with(expected).and_return(out)
35
+
36
+ subject.setconnections('mypool', 'node1')
37
+ end
38
+ end
39
+
40
+ context "two members" do
41
+ let(:expected) {
42
+ {
43
+ pool_names: { item: [ 'mypool' ] },
44
+ members: { item: [ [ { address: '/Common/node1', port: '80' }, { address: '/Common/node2', port: '80' } ] ] },
45
+ limits: { item: [[ 42, 42 ]] }
46
+ }
47
+ }
48
+
49
+ let(:members) {
50
+ {:item=>{:item=>[{:address=>"/Common/node1", :port=>"80"}, {:address=>"/Common/node2", :port=>"80"}], :"@a:array_type"=>"iControl:Common.AddressPort[2]"}, :"@s:type"=>"A:Array", :"@a:array_type"=>"iControl:Common.AddressPort[][1]"}
51
+ }
52
+
53
+ it "calls the API to set the members" do
54
+ expect(pool).to receive(:set_member_connection_limit).with(expected).and_return(out)
55
+
56
+ subject.setconnections('mypool', 'node1', 'node2')
57
+ end
58
+ end
59
+ end
60
+
11
61
  context "setratio" do
12
62
  let(:pool) { double("Pool") }
13
63
  let(:out) { 'yup' }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: f5-icontrol
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Walberg
@@ -461,7 +461,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
461
461
  version: '0'
462
462
  requirements: []
463
463
  rubyforge_project:
464
- rubygems_version: 2.5.1
464
+ rubygems_version: 2.6.11
465
465
  signing_key:
466
466
  specification_version: 4
467
467
  summary: A gem to manage F5 BigIP devices using the iControl API