Permalink
Browse files

Fail with ConfigError without UnboundLocalError

When volumes configuration has an error in it, loop does not break
correctly. A ConfigError is returned but the  succeeding code actual
fails with an UnboundLocalError as well since volume and bind were
never initialised.

Failure before this change :
Restarting buildmaster "FRB Buildmaster"
            self.volumes.append(volume)
        exceptions.UnboundLocalError: local variable 'volume' referenced
before assignment

2016-03-15 21:27:27+0000 [-] Configuration Errors:
2016-03-15 21:27:27+0000 [-]   Invalid volume definition for docker
/tmp/t/tmp/t. Skipping...
2016-03-15 21:27:27+0000 [-]   error while parsing config file: local
variable 'volume' referenced before assignment (traceback in logfile)
2016-03-15 21:27:27+0000 [-] Halting master.

Failure after this change :
Restarting buildmaster "FRB Buildmaster"
2016-03-15 21:27:19+0000 [-]
2016-03-15 21:27:19+0000 [-] Configuration Errors:
2016-03-15 21:27:19+0000 [-]   Invalid volume definition for docker
/tmp/t/tmp/t. Skipping...
2016-03-15 21:27:19+0000 [-] Halting master.
  • Loading branch information...
anish committed Mar 15, 2016
1 parent 605ed7b commit 0c877e3f4781e44c6bf73d40120f302c8ae99e64
Showing with 1 addition and 0 deletions.
  1. +1 −0 master/buildbot/worker/docker.py
@@ -79,6 +79,7 @@ def __init__(self, name, password, docker_host, image=None, command=None,
except ValueError:
config.error("Invalid volume definition for docker "
"%s. Skipping..." % volume_string)
continue
self.volumes.append(volume)
ro = False

0 comments on commit 0c877e3

Please sign in to comment.