check --ssl-cert and --ssl-key to be files

This commit is contained in:
Matthias Lehmann committed 2014-01-29 15:54:19 +01:00
1 parent 14583a2efa
commit b9d7220b10
2 files changed
+13

No files matched your search

+10
View File
@@ -1,4 +1,5 @@
from __future__ import division
import argparse
def humanize_bytes(n, precision=2):
@@ -44,3 +45,12 @@ def humanize_bytes(n, precision=2):
break
return '%.*f %s' % (precision, n / factor, suffix)
def existing_file(filename):
try:
open(filename, 'rb')
except IOError as ex:
raise argparse.ArgumentTypeError(
'%s: %s' % (filename, ex.args[1]))
return filename