netscaler-cli 0.3.3 → 0.4.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/Gemfile +7 -3
- data/Gemfile.lock +17 -8
- data/README.markdown +6 -3
- data/Rakefile +4 -6
- data/bin/{netscaler-server → netscaler} +2 -2
- data/etc/Version +1 -1
- data/lib/netscaler/{baseexecutor.rb → base_request.rb} +3 -4
- data/lib/netscaler/cli.rb +201 -0
- data/lib/netscaler/config.rb +20 -15
- data/lib/netscaler/executor.rb +34 -0
- data/lib/netscaler/extensions.rb +47 -0
- data/lib/netscaler/server/request.rb +35 -0
- data/lib/netscaler/server/response.rb +67 -0
- data/lib/netscaler/service/request.rb +42 -0
- data/lib/netscaler/service/response.rb +44 -0
- data/lib/netscaler/vserver/request.rb +67 -0
- data/lib/netscaler/vserver/response.rb +125 -0
- data/spec/netscaler/cli_spec.rb +140 -0
- data/spec/{config_spec.rb → netscaler/config_spec.rb} +23 -9
- data/spec/{configs → netscaler/configs}/bad-yaml.yml +0 -0
- data/spec/{configs → netscaler/configs}/missing-username.yml +0 -0
- data/spec/{configs → netscaler/configs}/simple-config.yml +2 -1
- data/spec/netscaler/extenstions_spec.rb +26 -0
- data/spec/{helpers.rb → spec_helpers.rb} +0 -0
- metadata +108 -53
- data/bin/netscaler-service +0 -5
- data/bin/netscaler-vserver +0 -5
- data/lib/netscaler/clitemplate.rb +0 -147
- data/lib/netscaler/server/cli.rb +0 -60
- data/lib/netscaler/server/executor.rb +0 -115
- data/lib/netscaler/service/cli.rb +0 -49
- data/lib/netscaler/service/executor.rb +0 -82
- data/lib/netscaler/vserver/cli.rb +0 -92
- data/lib/netscaler/vserver/executor.rb +0 -194
- data/spec/server/cli_spec.rb +0 -33
- data/spec/service/cli_spec.rb +0 -45
- data/spec/vserver/cli_spec.rb +0 -75
data/spec/server/cli_spec.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
require 'helpers'
|
2
|
-
require 'netscaler/server/cli'
|
3
|
-
|
4
|
-
module Netscaler::Server
|
5
|
-
|
6
|
-
module CLIHelper
|
7
|
-
def parse(*args)
|
8
|
-
cli = CLI.new(args)
|
9
|
-
cli.parse_options(args)
|
10
|
-
cli.options
|
11
|
-
end
|
12
|
-
|
13
|
-
def validate(*args)
|
14
|
-
cli = CLI.new(args)
|
15
|
-
cli.parse_options(args)
|
16
|
-
cli.validate_args(args)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
describe "The CLI interface" do
|
21
|
-
include CLIHelper
|
22
|
-
|
23
|
-
describe "while parsing" do
|
24
|
-
it "should set the --enable flag correctly." do
|
25
|
-
parse('--enable')[:action][0].should eql(:enable)
|
26
|
-
end
|
27
|
-
|
28
|
-
it "should set the --disable flag correctly." do
|
29
|
-
parse('--disable')[:action][0].should eql(:disable)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
data/spec/service/cli_spec.rb
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
require 'helpers'
|
2
|
-
require 'netscaler/service/cli'
|
3
|
-
|
4
|
-
module Netscaler::Service
|
5
|
-
|
6
|
-
module CLIHelper
|
7
|
-
def parse(*args)
|
8
|
-
cli = CLI.new(args)
|
9
|
-
cli.parse_options(args)
|
10
|
-
cli.options
|
11
|
-
end
|
12
|
-
|
13
|
-
def validate(*args)
|
14
|
-
cli = CLI.new(args)
|
15
|
-
cli.parse_options(args)
|
16
|
-
cli.validate_args(args)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
describe "The CLI interface" do
|
21
|
-
include CLIHelper
|
22
|
-
|
23
|
-
describe "while parsing" do
|
24
|
-
it "should set the --enable flag correctly." do
|
25
|
-
parse('--enable')[:action][0].should eql(:enable)
|
26
|
-
end
|
27
|
-
|
28
|
-
it "should set the --disable flag correctly." do
|
29
|
-
parse('--disable')[:action][0].should eql(:disable)
|
30
|
-
end
|
31
|
-
|
32
|
-
it "should set the --bind flag correctly." do
|
33
|
-
opts = parse('--bind', 'some-vserver')
|
34
|
-
opts[:action][0].should eql(:bind)
|
35
|
-
opts[:vserver].should eql('some-vserver')
|
36
|
-
end
|
37
|
-
|
38
|
-
it "should set the --unbind flag correctly." do
|
39
|
-
opts = parse('--unbind', 'some-vserver')
|
40
|
-
opts[:action][0].should eql(:unbind)
|
41
|
-
opts[:vserver].should eql('some-vserver')
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
data/spec/vserver/cli_spec.rb
DELETED
@@ -1,75 +0,0 @@
|
|
1
|
-
require 'helpers'
|
2
|
-
require 'netscaler/vserver/cli'
|
3
|
-
|
4
|
-
module Netscaler::VServer
|
5
|
-
|
6
|
-
module CLIHelper
|
7
|
-
def parse(*args)
|
8
|
-
cli = CLI.new(args)
|
9
|
-
cli.parse_options(args)
|
10
|
-
cli.options
|
11
|
-
end
|
12
|
-
|
13
|
-
def validate(*args)
|
14
|
-
cli = CLI.new(args)
|
15
|
-
cli.parse_options(args)
|
16
|
-
cli.validate_args(args)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
describe "The CLI interface" do
|
21
|
-
include CLIHelper
|
22
|
-
|
23
|
-
describe "while parsing" do
|
24
|
-
it "should set the --netscaler flag correctly." do
|
25
|
-
parse('--netscaler', 'localhost')[:netscaler].should eql('localhost')
|
26
|
-
end
|
27
|
-
|
28
|
-
it "should set the --debug flag correctly." do
|
29
|
-
parse('--debug')[:debug].should be(true)
|
30
|
-
end
|
31
|
-
|
32
|
-
it "should set the --enable flag correctly." do
|
33
|
-
parse('--enable')[:action][0].should eql(:enable)
|
34
|
-
end
|
35
|
-
|
36
|
-
it "should set the --disable flag correctly." do
|
37
|
-
parse('--disable')[:action][0].should eql(:disable)
|
38
|
-
end
|
39
|
-
|
40
|
-
it "should set the --bind flag correctly." do
|
41
|
-
opts = parse('--bind', 'some-policy')
|
42
|
-
opts[:action][0].should eql(:bind)
|
43
|
-
opts[:policy_name].should eql('some-policy')
|
44
|
-
end
|
45
|
-
|
46
|
-
it "should set the --unbind flag correctly." do
|
47
|
-
opts = parse('--unbind', 'some-policy')
|
48
|
-
opts[:action][0].should eql(:unbind)
|
49
|
-
opts[:policy_name].should eql('some-policy')
|
50
|
-
end
|
51
|
-
|
52
|
-
it "should fail when the --priority flag is not an integer" do
|
53
|
-
attempting_to { parse('--priority', 'blah') }.should raise_error(OptionParser::InvalidArgument)
|
54
|
-
end
|
55
|
-
|
56
|
-
it "should set the --priority flag correctly." do
|
57
|
-
parse('--priority', '6')[:priority].should eql(6)
|
58
|
-
end
|
59
|
-
|
60
|
-
it "should set the --config flag correctly." do
|
61
|
-
parse('--config', 'CONFIG')[:config].should eql('CONFIG')
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
describe "while validating" do
|
66
|
-
it "should fail when the priority flag is set with unbind" do
|
67
|
-
attempting_to { validate('-n', 'net', '--unbind', 'policy', '--priority', '5', 'host') }.should raise_error(Netscaler::ConfigurationError, /priority/)
|
68
|
-
end
|
69
|
-
|
70
|
-
it "should set the priority when the bind flag is set." do
|
71
|
-
validate('-n', 'net', '--bind', 'policy', '--priority', '5', 'host')
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|