Skip to content

Commit

Permalink
Don't raise an exception if a Docker service doesn't have an environment
Browse files Browse the repository at this point in the history
and its env property is accessed
  • Loading branch information
natefoo committed May 2, 2018
1 parent 3e4e285 commit 6984d5f
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions lib/galaxy/containers/docker_model.py
Expand Up @@ -276,11 +276,14 @@ def state(self):
@property
def env(self):
if not self._env:
for env_str in self.inspect['Spec']['TaskTemplate']['ContainerSpec']['Env']:
try:
self._env.update([env_str.split('=', 1)])
except ValueError:
self._env[env_str] = None
try:
for env_str in self.inspect['Spec']['TaskTemplate']['ContainerSpec']['Env']:
try:
self._env.update([env_str.split('=', 1)])
except ValueError:
self._env[env_str] = None
except KeyError as exc:
log.debug('Cannot retrieve container environment: KeyError: %s', str(exc))
return self._env

@property
Expand Down

0 comments on commit 6984d5f

Please sign in to comment.