summaryrefslogtreecommitdiff
path: root/scripts/db_access
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2014-06-05 15:47:14 -0300
committerTomás Touceda <chiiph@leap.se>2014-06-05 15:47:14 -0300
commitee53e05fbff3509a7cdb9bc510c891922f9a8bca (patch)
treea6f2abc279391e5202cbb7860380bb8a1575d79f /scripts/db_access
parent16851aa62858fb1eac1b725f5415a334a093fa51 (diff)
parentbff6444cc2a119a49f5c259644ffc2d6862f779e (diff)
Merge remote-tracking branch 'refs/remotes/drebs/bug/5739_fix-multipart-put-problem-2' into develop
Diffstat (limited to 'scripts/db_access')
-rw-r--r--scripts/db_access/client_side_db.py25
1 files changed, 13 insertions, 12 deletions
diff --git a/scripts/db_access/client_side_db.py b/scripts/db_access/client_side_db.py
index 2bf4ab5e..6c456c41 100644
--- a/scripts/db_access/client_side_db.py
+++ b/scripts/db_access/client_side_db.py
@@ -15,10 +15,14 @@ import srp._pysrp as srp
import binascii
import logging
+
from leap.common.config import get_path_prefix
from leap.soledad.client import Soledad
+from util import ValidateUserHandle
+
+
# create a logger
logger = logging.getLogger(__name__)
LOG_FORMAT = '%(asctime)s %(message)s'
@@ -122,26 +126,23 @@ def get_soledad_instance(username, provider, passphrase, basedir):
if __name__ == '__main__':
- class ValidateUserHandle(argparse.Action):
- def __call__(self, parser, namespace, values, option_string=None):
- m = re.compile('^([^@]+)@([^@]+\.[^@]+)$')
- res = m.match(values)
- if res == None:
- parser.error('User handle should have the form user@provider.')
- setattr(namespace, 'username', res.groups()[0])
- setattr(namespace, 'provider', res.groups()[1])
-
# parse command line
parser = argparse.ArgumentParser()
parser.add_argument(
'user@provider', action=ValidateUserHandle, help='the user handle')
parser.add_argument(
- '-b', dest='basedir', required=False, default=None, help='the user handle')
+ '-b', dest='basedir', required=False, default=None,
+ help='soledad base directory')
+ parser.add_argument(
+ '-p', dest='passphrase', required=False, default=None,
+ help='the user passphrase')
args = parser.parse_args()
# get the password
- passphrase = getpass.getpass(
- 'Password for %s@%s: ' % (args.username, args.provider))
+ passphrase = args.passphrase
+ if passphrase is None:
+ passphrase = getpass.getpass(
+ 'Password for %s@%s: ' % (args.username, args.provider))
# get the basedir
basedir = args.basedir