summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Oliver <matt@oliver.net.au>2014-04-09 15:24:32 +1000
committerMatthew Oliver <matt@oliver.net.au>2014-04-09 16:20:28 +1000
commitf94977b1ea6db635c19fc4e8449a03b1b74d291a (patch)
treec43245d84d589588aeaff4902a7a48240898dd9f
parent96adb287f8755f089dd68eaa7ac7ee290841f977 (diff)
downloadturbo-hipster-f94977b1ea6db635c19fc4e8449a03b1b74d291a.tar.gz
Fix PBR generated binary error
The PBR generated binary 'turbo-hipster' fails to run as the main method entry point specified now requires a parameter, which PBR doesn't handle. This change adds a new entrypoint for PBR, still named main which will parse the args and create the parameter needed and then called the the setup_server method. Change-Id: Ic11f1da0d2f9a615528bd8620ddf30d81a686498
-rw-r--r--turbo_hipster/cmd/server.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/turbo_hipster/cmd/server.py b/turbo_hipster/cmd/server.py
index 2e4df47..0ca6b0a 100644
--- a/turbo_hipster/cmd/server.py
+++ b/turbo_hipster/cmd/server.py
@@ -30,7 +30,7 @@ from turbo_hipster import worker_server
PID_FILE_MODULE = extras.try_imports(['daemon.pidlockfile', 'daemon.pidfile'])
-def main(args):
+def setup_server(args):
with open(args.config, 'r') as config_stream:
config = yaml.safe_load(config_stream)
@@ -59,7 +59,7 @@ def main(args):
server.shutdown()
-if __name__ == '__main__':
+def main():
sys.path.insert(0, os.path.abspath(
os.path.join(os.path.dirname(__file__), '../')))
parser = argparse.ArgumentParser()
@@ -77,6 +77,10 @@ if __name__ == '__main__':
if args.background:
pidfile = PID_FILE_MODULE.TimeoutPIDLockFile(args.pidfile, 10)
with daemon.DaemonContext(pidfile=pidfile):
- main(args)
+ setup_server(args)
else:
- main(args)
+ setup_server(args)
+
+
+if __name__ == '__main__':
+ main()