diff options
author | Ulas Kozat <ulas.kozat@gmail.com> | 2016-06-09 16:43:16 -0700 |
---|---|---|
committer | Ulas Kozat <ulas.kozat@gmail.com> | 2016-06-09 16:43:16 -0700 |
commit | 54ceb4a7a213805811c92583d519dce4d4ef6e3f (patch) | |
tree | 41720d0cf04edf0cdf837aab83080417f156257e /DominoClient.py | |
parent | 5b6b8842cfa56abcb4d7f23b37d02912a7d26199 (diff) |
files pushed to the client are written to files under directories named after udid
Change-Id: I28b5dd6ce3bcc9592108ffecbd325b4290ddeddf
Signed-off-by: Ulas Kozat <ulas.kozat@gmail.com>
Diffstat (limited to 'DominoClient.py')
-rwxr-xr-x | DominoClient.py | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/DominoClient.py b/DominoClient.py index 067b090..a31e074 100755 --- a/DominoClient.py +++ b/DominoClient.py @@ -12,9 +12,9 @@ # limitations under the License. -import sys, glob, threading +import sys, os, glob, threading import getopt, socket -import logging +import logging, errno #sys.path.append('gen-py') #sys.path.insert(0, glob.glob('./lib/py/build/lib.*')[0]) @@ -66,10 +66,25 @@ class CommunicationHandler: def d_push(self, push_msg): logging.info('%d Received Template File', self.dominoClient.UDID) # Retrieve the template file - - ## End of retrieval - - # Any inspection code goes here + try: + os.makedirs(TOSCA_RX_DIR+str(self.dominoClient.UDID)) + except OSError as exception: + if exception.errno == errno.EEXIST: + logging.debug('IGNORING error: ERRNO %d; %s exists.', exception.errno, TOSCA_RX_DIR+str(self.dominoClient.UDID)) + else: + logging.error('IGNORING error in creating %s. Err no: %d', exception.errno) + + try: + miscutil.write_templatefile(TOSCA_RX_DIR+str(self.dominoClient.UDID)+'/'+str(push_msg.seq_no)+'.yaml' , push_msg.template) + except: + logging.error('FAILED to write the pushed file: %s', sys.exc_info()[0]) + push_r = PushResponseMessage() + # Fill response message fields + push_r.domino_udid = self.dominoClient.UDID + push_r.seq_no = self.dominoClient.seqno + push_r.responseCode = FAILED + self.dominoClient.seqno = self.dominoClient.seqno + 1 + return push_r# Any inspection code goes here ## End of inspection |