Skip to content

Commit

Permalink
Merge pull request #25188 from rallytime/linode_logs
Browse files Browse the repository at this point in the history
Use linode status descriptions instead of ints when logging status to CLI
  • Loading branch information
Mike Place committed Jul 7, 2015
2 parents 1b2d438 + 300a1f2 commit 6fe7ebd
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions salt/cloud/clouds/linode.py
Original file line number Diff line number Diff line change
Expand Up @@ -1176,11 +1176,15 @@ def _wait_for_job(linode_id, job_id, timeout=300, quiet=True):

time.sleep(interval)
if not quiet:
log.info('Still waiting on Job {0} for {1}'.format(job_id,
linode_id))
log.info('Still waiting on Job {0} for Linode {1}.'.format(
job_id,
linode_id)
)
else:
log.debug('Still waiting on Job {0} for {1}'.format(job_id,
linode_id))
log.debug('Still waiting on Job {0} for Linode {1}.'.format(
job_id,
linode_id)
)
return False


Expand All @@ -1203,6 +1207,8 @@ def _wait_for_status(linode_id, status=None, timeout=300, quiet=True):
if status is None:
status = _get_status_id_by_name('brand_new')

status_desc_waiting = _get_status_descr_by_id(status)

interval = 5
iterations = int(timeout / interval)

Expand All @@ -1212,11 +1218,21 @@ def _wait_for_status(linode_id, status=None, timeout=300, quiet=True):
if result['STATUS'] == status:
return True

status_desc_result = _get_status_descr_by_id(result['STATUS'])

time.sleep(interval)
if quiet:
log.info('Status for {0} is {1}, waiting for {2}'.format(linode_id, result['STATUS'], status))
log.info('Status for Linode {0} is \'{1}\', waiting for \'{2}\'.'.format(
linode_id,
status_desc_result,
status_desc_waiting)
)
else:
log.debug('Status for {0} is {1}, waiting for {2}'.format(linode_id, result, status))
log.debug('Status for Linode {0} is \'{1}\', waiting for \'{2}\'.'.format(
linode_id,
status_desc_result,
status_desc_waiting)
)

return False

Expand Down

0 comments on commit 6fe7ebd

Please sign in to comment.