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
0171f96c
Commit
0171f96c
authored
Aug 22, 2011
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Selects requires urlmd5.
parent
feb25cda
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
6 deletions
+4
-6
slapos/libnetworkcache.py
slapos/libnetworkcache.py
+4
-6
No files found.
slapos/libnetworkcache.py
View file @
0171f96c
...
@@ -153,13 +153,11 @@ class NetworkcacheClient(object):
...
@@ -153,13 +153,11 @@ class NetworkcacheClient(object):
file_descriptor
.
seek
(
0
)
file_descriptor
.
seek
(
0
)
return
file_descriptor
return
file_descriptor
def
select
(
self
,
directory_key
=
None
):
def
select
(
self
,
urlmd5
):
''' Download a file from shacache by selecting the entry in shadir
''' Download a file from shacache by selecting the entry in shadir
Raise DirectoryNotFound if multiple files are found.
Raise DirectoryNotFound if multiple files are found.
'''
'''
path_info
=
self
.
shadir_path
path_info
=
os
.
path
.
join
(
self
.
shadir_path
,
urlmd5
)
if
directory_key
is
not
None
:
path_info
=
os
.
path
.
join
(
self
.
shadir_path
,
directory_key
)
url
=
"http://%s:%s%s"
%
(
self
.
shadir_host
,
self
.
shadir_port
,
path_info
)
url
=
"http://%s:%s%s"
%
(
self
.
shadir_host
,
self
.
shadir_port
,
path_info
)
request
=
urllib2
.
Request
(
url
=
url
,
data
=
None
,
headers
=
self
.
shadir_header_dict
)
request
=
urllib2
.
Request
(
url
=
url
,
data
=
None
,
headers
=
self
.
shadir_header_dict
)
...
@@ -175,7 +173,7 @@ class NetworkcacheClient(object):
...
@@ -175,7 +173,7 @@ class NetworkcacheClient(object):
(
self
.
signature_certificate_file_list
or
\
(
self
.
signature_certificate_file_list
or
\
self
.
signature_certificate_url_list
):
self
.
signature_certificate_url_list
):
raise
DirectoryNotFound
(
'Too many entries for a given directory. '
\
raise
DirectoryNotFound
(
'Too many entries for a given directory. '
\
'Directory: %s. Entries: %s.'
%
(
directory_key
,
str
(
data_list
)))
'Directory: %s. Entries: %s.'
%
(
urlmd5
,
str
(
data_list
)))
if
self
.
signature_certificate_file_list
or
\
if
self
.
signature_certificate_file_list
or
\
self
.
signature_certificate_url_list
:
self
.
signature_certificate_url_list
:
...
@@ -183,7 +181,7 @@ class NetworkcacheClient(object):
...
@@ -183,7 +181,7 @@ class NetworkcacheClient(object):
data_list
=
filter
(
lambda
x
:
method
(
x
[
1
]),
data_list
)
data_list
=
filter
(
lambda
x
:
method
(
x
[
1
]),
data_list
)
if
len
(
data_list
)
>
1
:
if
len
(
data_list
)
>
1
:
raise
DirectoryNotFound
(
'Too many entries for a given key. '
\
raise
DirectoryNotFound
(
'Too many entries for a given key. '
\
'Directory: %s. Entries: %s.'
%
(
directory_key
,
str
(
data_list
)))
'Directory: %s. Entries: %s.'
%
(
urlmd5
,
str
(
data_list
)))
if
not
data_list
:
if
not
data_list
:
raise
DirectoryNotFound
(
'Could not find a trustable entry.'
)
raise
DirectoryNotFound
(
'Could not find a trustable entry.'
)
...
...
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