From 645e6042c2dbf15e6c5f8049574a584344fd1091 Mon Sep 17 00:00:00 2001 From: Marc Pilon Date: Fri, 13 Dec 2013 19:14:14 -0500 Subject: [PATCH] Make all monitoring params required. Otherwise it sets everything back to defaults. Change-Id: I788e6d14cd3136c305a476c5680ec6f781bd506d --- libraclient/v1_1/loadbalancer.py | 10 +++++----- libraclient/v1_1/shell.py | 12 ++++-------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/libraclient/v1_1/loadbalancer.py b/libraclient/v1_1/loadbalancer.py index 57bd437..4a13686 100644 --- a/libraclient/v1_1/loadbalancer.py +++ b/libraclient/v1_1/loadbalancer.py @@ -66,8 +66,8 @@ class LoadBalancer(Resource): def delete_node(self, node): return self.manager.delete_node(self, node) - def update_monitor(self, type_='CONNECT', delay=30, timeout=30, - attempts=2, path=None): + def update_monitor(self, type_, delay, timeout, + attempts, path=None): return self.manager.update_monitor( self, type_=type_, delay=delay, timeout=timeout, attempts=attempts, path=path) @@ -257,8 +257,8 @@ class LoadBalancerManager(Manager): url = '/loadbalancers/%s/healthmonitor' % getid(lb) return self._get(url, obj_class=Monitor) - def update_monitor(self, lb, type_='CONNECT', delay=30, timeout=30, - attempts=2, path=None): + def update_monitor(self, lb, type_, delay, timeout, + attempts, path=None): """ Update a Monitor in a LoadBalancer @@ -272,7 +272,7 @@ class LoadBalancerManager(Manager): data = {} data['type'] = type_ if timeout > delay: - raise ValueError('Timeout can\'t be greater then Delay') + raise ValueError('Timeout can\'t be greater than Delay') data['delay'] = delay data['timeout'] = timeout data['attemptsBeforeDeactivation'] = attempts diff --git a/libraclient/v1_1/shell.py b/libraclient/v1_1/shell.py index 78c5948..91cbe5c 100644 --- a/libraclient/v1_1/shell.py +++ b/libraclient/v1_1/shell.py @@ -246,26 +246,22 @@ def do_monitor_show(cs, args): @cliutils.arg( '--type', choices=['CONNECT', 'HTTP'], - default='CONNECT', - help='health monitor type') + help='health monitor type', required=True) @cliutils.arg( '--delay', type=int, - default=30, metavar='SECONDS', - help='time between health monitor calls') + help='time between health monitor calls', required=True) @cliutils.arg( '--timeout', type=int, - default=30, metavar='SECONDS', - help='time to wait before monitor times out') + help='time to wait before monitor times out', required=True) @cliutils.arg( '--attempts', type=int, - default=2, metavar='COUNT', - help='connection attempts before marking node as bad') + help='connection attempts before marking node as bad', required=True) @cliutils.arg( '--path', help='URI path for health check')