Make all monitoring params required. Otherwise it sets

everything back to defaults.

Change-Id: I788e6d14cd3136c305a476c5680ec6f781bd506d
This commit is contained in:
Marc Pilon 2013-12-13 19:14:14 -05:00
parent 4b15e6ece9
commit 645e6042c2
2 changed files with 9 additions and 13 deletions

View File

@ -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

View File

@ -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')