From: Josh Durgin Date: Sat, 3 Sep 2011 02:12:16 +0000 (-0700) Subject: lock: default to only listing machines you have locked X-Git-Tag: 1.1.0~2811 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8f2ef43b9ecbe1dfeab20664afcfd84a04bd186c;p=teuthology.git lock: default to only listing machines you have locked --all removes this restriction --- diff --git a/teuthology/lock.py b/teuthology/lock.py index 81937f699..e953376be 100644 --- a/teuthology/lock.py +++ b/teuthology/lock.py @@ -106,7 +106,7 @@ Lock, unlock, or query lock status of machines. '--list', action='store_true', default=False, - help='Show lock info for all machines, or only machines specified. Can be restricted by --owner and --status.', + help='Show lock info for machines owned by you, or only machines specified. Can be restricted by --owner and --status.', ) group.add_argument( '--list-targets', @@ -138,6 +138,12 @@ Lock, unlock, or query lock status of machines. default=False, help='update the description or status of some machines', ) + parser.add_argument( + '-a', '--all', + action='store_true', + default=False, + help='list all machines, not just those owned by you', + ) parser.add_argument( '--owner', default=None, @@ -211,6 +217,13 @@ Lock, unlock, or query lock status of machines. else: assert ctx.num_to_lock or ctx.list or ctx.list_targets, \ 'machines must be specified for that operation' + if ctx.all: + assert ctx.list or ctx.list_targets, \ + '--all can only be used with --list and --list-targets' + assert ctx.owner is None, \ + '--all and --owner are mutually exclusive' + assert not machines, \ + '--all and listing specific machines are incompatible' if ctx.list or ctx.list_targets: assert ctx.desc is None, '--desc does nothing with --list' @@ -221,6 +234,8 @@ Lock, unlock, or query lock status of machines. statuses = list_locks(ctx) if statuses: + if not machines and ctx.owner is None and not ctx.all: + ctx.owner = teuthology.get_user() if ctx.owner is not None: statuses = [status for status in statuses \ if status['locked_by'] == ctx.owner]