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
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Ophélie Gagnard
slapos.libnetworkcache
Commits
c9337a3b
Commit
c9337a3b
authored
Nov 22, 2022
by
Ophélie Gagnard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add metadata selection when downloading.
parent
ef844adb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
slapos/libnetworkcache.py
slapos/libnetworkcache.py
+4
-1
No files found.
slapos/libnetworkcache.py
View file @
c9337a3b
...
...
@@ -522,10 +522,13 @@ def cmd_upload(*args):
def
cmd_download
(
*
args
):
parser
=
_newArgumentParser
(
"URL of data to download."
+
key_help
)
parser
.
add_argument
(
'meta'
,
nargs
=
'*'
,
metavar
=
'KEY=VALUE'
,
help
=
"Extra metadata."
)
args
=
parser
.
parse_args
(
args
or
sys
.
argv
[
1
:])
nc
=
NetworkcacheClient
(
args
.
config
)
kw
=
dict
(
x
.
split
(
'='
,
1
)
for
x
in
args
.
meta
)
urlmd5
=
hashlib
.
md5
(
args
.
url
.
encode
()).
hexdigest
()
key
=
args
.
prefix_key
+
urlmd5
+
args
.
suffix_key
f
=
sys
.
stdout
shutil
.
copyfileobj
(
nc
.
download
(
next
(
nc
.
select
(
key
))[
'sha512'
]),
shutil
.
copyfileobj
(
nc
.
download
(
next
(
nc
.
select
(
key
,
kw
))[
'sha512'
]),
getattr
(
f
,
'buffer'
,
f
))
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