Clarify code in nodepool/cmd/builder.py

Clarify code in nodepool/cmd/builder.py so we don't have two classes
named NodePoolBuilder and multiple variables named 'nb'.

Change-Id: Icb77ca2edea49ed3b787e600cf3754160ee1eff8
This commit is contained in:
David Shrewsbury 2016-08-17 10:14:52 -04:00
parent 1b6fc223ff
commit b2308edae1

View File

@ -28,7 +28,7 @@ import nodepool.cmd
# instead it depends on lockfile-0.9.1 which uses pidfile.
pid_file_module = extras.try_imports(['daemon.pidlockfile', 'daemon.pidfile'])
class NodePoolBuilder(nodepool.cmd.NodepoolApp):
class NodePoolBuilderApp(nodepool.cmd.NodepoolApp):
def sigint_handler(self, signal, frame):
self.nb.stop()
@ -71,15 +71,15 @@ class NodePoolBuilder(nodepool.cmd.NodepoolApp):
def main():
nb = NodePoolBuilder()
nb.parse_arguments()
app = NodePoolBuilderApp()
app.parse_arguments()
if nb.args.nodaemon:
nb.main()
if app.args.nodaemon:
app.main()
else:
pid = pid_file_module.TimeoutPIDLockFile(nb.args.pidfile, 10)
pid = pid_file_module.TimeoutPIDLockFile(app.args.pidfile, 10)
with daemon.DaemonContext(pidfile=pid):
nb.main()
app.main()
if __name__ == "__main__":