Beispiel #1
0
def loadAuth(iPath):
  username, password = '', ''
  try:
    with open(iPath) as f:
      content = yaml.load(f)
      username = base64.decodestring(content[base64.encodestring('username')])
      password = base64.decodestring(content[base64.encodestring('password')])
  except Exception as e:
    # logging e
    logging.debug(e)
  return username, password
Beispiel #2
0
def load(file = buildFilePath, _cache = {}, cacheEnable = True):
  path = os.path.abspath(file)
  if cacheEnable and _cache.get(path):
    return _cache.get(path)
  else:
    try:
      with open(file) as f:
        content = yaml.load(f.read())
        _toAbsolute(content, path)
        return content
    except IOError as e:
      log.warning(e)
      logging.warning('Cant open file ' + path)
      return {}
Beispiel #3
0
  def getFromCfg(self):
    self.cfg = {}
    try:
      with open(self.pathCfg, 'r') as f:
        self.cfg = yaml.load(f)
        path = self.cfg[self.tag]
    except Exception as e:
      print e
      alog.debug(e)
      return False
    
    if os.path.exists(path):
      return path

    return False  
Beispiel #4
0
def default():
  with open(os.path.dirname(__file__)+'/data/build.yaml') as f:
    content = yaml.load(f.read())
    return content