f5-icontrol 0.3.3 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/f5/cli/application.rb +42 -0
- data/lib/f5/icontrol/rapi.rb +3 -1
- data/lib/f5/icontrol/version.rb +1 -1
- data/spec/models/rapi_spec.rb +9 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 416fc2853ce2a392dc8756e1a5cfc8a9657cb781
|
4
|
+
data.tar.gz: 22329e0a4ee6a4fb59306a88864cdfc3a17477b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ad482e38ee60854c7a5c116651d45d4cd41a36fbefaa10d27059083d772ffe0ceb1a9721d8fa11a57d386a490e3a0e2ca82daf2a278e35fec5b6872b05e2af1
|
7
|
+
data.tar.gz: 3de9ff615d6063365e6bcdd5ceb29fa3a441fe32f201f2da7182577f574eef0586f3fed304a76f88a49850037a35b115e4d94c41c7692774f4e03ce855996f04
|
data/CHANGELOG.md
CHANGED
data/lib/f5/cli/application.rb
CHANGED
@@ -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
|
data/lib/f5/icontrol/rapi.rb
CHANGED
@@ -63,7 +63,9 @@ module F5
|
|
63
63
|
|
64
64
|
private
|
65
65
|
def url
|
66
|
-
|
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
|
data/lib/f5/icontrol/version.rb
CHANGED
data/spec/models/rapi_spec.rb
CHANGED
@@ -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.
|
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-
|
11
|
+
date: 2019-10-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: savon
|