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): def delete_node(self, node):
return self.manager.delete_node(self, node) return self.manager.delete_node(self, node)
def update_monitor(self, type_='CONNECT', delay=30, timeout=30, def update_monitor(self, type_, delay, timeout,
attempts=2, path=None): attempts, path=None):
return self.manager.update_monitor( return self.manager.update_monitor(
self, type_=type_, delay=delay, timeout=timeout, attempts=attempts, self, type_=type_, delay=delay, timeout=timeout, attempts=attempts,
path=path) path=path)
@@ -257,8 +257,8 @@ class LoadBalancerManager(Manager):
url = '/loadbalancers/%s/healthmonitor' % getid(lb) url = '/loadbalancers/%s/healthmonitor' % getid(lb)
return self._get(url, obj_class=Monitor) return self._get(url, obj_class=Monitor)
def update_monitor(self, lb, type_='CONNECT', delay=30, timeout=30, def update_monitor(self, lb, type_, delay, timeout,
attempts=2, path=None): attempts, path=None):
""" """
Update a Monitor in a LoadBalancer Update a Monitor in a LoadBalancer
@@ -272,7 +272,7 @@ class LoadBalancerManager(Manager):
data = {} data = {}
data['type'] = type_ data['type'] = type_
if timeout > delay: 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['delay'] = delay
data['timeout'] = timeout data['timeout'] = timeout
data['attemptsBeforeDeactivation'] = attempts data['attemptsBeforeDeactivation'] = attempts

View File

@@ -246,26 +246,22 @@ def do_monitor_show(cs, args):
@cliutils.arg( @cliutils.arg(
'--type', '--type',
choices=['CONNECT', 'HTTP'], choices=['CONNECT', 'HTTP'],
default='CONNECT', help='health monitor type', required=True)
help='health monitor type')
@cliutils.arg( @cliutils.arg(
'--delay', '--delay',
type=int, type=int,
default=30,
metavar='SECONDS', metavar='SECONDS',
help='time between health monitor calls') help='time between health monitor calls', required=True)
@cliutils.arg( @cliutils.arg(
'--timeout', '--timeout',
type=int, type=int,
default=30,
metavar='SECONDS', metavar='SECONDS',
help='time to wait before monitor times out') help='time to wait before monitor times out', required=True)
@cliutils.arg( @cliutils.arg(
'--attempts', '--attempts',
type=int, type=int,
default=2,
metavar='COUNT', metavar='COUNT',
help='connection attempts before marking node as bad') help='connection attempts before marking node as bad', required=True)
@cliutils.arg( @cliutils.arg(
'--path', '--path',
help='URI path for health check') help='URI path for health check')