Esempio n. 1
0
    def __init__(self, name, argv):
        parser = OptionParser('%%prog %s [options] %s' % (name, self.syntax))
        parser.add_option('--url',
                          dest='url',
                          metavar='URL',
                          default=get_url(),
                          help='server URL (currently: %s)' % get_url())
        parser.add_option('--user',
                          dest='user',
                          metavar='USER',
                          default=get_user(),
                          help='account USER (currently: %s)' % get_user())
        parser.add_option('--token',
                          dest='token',
                          metavar='TOKEN',
                          default=get_auth(),
                          help='account TOKEN (currently: %s)' % get_auth())
        parser.add_option('-v',
                          action='store_true',
                          dest='verbose',
                          default=False,
                          help='verbose output')
        parser.add_option('-d',
                          action='store_true',
                          dest='debug',
                          default=False,
                          help='debug output')
        self.add_options(parser)
        options, args = parser.parse_args(argv)

        # Add options to self
        for opt in parser.option_list:
            key = opt.dest
            if key:
                val = getattr(options, key)
                setattr(self, key, val)

        if email_re.match(self.user):
            try:
                from snf_django.lib.astakos import get_user_uuid
                from pithos.api.settings import SERVICE_TOKEN
                self.user = get_user_uuid(SERVICE_TOKEN, self.user)
            except ImportError:
                pass
        self.client = Pithos_Client(self.url, self.token, self.user,
                                    self.verbose, self.debug)

        self.parser = parser
        self.args = args
Esempio n. 2
0
    def __init__(self, name, argv):
        parser = OptionParser('%%prog %s [options] %s' % (name, self.syntax))
        parser.add_option('--url', dest='url', metavar='URL',
                          default=get_url(), help='server URL (currently: %s)' % get_url())
        parser.add_option('--user', dest='user', metavar='USER',
                          default=get_user(),
                          help='account USER (currently: %s)' % get_user())
        parser.add_option('--token', dest='token', metavar='TOKEN',
                          default=get_auth(),
                          help='account TOKEN (currently: %s)' % get_auth())
        parser.add_option('-v', action='store_true', dest='verbose',
                          default=False, help='verbose output')
        parser.add_option('-d', action='store_true', dest='debug',
                          default=False, help='debug output')
        self.add_options(parser)
        options, args = parser.parse_args(argv)

        # Add options to self
        for opt in parser.option_list:
            key = opt.dest
            if key:
                val = getattr(options, key)
                setattr(self, key, val)

        if email_re.match(self.user):
            try:
                from snf_django.lib.astakos import get_user_uuid
                from pithos.api.settings import SERVICE_TOKEN
                self.user = get_user_uuid(SERVICE_TOKEN, self.user)
            except ImportError:
                pass
        self.client = Pithos_Client(
            self.url, self.token, self.user, self.verbose,
            self.debug)

        self.parser = parser
        self.args = args
Esempio n. 3
0
 def __init__(self, verbose=False):
     self.verbose = verbose
     self.client = OOS_Client(get_url(), get_auth(), get_user())
Esempio n. 4
0
from pithos.tools.lib.client import Pithos_Client, Fault
from pithos.tools.lib.hashmap import merkle
from pithos.tools.lib.util import get_user, get_auth, get_url


DEFAULT_CONTAINER = 'pithos'
SETTINGS_DIR = expanduser('~/.pithos')
TRASH_DIR = '.pithos_trash'

SQL_CREATE_FILES_TABLE = '''CREATE TABLE IF NOT EXISTS files (
                                path TEXT PRIMARY KEY,
                                hash TEXT,
                                timestamp INTEGER)'''


client = Pithos_Client(get_url(), get_auth(), get_user())


def _makedirs(path):
    try:
        os.makedirs(path)
    except OSError:
        pass


class State(object):
    def __init__(self, syncdir, container):
        self.syncdir = syncdir
        self.container = container
        self.trashdir = join(syncdir, TRASH_DIR)
        self.deleted_dirs = set()
Esempio n. 5
0
 def __init__(self, verbose=False):
     self.verbose = verbose
     self.client = OOS_Client(get_url(), get_auth(), get_user())
Esempio n. 6
0
from pithos.tools.lib.client import Pithos_Client, Fault
from pithos.tools.lib.hashmap import merkle
from pithos.tools.lib.util import get_user, get_auth, get_url


DEFAULT_CONTAINER = 'pithos'
SETTINGS_DIR = expanduser('~/.pithos')
TRASH_DIR = '.pithos_trash'

SQL_CREATE_FILES_TABLE = '''CREATE TABLE IF NOT EXISTS files (
                                path TEXT PRIMARY KEY,
                                hash TEXT,
                                timestamp INTEGER)'''


client = Pithos_Client(get_url(), get_auth(), get_user())


def _makedirs(path):
    try:
        os.makedirs(path)
    except OSError:
        pass


class State(object):
    def __init__(self, syncdir, container):
        self.syncdir = syncdir
        self.container = container
        self.trashdir = join(syncdir, TRASH_DIR)
        self.deleted_dirs = set()