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:
parent
1b6fc223ff
commit
b2308edae1
@ -28,7 +28,7 @@ import nodepool.cmd
|
|||||||
# instead it depends on lockfile-0.9.1 which uses pidfile.
|
# instead it depends on lockfile-0.9.1 which uses pidfile.
|
||||||
pid_file_module = extras.try_imports(['daemon.pidlockfile', 'daemon.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):
|
def sigint_handler(self, signal, frame):
|
||||||
self.nb.stop()
|
self.nb.stop()
|
||||||
@ -71,15 +71,15 @@ class NodePoolBuilder(nodepool.cmd.NodepoolApp):
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
nb = NodePoolBuilder()
|
app = NodePoolBuilderApp()
|
||||||
nb.parse_arguments()
|
app.parse_arguments()
|
||||||
|
|
||||||
if nb.args.nodaemon:
|
if app.args.nodaemon:
|
||||||
nb.main()
|
app.main()
|
||||||
else:
|
else:
|
||||||
pid = pid_file_module.TimeoutPIDLockFile(nb.args.pidfile, 10)
|
pid = pid_file_module.TimeoutPIDLockFile(app.args.pidfile, 10)
|
||||||
with daemon.DaemonContext(pidfile=pid):
|
with daemon.DaemonContext(pidfile=pid):
|
||||||
nb.main()
|
app.main()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
Loading…
Reference in New Issue
Block a user