Commit 735103da authored by Julien Muchembled's avatar Julien Muchembled

upload: make indexing optional

parent 21f52c30
...@@ -366,8 +366,9 @@ def _newArgumentParser(url_help): ...@@ -366,8 +366,9 @@ def _newArgumentParser(url_help):
help='SlapOS configuration file.') help='SlapOS configuration file.')
parser.add_argument('--prefix-key', default='') parser.add_argument('--prefix-key', default='')
parser.add_argument('--suffix-key', default='') parser.add_argument('--suffix-key', default='')
parser.add_argument('--url', required=True, help=url_help parser.add_argument('--url', help=url_help
+ " The key will be concatenation of PREFIX_KEY, md5(URL) and SUFFIX_KEY.") + " The key will be concatenation of PREFIX_KEY, md5(URL) and SUFFIX_KEY."
" If not given, the uploaded data is not indexed.")
return parser return parser
def cmd_upload(*args): def cmd_upload(*args):
...@@ -384,6 +385,11 @@ def cmd_upload(*args): ...@@ -384,6 +385,11 @@ def cmd_upload(*args):
try: try:
if args.file: if args.file:
f = open(args.file, 'rb') f = open(args.file, 'rb')
if not args.url:
nc.upload(f)
return
elif args.url:
parser.error('either --file or --url is required')
elif os.path.isdir(args.url): elif os.path.isdir(args.url):
f = nc.archive(args.url) f = nc.archive(args.url)
else: else:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment