Changeset 31231
- Timestamp:
- Apr 7, 2011, 10:06:53 AM (15 years ago)
- File:
-
- 1 edited
-
trunk/ippToPsps/jython/datastore.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippToPsps/jython/datastore.py
r31226 r31231 4 4 import tempfile 5 5 import logging 6 import sys 6 7 from xml.etree.ElementTree import ElementTree, Element, tostring 7 8 … … 27 28 self.type = doc.find("datastore/type").text 28 29 29 self.logger.debug("Publishing to '" + self.product + "' product") 30 30 self.logger.debug("Using product: '" + self.product + "' and type: '" + self.type + "'") 31 31 32 32 ''' … … 35 35 def publish(self, name, path, file, fileType): 36 36 37 self.logger.info("Attempting to publish '" + path +"/" + file + "' to datastore product: '" + self.product + "', type: '" + self.type + "'") 37 38 tempFile = tempfile.NamedTemporaryFile(mode='w+b') 38 39 tempFile.write(file + "|||" + fileType) … … 48 49 p = Popen(command, shell=True, stdout=PIPE) 49 50 p.wait() 50 51 #TODO check success print "Return from dsreg: " + p.stdout.read() 51 52 if p.returncode != 0: 53 self.logger.error("Datastore publish failed") 54 ret = False 55 else: 56 self.logger.info("Datastore publish successful") 57 ret = True 58 52 59 53 60 tempFile.close() 61 return ret 62 63 64 ''' 65 Removes an item to the datastore 66 ''' 67 def remove(self, name): 68 69 command = "dsreg \ 70 --del " + name + " \ 71 --rm \ 72 --product " + self.product 73 74 p = Popen(command, shell=True, stdout=PIPE) 75 p.wait() 76 77 if p.returncode != 0: 78 self.logger.error("Datastore removal of " + name + " failed") 79 ret = False 80 else: 81 ret = True 82 self.logger.info("Datastore removal of " + name + " successful") 83 84 return ret 85
Note:
See TracChangeset
for help on using the changeset viewer.
