Commit 7dbf0ba4 authored by Jérome Perrin's avatar Jérome Perrin

grid/utils: minor cleanups

 - Use dict.items() to iterate on dict, instead of dict.keys() then dict[key]
 - don't use six.iterkeys(), this dict is small, so we don't need iterkeys()
   on python2 and can already write python3 version
 - don't % string when invoking logger, logging framework do it for us and do
   it only if message will be logged.
parent 261072c7
...@@ -40,7 +40,6 @@ import logging ...@@ -40,7 +40,6 @@ import logging
import psutil import psutil
import time import time
import six
from slapos.grid.exception import BuildoutFailedError, WrongPermissionError from slapos.grid.exception import BuildoutFailedError, WrongPermissionError
...@@ -150,10 +149,10 @@ def getCleanEnvironment(logger, home_path='/tmp'): ...@@ -150,10 +149,10 @@ def getCleanEnvironment(logger, home_path='/tmp'):
if old is not None: if old is not None:
removed_env.append(k) removed_env.append(k)
changed_env['HOME'] = env['HOME'] = home_path changed_env['HOME'] = env['HOME'] = home_path
for k in sorted(six.iterkeys(changed_env)): for k, v in sorted(changed_env.items()):
logger.debug('Overridden %s = %r' % (k, changed_env[k])) logger.debug('Overridden %s = %r', k, v)
if removed_env: if removed_env:
logger.debug('Removed from environment: %s' % ', '.join(sorted(removed_env))) logger.debug('Removed from environment: %s', ', '.join(sorted(removed_env)))
return env return env
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment