Publish routine turns FAILED status when distribution or translation fails 73/15673/1
authorUlas Kozat <ulas.kozat@gmail.com>
Wed, 15 Jun 2016 22:57:01 +0000 (15:57 -0700)
committerUlas Kozat <ulas.kozat@gmail.com>
Wed, 15 Jun 2016 22:57:01 +0000 (15:57 -0700)
Change-Id: Ie66dbd2edfa9ab28e21701b3ac79242c7d5c507e
Signed-off-by: Ulas Kozat <ulas.kozat@gmail.com>
DominoServer.py

index c7d58ef..cdb2fa1 100755 (executable)
@@ -286,7 +286,13 @@ class CommunicationHandler:
  
     # Create work-flow
 
-
+    # Create response with response code as SUCCESS by default
+    # Response code will be overwrittent if partial or full failure occurs
+    pub_r = PublishResponseMessage()
+    pub_r.domino_udid = SERVER_UDID
+    pub_r.seq_no = self.seqno
+    pub_r.responseCode = SUCCESS
+    self.seqno = self.seqno + 1
 
     # Send domain templates to each domain agent/client 
     # FOR NOW: send untranslated but partitioned tosca files to scheduled sites
@@ -306,15 +312,11 @@ class CommunicationHandler:
         self.push_template(template_lines, domino_client_ip, domino_client_port)
       except IOError as e:
         logging.error('I/O error(%d): %s' , e.errno, e.strerror)
+        pub_r.responseCode = FAILED
       except:
         logging.error('Error: %s', sys.exc_info()[0])
+        pub_r.responseCode = FAILED
 
-    #Fill in the details
-    pub_r = PublishResponseMessage()
-    pub_r.domino_udid = SERVER_UDID
-    pub_r.seq_no = self.seqno
-    pub_r.responseCode = SUCCESS
-    self.seqno = self.seqno + 1 
     return pub_r
     
   #Query from Domino Client is received