示例#1
0
 def __init__(self, logger):
     try:
         Config = waagent.ConfigurationProvider(None)
     except Exception as e:
         Config = waagent.ConfigurationProvider()
     self.logger = logger
     self.proxyHost = Config.get("HttpProxy.Host")
     self.proxyPort = Config.get("HttpProxy.Port")
     self.tmpFile = './tmp_file_FD76C85E-406F-4CFA-8EB0-CF18B123365C'
 def __init__(self, hutil):
     try:
         waagent.MyDistro = waagent.GetMyDistro()
         Config = waagent.ConfigurationProvider(None)
     except Exception as e:
         errorMsg = "Failed to construct ConfigurationProvider, which may due to the old wala code with error: %s, stack trace: %s" % (str(e), traceback.format_exc())
         hutil.log(errorMsg)
         Config = waagent.ConfigurationProvider()
     self.logger = hutil
     self.proxyHost = Config.get("HttpProxy.Host")
     self.proxyPort = Config.get("HttpProxy.Port")
     self.tmpFile = './tmp_file_FD76C85E-406F-4CFA-8EB0-CF18B123365C'
示例#3
0
 def __init__(self, logger):
     self.logger = logger
     try:
         waagent.MyDistro = waagent.GetMyDistro()
         Config = waagent.ConfigurationProvider(None)
     except Exception as e:
         errorMsg = "Failed to construct ConfigurationProvider, which may due to the old wala code."
         self.logger.log(errorMsg)
         Config = waagent.ConfigurationProvider()
     self.proxyHost = Config.get("HttpProxy.Host")
     self.proxyPort = Config.get("HttpProxy.Port")
     self.connection = None
 def __new__(cls, hutil):
     if(cls.__instance is None):
         hutil.log("Creating HttpUtil")
         cls.__instance = super(HttpUtil, cls).__new__(cls)
         Config = None
         cls.__instance.proxyHost = None
         cls.__instance.proxyPort = None
         try:
             waagent.MyDistro = waagent.GetMyDistro()
             Config = waagent.ConfigurationProvider(None)
         except Exception as e:
             errorMsg = "Failed to construct ConfigurationProvider, which may due to the old wala code with error: %s, stack trace: %s" % (str(e), traceback.format_exc())
             hutil.log(errorMsg)
             Config = None
         cls.__instance.logger = hutil
         if Config != None:
             cls.__instance.proxyHost = Config.get("HttpProxy.Host")
             cls.__instance.proxyPort = Config.get("HttpProxy.Port")
         cls.__instance.tmpFile = './tmp_file_FD76C85E-406F-4CFA-8EB0-CF18B123365C'
     else:
         cls.__instance.logger = hutil
         cls.__instance.logger.log("Returning HttpUtil")
     return cls.__instance