Skip to content

Commit

Permalink
MB-5948: limit execution of bucket commands by 1 minute
Browse files Browse the repository at this point in the history
Change-Id: Ifebdbcecf4b391fe492238c822507b9870afca1e
Reviewed-on: http://review.couchbase.org/19279
Reviewed-by: Steve Yen <steve.yen@gmail.com>
Tested-by: Pavel Paulau <pavel.paulau@gmail.com>
  • Loading branch information
pavel-paulau committed Aug 13, 2012
1 parent 64cc611 commit ea5c625
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions buckets.py
Expand Up @@ -4,6 +4,8 @@
from usage import usage

import restclient
from timeout import timed_out


rest_cmds = {
'bucket-list': '/pools/default/buckets',
Expand Down Expand Up @@ -32,6 +34,7 @@ def __init__(self):
self.rest_cmd = rest_cmds['bucket-list']
self.method = 'GET'

@timed_out(60)
def runCmd(self, cmd, server, port,
user, password, opts):
self.user = user
Expand Down
7 changes: 6 additions & 1 deletion couchbase-cli
Expand Up @@ -7,13 +7,15 @@ couchbase-cli - command-line cluster administration tool

import getopt
import sys

import listservers
import buckets
import node
import info
import util_cli as util

from usage import usage, short_usage
from timeout import TimeoutException


def main():
for x in sys.argv:
Expand Down Expand Up @@ -114,6 +116,9 @@ def main():

try:
c.runCmd(cmd, server, port, user, password, opts)
except TimeoutException, err:
print "TIMED OUT: command: %s: %s:%d, %s" % (cmd, server, port, err)
sys.exit(1)
except Exception, err:
print "ERROR: command: %s: %s:%d, %s" % (cmd, server, port, err)
sys.exit(1)
Expand Down

0 comments on commit ea5c625

Please sign in to comment.