[CORD-2233] Improve feedback state handling

Change-Id: I1018c699473582846a9a02fd50894da93b24593c
diff --git a/xos/synchronizers/new_base/SyncInstanceUsingAnsible.py b/xos/synchronizers/new_base/SyncInstanceUsingAnsible.py
index 53f50a5..480ebf5 100644
--- a/xos/synchronizers/new_base/SyncInstanceUsingAnsible.py
+++ b/xos/synchronizers/new_base/SyncInstanceUsingAnsible.py
@@ -21,7 +21,7 @@
 import base64
 import time
 from xosconfig import Config
-from synchronizers.new_base.syncstep import SyncStep
+from synchronizers.new_base.syncstep import SyncStep, DeferredException
 from synchronizers.new_base.ansible_helper import run_template_ssh
 from synchronizers.new_base.modelaccessor import *
 from xosconfig import Config
@@ -52,7 +52,7 @@
         # zdw, 2017-02-18 - is raising the exception here necessary? - seems like
         # it's just logging the same thing twice
         log.info("defer object", object = str(o), reason = reason, **o.tologdict())
-        raise Exception("defer object %s due to %s" % (str(o), reason))
+        raise DeferredException("defer object %s due to %s" % (str(o), reason))
 
     def get_extra_attributes(self, o):
         # This is a place to include extra attributes that aren't part of the
diff --git a/xos/synchronizers/new_base/event_loop.py b/xos/synchronizers/new_base/event_loop.py
index bff74e3..049297f 100644
--- a/xos/synchronizers/new_base/event_loop.py
+++ b/xos/synchronizers/new_base/event_loop.py
@@ -238,9 +238,11 @@
         else:
             status = str(e)
 
-        if isinstance(e, InnocuousException) or isinstance(
-                e, DeferredException):
+        if isinstance(e, InnocuousException):
             code = 1
+        elif isinstance(e, DeferredException):
+            # NOTE if the synchronization is Deferred it means that synchronization is still in progress
+            code = 0
         else:
             code = 2