Esempio n. 1
0
 def extract(self):
     file = tarfile.open(self.localPath, 'r:gz')
     logger.debug('Archive opened')
     try:
         file.extractall(os.path.join(os.getcwd(), 'tmp'))
         file.close()
     except:
         logger.error('Extract error.')
         sys.exit()
Esempio n. 2
0
def listFiles(rootDir, hidden):
    returnList = []
    total_size = 0
    fileList = os.listdir(rootDir)
    for file in fileList:
        if file.startswith('.') and hidden==0:
            continue
        itempath = os.path.join(rootDir, file)
        if os.path.isdir(itempath) or os.path.islink(itempath):

            continue
        total_size += os.path.getsize(itempath)
        returnList.append(itempath)

    logger.debug("Total Size: %d" % total_size)
    return total_size, returnList
Esempio n. 3
0
 def list(self):
     widgets = ["Listing directory content... ",
                Bar('>'), ' ', RotatingMarker(), ' ', ReverseBar('<')]
     pbar = ProgressBar(widgets=widgets, maxval=100).start()
     pbar.update(0)
     time.sleep(0.5)
     if self.recursive:
         logger.debug("Listing directory content recursively...")
         pbar.update(20)
         time.sleep(1)
         self.total_size, self.fileList = util.recursiveListFiles(self.dir, self.hidden)
     else:
         logger.debug("Listing directory content...")
         pbar.update(20)
         time.sleep(1)
         self.total_size, self.fileList = util.listFiles(self.dir, self.hidden)
     pbar.update(100)
     pbar.finish()
     logger.debug("Supported File Types: " + repr(doctype.__all__))
     logger.info("Size of directory - %d" % self.total_size)
Esempio n. 4
0
    try:
        results = parser.parse_args(args=sys.argv[1:])
        ########## PREP ##########
        if results.info:
            logger.level = 1
        elif results.debug:
            logger.level = 2

    except IOError, msg:
        parser.error(str(msg))
        logger.error(str(msg))
        return 1

    ########## INIT ##########
    logger.debug(results)
    core.init()


    ########## CONFIG ##########
    if results.which.startswith('config'):
        if results.which == 'config.list':
            conf.listConfig(None)
        if results.which == 'config.write':
            conf.writeConfig(results.key, results.value)
        if results.which == 'config.read':
            print conf.readConfig(results.key)
    ########## UPDATE ##########
    elif results.which == 'update':
        from relo.core.update import ReloUpdater
        curVersion = __version__
Esempio n. 5
0
def curl(url, path):
    command = "curl -L -# -o '%s' '%s'" % (path, url)
    logger.debug(command)
    subprocess.call(command, shell=True)
Esempio n. 6
0
 def load(self):
     logger.debug("Redis auto loads")
Esempio n. 7
0
 def check(self):
     logger.debug("check not needed with redis")
Esempio n. 8
0
 def init(self):
     logger.debug("Connecting to Redis")
     self.connection = redis.StrictRedis(host='localhost', port=6379, db=12)