Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.libnetworkcache
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
slapos.libnetworkcache
Commits
abaa96e2
Commit
abaa96e2
authored
Mar 29, 2022
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
download,upload: fix --url help
parent
26e67ce8
Pipeline
#20436
failed with stage
in 0 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
slapos/libnetworkcache.py
slapos/libnetworkcache.py
+8
-7
No files found.
slapos/libnetworkcache.py
View file @
abaa96e2
...
@@ -479,6 +479,8 @@ class NetworkcacheException(Exception):
...
@@ -479,6 +479,8 @@ class NetworkcacheException(Exception):
DirectoryNotFound
=
UploadError
=
NetworkcacheException
# BBB
DirectoryNotFound
=
UploadError
=
NetworkcacheException
# BBB
key_help
=
\
" The key will be concatenation of PREFIX_KEY, md5(URL) and SUFFIX_KEY."
def
_newArgumentParser
(
url_help
):
def
_newArgumentParser
(
url_help
):
parser
=
argparse
.
ArgumentParser
()
parser
=
argparse
.
ArgumentParser
()
...
@@ -486,15 +488,14 @@ def _newArgumentParser(url_help):
...
@@ -486,15 +488,14 @@ 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'
,
help
=
url_help
parser
.
add_argument
(
'--url'
,
help
=
url_help
)
+
" 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
):
parser
=
_newArgumentParser
(
"Upload data pointed to by this argument,"
parser
=
_newArgumentParser
(
" unless --file is specified. If argument is not a local path, contents"
"Upload data pointed to by this argument, unless --file is specified."
" is first downloaded in a temporary file."
)
" Non-local contents is first downloaded to a temporary file."
"%s If not given, the uploaded data is not indexed."
%
key_help
)
parser
.
add_argument
(
'--file'
,
parser
.
add_argument
(
'--file'
,
help
=
"Upload the contents of this file, overriding --url"
)
help
=
"Upload the contents of this file, overriding --url"
)
parser
.
add_argument
(
'meta'
,
nargs
=
'*'
,
metavar
=
'KEY=VALUE'
,
parser
.
add_argument
(
'meta'
,
nargs
=
'*'
,
metavar
=
'KEY=VALUE'
,
...
@@ -520,7 +521,7 @@ def cmd_upload(*args):
...
@@ -520,7 +521,7 @@ def cmd_upload(*args):
f
is
None
or
f
.
close
()
f
is
None
or
f
.
close
()
def
cmd_download
(
*
args
):
def
cmd_download
(
*
args
):
parser
=
_newArgumentParser
(
"URL of data to download."
)
parser
=
_newArgumentParser
(
"URL of data to download."
+
key_help
)
args
=
parser
.
parse_args
(
args
or
sys
.
argv
[
1
:])
args
=
parser
.
parse_args
(
args
or
sys
.
argv
[
1
:])
nc
=
NetworkcacheClient
(
args
.
config
)
nc
=
NetworkcacheClient
(
args
.
config
)
urlmd5
=
hashlib
.
md5
(
args
.
url
.
encode
()).
hexdigest
()
urlmd5
=
hashlib
.
md5
(
args
.
url
.
encode
()).
hexdigest
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment