f5-icontrol 0.3.3 → 0.3.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 160d69b35270ab267f40fa78210edec5b437f42a
4
- data.tar.gz: 903618319da6c650578e9528f66388196ecd4fd2
3
+ metadata.gz: 416fc2853ce2a392dc8756e1a5cfc8a9657cb781
4
+ data.tar.gz: 22329e0a4ee6a4fb59306a88864cdfc3a17477b9
5
5
  SHA512:
6
- metadata.gz: 054c2d5a635de5598ed0b06f53b16cccc14db113dda7f674f11131bc158416c9342ddaf770a2f78172fd71495eceaf04d7b729da732c04db237b3e6a49387620
7
- data.tar.gz: 7a129c736b58395e0e7e93e376b634ae3a81bcc29857c0f866faad6f54b44549590bd0e4fc32ffd8963e444da4c5640d39f61a4ddbc8affba70d01465af0243a
6
+ metadata.gz: 4ad482e38ee60854c7a5c116651d45d4cd41a36fbefaa10d27059083d772ffe0ceb1a9721d8fa11a57d386a490e3a0e2ca82daf2a278e35fec5b6872b05e2af1
7
+ data.tar.gz: 3de9ff615d6063365e6bcdd5ceb29fa3a441fe32f201f2da7182577f574eef0586f3fed304a76f88a49850037a35b115e4d94c41c7692774f4e03ce855996f04
@@ -1,4 +1,7 @@
1
1
  # Changelog
2
+
3
+ ## 0.3.5
4
+ mattlqx - prevent underscores in pool names
2
5
  ## 0.2.5
3
6
  swalberg - support setting pool member connection limits
4
7
  ## 0.2.4
@@ -430,6 +430,45 @@ module F5
430
430
  end
431
431
  end
432
432
 
433
+ class VirtualServer < Subcommand
434
+
435
+ desc "list", "Lists all the virtual servers"
436
+ def list
437
+ response = client.LocalLB.VirtualServer.get_list
438
+
439
+ virtualservers = Array(response[:item])
440
+ if virtualservers.empty?
441
+ puts "No virtual servers found"
442
+ else
443
+ virtualservers.each do |p|
444
+ puts p
445
+ end
446
+ end
447
+ end
448
+
449
+ desc "show VSERVER_NAME", "Shows information about a virtual server"
450
+ def show(vserver)
451
+ destination = extract_items client.LocalLB.VirtualServer.get_destination(virtual_servers: { item: [vserver] } )
452
+ protocol = extract_items client.LocalLB.VirtualServer.get_protocol(virtual_servers: { item: [vserver] } )
453
+ default_pool = extract_items client.LocalLB.VirtualServer.get_default_pool_name(virtual_servers: { item: [vserver] } )
454
+
455
+ puts "%-25s %-20s %-20s %-20s" % ["Destination Address", "Destination Port", "Protocol", "Default Pool"]
456
+ puts "%-25s %-20s %-20s %-20s" % [destination[:address], destination[:port], protocol.split('_').last, default_pool]
457
+ end
458
+
459
+ desc "status VSERVER_NAME", "Shows the status of the virtual server"
460
+ def status(vserver)
461
+ response = client.LocalLB.VirtualServer.get_object_status(virtual_servers: { item: [vserver] } )
462
+
463
+ availability = response[:item][:availability_status].split('_').last
464
+ enabled = response[:item][:enabled_status].split('_').last
465
+ status_description = response[:item][:status_description]
466
+
467
+ puts "%-40s %-20s %-20s %-20s" % ["Name", "Availability", "Enabled", "Status Description"]
468
+ puts "%-40s %-20s %-20s %-20s" % [vserver, availability, enabled, status_description]
469
+ end
470
+ end
471
+
433
472
  class Application < Thor
434
473
  class_option :lb, default: 'default'
435
474
 
@@ -458,6 +497,9 @@ module F5
458
497
 
459
498
  desc "devicegroup SUBCOMMAND ...ARGS", "manage device groups"
460
499
  subcommand "devicegroup", DeviceGroup
500
+
501
+ desc "vserver SUBCOMMAND ...ARGS", "manage virtual servers"
502
+ subcommand "vserver", VirtualServer
461
503
  end
462
504
  end
463
505
  end
@@ -63,7 +63,9 @@ module F5
63
63
 
64
64
  private
65
65
  def url
66
- method_chain = @method_chain.gsub /_/, '-'
66
+ pool_match = @method_chain.match %r{(/pool/[A-Za-z0-9\-_~]+)}
67
+ method_chain = @method_chain.tr '_', '-'
68
+ method_chain = method_chain.sub %r{/pool/[A-Za-z0-9\-_~]+}, pool_match[1] unless pool_match.nil?
67
69
  method_chain.gsub! %r{^/}, ''
68
70
  "https://#{@args[:host]}/#{method_chain}"
69
71
  end
@@ -1,5 +1,5 @@
1
1
  module F5
2
2
  module Icontrol
3
- VERSION = '0.3.3'
3
+ VERSION = '0.3.5'
4
4
  end
5
5
  end
@@ -40,6 +40,15 @@ describe F5::Icontrol::RAPI do
40
40
  expect(WebMock).to have_requested(:get, "#{baseurl}/foo-bar/")
41
41
  end
42
42
 
43
+ it "preserves underscores in pool names" do
44
+ stub_request(:get, "#{baseurl}/pool/foo_bar").
45
+ to_return(body: pool_collection)
46
+
47
+ subject.pool.load('foo_bar')
48
+
49
+ expect(WebMock).to have_requested(:get, "#{baseurl}/pool/foo_bar")
50
+ end
51
+
43
52
  it "understands `each` implicitly calls `get_collection`" do
44
53
  stub_request(:get, "#{baseurl}/foo/bar/").
45
54
  to_return(body: pool_collection)
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.3.3
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Walberg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-07 00:00:00.000000000 Z
11
+ date: 2019-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: savon