Permalink
Browse files

Added authentication/configuration testing

Added --test option to test parsing and authenticating
Resolves #4
  • Loading branch information...
1 parent 02f5914 commit 699ecfe6e9bbc40df081bd0023c8a85d3a552d16 Kevin Landreth committed Nov 2, 2012
Showing with 15 additions and 0 deletions.
  1. +15 −0 slbackup.py
View
15 slbackup.py
@@ -160,6 +160,18 @@ def __init__(self, options):
logging.info("Excluding: %s", self.excludes)
+ if options.get('test'):
+ try:
+ self.authenticate()
+ except Exception, e:
+ print "Something is wrong: %s" % e
+ else:
+ print "Appears to work!"
+ print "URL:", self.url
+ print "Token:", self.token
+
+ sys.exit(0)
+
def authenticate(self):
use_network = 'private' if self.use_private else 'public'
@@ -635,6 +647,9 @@ def asblocks(_f, buflen=_DEFAULT_OS_BUFLEN):
args.add_option('--example', action="store_true", default=False,
help="Print an example config and exit.")
+ args.add_option('--test', action="store_true", default=False,
+ help="Test authentication settings.")
+
# config file overrides, optional
oargs = optparse.OptionGroup(args, "Configuration parameters",
"These parameters (besides config) can be specified in the"

0 comments on commit 699ecfe

Please sign in to comment.