Fixes for client options parser
This commit is contained in:
@@ -23,13 +23,8 @@ def main():
|
||||
api = LibraAPI(args.os_username, args.os_password, args.os_tenant_name,
|
||||
args.os_auth_url, args.os_region_name)
|
||||
|
||||
if args.command == 'list':
|
||||
api.list_lb()
|
||||
elif args.command == 'status':
|
||||
api.get_lb(args.lbid)
|
||||
elif args.command == 'modify':
|
||||
api.modify_lb(args)
|
||||
elif args.command == 'create':
|
||||
api.create_lb(args)
|
||||
method = getattr(api, '{cmd}_lb'.format(cmd=args.command))
|
||||
|
||||
method(args)
|
||||
|
||||
return 0
|
||||
|
||||
@@ -86,7 +86,7 @@ class ClientOptions(object):
|
||||
sp = subparsers.add_parser(
|
||||
'status', help='get status of a load balancer'
|
||||
)
|
||||
sp.add_argument('--id', help='load balancer ID', requied=True)
|
||||
sp.add_argument('--id', help='load balancer ID', required=True)
|
||||
sp = subparsers.add_parser(
|
||||
'node-list', help='list nodes in a load balancer'
|
||||
)
|
||||
|
||||
@@ -27,7 +27,7 @@ class LibraAPI(object):
|
||||
service_type='libra'
|
||||
)
|
||||
|
||||
def list_lb(self):
|
||||
def list_lb(self, args):
|
||||
resp, body = self._get('/loadbalaners')
|
||||
column_names = ['Name', 'ID', 'Protocol', 'Port', 'Algorithm',
|
||||
'Status', 'Created', 'Updated']
|
||||
@@ -35,8 +35,8 @@ class LibraAPI(object):
|
||||
'created', 'updated']
|
||||
self._render_list(column_names, columns, body['loadBalancers'])
|
||||
|
||||
def get_lb(self, lbid):
|
||||
resp, body = self._get('/loadbalancers/{0}'.format(lbid))
|
||||
def status_lb(self, args):
|
||||
resp, body = self._get('/loadbalancers/{0}'.format(args.lbid))
|
||||
column_names = ['ID', 'Name', 'Protocol', 'Port', 'Algorithm',
|
||||
'Status', 'Created', 'Updated', 'IPs', 'Nodes',
|
||||
'Persistence Type', 'Connection Throttle']
|
||||
|
||||
Reference in New Issue
Block a user