From f26d41d74eed9dfc03ace72a0a152ffa5a973060 Mon Sep 17 00:00:00 2001
From: Nicolas Wavrant <nicolas.wavrant@tiolive.com>
Date: Wed, 16 Oct 2013 14:17:31 +0200
Subject: [PATCH] slaprunner: isSRRelease now works if no software had been
 runned before

---
 slapos/runner/utils.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/slapos/runner/utils.py b/slapos/runner/utils.py
index ca65d09..5f9b0cc 100755
--- a/slapos/runner/utils.py
+++ b/slapos/runner/utils.py
@@ -814,7 +814,11 @@ def isSoftwareReleaseReady(config):
   project = os.path.join(config['etc_dir'], '.project')
   if not os.path.exists(project):
     return "0";
-  software_name = open(project, 'r').readline().split('/')[-2]
+  path  = open(project, 'r').readline().strip()
+  software_name = path
+  if software_name[-1] == '/':
+    software_name = software_name[:-1]
+  software_name = software_name.split('/')[-1]
   if os.path.exists(os.path.join(config['runner_workdir'], 
       'softwareLink', software_name, '.completed')):
     return "1"
@@ -822,6 +826,7 @@ def isSoftwareReleaseReady(config):
     if isSoftwareRunning(config):
       return "2"
     elif config['auto_deploy'] in (1, '1', True, 'true'):
+      configNewSR(config, path)
       runSoftwareWithLock(config)
       return "2"
     else:
-- 
2.30.9