Rev 3896 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
'''Created on 25-Oct-2011@author: Chandranshu'''import loggingimport subprocessfrom shop2020.config.client.ConfigClient import ConfigClientfrom shop2020.thriftpy.content.ttypes import ContentServiceExceptionlogging.basicConfig(level=logging.DEBUG)class ContentHandler:'''classdocs'''def __init__(self):try:config_client = ConfigClient()self.scriptPath = config_client.get_property('PUSH_PRICES_TO_PROD_SCRIPT_PATH')except:logging.error("Error while connecting to the config server")self.scriptPath = "/root/code/trunk/runutils/push-content-to-production.sh"def pushContentToProduction(self, entityId):"""Push the content of one entity to productionParameters:- entityId"""retval = subprocess.call([self.scriptPath, str(entityId)])if retval:raise ContentServiceException(id=1, message="Pushing content to production failed")return Truedef close_session(self):passdef isAlive(self, ):"""For checking weather service is active alive or not. It also checks connectivity with database"""try:return Trueexcept:return Falsefinally:self.close_session()