From: Sam Lang Date: Wed, 17 Apr 2013 00:08:45 +0000 (-0500) Subject: misc: Check for 'None' string from yaml X-Git-Tag: 1.1.0~2177^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=750c69b08c0c4d69deaf78e425f19b659a6bca8f;p=teuthology.git misc: Check for 'None' string from yaml The description attribute from the machines yaml returned by the locker might be the string 'None'. Need to explicitly check for that to avoid using a test dir of /tmp/cephtest/None. Signed-off-by: Sam Lang --- diff --git a/teuthology/misc.py b/teuthology/misc.py index 2332c764c..1a2e98ad9 100644 --- a/teuthology/misc.py +++ b/teuthology/misc.py @@ -38,15 +38,20 @@ def get_testdir(ctx): jobids = {} for machine in ctx.config['targets'].iterkeys(): status = lockstatus.get_status(ctx, machine) + if status is None or 'description' not in status: + continue jid = status['description'].split('/')[-1] + if jid is None or jid == 'None': + continue jobids[jid] = 1 if len(jobids) > 1: break if len(jobids) == 1: # same job id on all machines, use that as the test subdir (jobid,) = jobids.iterkeys() - global_jobid = jobid - log.debug('setting my jobid to {jid}'.format(jid=global_jobid)) + if jobid is not None: + global_jobid = jobid + log.debug('setting my jobid to {jid}'.format(jid=global_jobid)) checked_jobid = True # the subdir is chosen using the priority: @@ -54,7 +59,7 @@ def get_testdir(ctx): # 2. run name specified by teuthology schedule # 3. user@timestamp if global_jobid is not None: - log.debug('with jobid basedir: {b}'.format(b=str(global_jobid))) + log.debug('with jobid basedir: {b}'.format(b=global_jobid)) return '{basedir}/{jobid}'.format( basedir=basedir, jobid=global_jobid,