def get_user():
return getpass.getuser() + '@' + socket.gethostname()
-def kill_process(ctx):
- subprocess.check_call(["kill", "-9", str(ctx.pid)]);
-
def read_config(ctx):
filename = os.path.join(os.environ['HOME'], '.teuthology.yaml')
ctx.teuthology_config = {}
'-p','--pid',
type=int,
default=False,
- help='pid of the process to be deleted',
+ help='pid of the process to be killed',
)
parser.add_argument(
'-r', '--reboot-all',
if ctx.archive:
ctx.config = config_file(ctx.archive + '/config.yaml')
if not ctx.pid:
- ctx.pid = int open(ctx.archive + '/pid').read().rstrip('\n')
+ ctx.pid = int(open(ctx.archive + '/pid').read().rstrip('\n'))
if not ctx.owner:
ctx.owner = open(ctx.archive + '/owner').read().rstrip('\n')
ctx.owner = get_user()
if ctx.pid:
- from teuthology.misc import kill_process
- kill_process(ctx)
+ if ctx.archive:
+ import os
+ os.system('grep -q %s /proc/%d/cmdline && kill %d' % (ctx.archive,
+ ctx.pid,
+ ctx.pid))
+ else:
+ subprocess.check_call(["kill", "-9", str(ctx.pid)]);
nuke(ctx, log, ctx.unlock, ctx.synch_clocks, ctx.reboot_all)