diff mbox

[Branch,~linaro-validation/lava-server/trunk] Rev 305: Fix default instance computation code

Message ID 20111129093716.13982.83204.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

Zygmunt Krynicki Nov. 29, 2011, 9:37 a.m. UTC
------------------------------------------------------------
revno: 305
committer: Zygmunt Krynicki <zygmunt.krynicki@linaro.org>
branch nick: lava-server
timestamp: Tue 2011-11-22 02:09:28 +0100
message:
  Fix default instance computation code
modified:
  lava_server/manage.py


--
lp:lava-server
https://code.launchpad.net/~linaro-validation/lava-server/trunk

You are subscribed to branch lp:lava-server.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-server/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'lava_server/manage.py'
--- lava_server/manage.py	2011-11-22 00:51:50 +0000
+++ lava_server/manage.py	2011-11-22 01:09:28 +0000
@@ -75,10 +75,17 @@ 
             action="store_true",
             default=True,
             help="Use production settings (default)")
+        try:
+            instance_name = os.environ["LAVA_INSTANCE"]
+        except KeyError:
+            try:
+                instance_name = os.path.basename(os.environ["VIRTUAL_ENV"])
+            except KeyError:
+                instance_name = None
         group.add_argument(
             "-i", "--instance",
             action="store",
-            default=os.environ.get('LAVA_INSTANCE', os.path.basename(os.environ.get('VIRTUAL_ENV', '') or None)),
+            default=instance_name,
             help="Use the specified instance (works only with --production, default %(default)s)")
         group.add_argument(
             "-I", "--instance-template",