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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Douglas
slapos.libnetworkcache
Commits
e3b11012
Commit
e3b11012
authored
Aug 23, 2011
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Follow the shadir spec.
Key is given by the library user. It has no internal meaning.
parent
08df4c6e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
slapos/libnetworkcache.py
slapos/libnetworkcache.py
+5
-5
No files found.
slapos/libnetworkcache.py
View file @
e3b11012
...
...
@@ -80,7 +80,7 @@ class NetworkcacheClient(object):
self
.
signature_certificate_url_list
.
append
(
value
)
def
upload
(
self
,
file_descriptor
,
urlmd5
=
None
,
file_name
=
None
,
valid_until
=
None
,
architecture
=
None
):
valid_until
=
None
,
architecture
=
None
,
key
=
None
):
''' Upload the file to the server.
If urlmd5 is None it must only upload to SHACACHE.
Otherwise, it must create a new entry on SHADIR.
...
...
@@ -111,9 +111,9 @@ class NetworkcacheClient(object):
'URL: %s. Response code: %s. Response data: %s'
%
\
(
self
.
shacache_host
,
result
.
status
,
data
))
if
urlmd5
is
not
None
:
if
key
is
not
None
:
if
file_name
is
None
:
raise
ValueError
(
'In case if
urlmd5
is given file_name is required.'
)
raise
ValueError
(
'In case if
key
is given file_name is required.'
)
kw
=
dict
()
kw
[
'file'
]
=
file_name
kw
[
'urlmd5'
]
=
urlmd5
...
...
@@ -130,8 +130,8 @@ class NetworkcacheClient(object):
shadir_connection
=
httplib
.
HTTPConnection
(
self
.
shadir_host
,
self
.
shadir_port
)
try
:
shadir_connection
.
request
(
'P
OST'
,
self
.
shadir_path
,
json
.
dumps
(
data
),
self
.
shadir_header_dict
)
shadir_connection
.
request
(
'P
UT'
,
'/'
.
join
([
self
.
shadir_path
,
key
]
),
json
.
dumps
(
data
),
self
.
shadir_header_dict
)
result
=
shadir_connection
.
getresponse
()
data
=
result
.
read
()
finally
:
...
...
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