From fe860bc728c7d6941a24df34e62f4be842c97859 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=A9dric=20de=20Saint=20Martin?= <cedric.dsm@tiolive.com>
Date: Thu, 5 Sep 2013 14:17:27 +0200
Subject: [PATCH] Fix request.py for slave instances.

Workaround because slaptool behaves weird.
One day, my friend, one day, we'll use the new API and we won't bloat our code with exceptions.
---
 slapos/recipe/request.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/slapos/recipe/request.py b/slapos/recipe/request.py
index b5f79d7ea..47d9c3825 100644
--- a/slapos/recipe/request.py
+++ b/slapos/recipe/request.py
@@ -163,7 +163,12 @@ class Recipe(object):
         if self.failed is None:
           self.failed = param
     options['requested-state'] = requested_state
-    options['instance-state'] = self.instance.getState()
+    try:
+      options['instance-state'] = self.instance.getState()
+    except slapmodule.ResourceNotReady:
+       # Odd case: SlapOS Master doesn't send the state of a slave partition.
+       # XXX Should be fixed in the SlapOS Master, we should not care here.
+       pass
 
   def _filterForStorage(self, partition_parameter_kw):
     return partition_parameter_kw
-- 
2.30.9