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
1bc1ac5c
Commit
1bc1ac5c
authored
Jul 22, 2011
by
Lucas Carvalho
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote branch 'origin/master' into signature
parents
ef9bec3c
7d72c8b0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
10 deletions
+7
-10
slapos/libnetworkcache.py
slapos/libnetworkcache.py
+7
-10
No files found.
slapos/libnetworkcache.py
View file @
1bc1ac5c
...
...
@@ -20,6 +20,7 @@ import json
import
os
import
tempfile
import
urllib
import
urllib2
import
urlparse
import
M2Crypto
...
...
@@ -49,7 +50,7 @@ class NetworkcacheClient(object):
return_dict
[
'path'
]
=
parsed_url
.
path
return_dict
[
'host'
]
=
parsed_url
.
hostname
return_dict
[
'port'
]
=
parsed_url
.
port
return_dict
[
'port'
]
=
parsed_url
.
port
or
80
return
return_dict
def
__init__
(
self
,
shacache
,
shadir
,
...
...
@@ -161,17 +162,13 @@ class NetworkcacheClient(object):
if
directory_key
is
not
None
:
path_info
=
os
.
path
.
join
(
self
.
shadir_path
,
directory_key
)
shadir_connection
=
httplib
.
HTTPConnection
(
self
.
shadir_host
,
self
.
shadir_por
t
)
url
=
"http://%s:%s%s"
%
(
self
.
shadir_host
,
self
.
shadir_port
,
path_info
)
request
=
urllib2
.
Request
(
url
=
url
,
data
=
None
,
headers
=
self
.
shadir_header_dic
t
)
try
:
shadir_connection
.
request
(
'GET'
,
path_info
,
headers
=
self
.
shadir_header_dict
)
result
=
shadir_connection
.
getresponse
()
result
=
urllib2
.
urlopen
(
request
)
data
=
result
.
read
()
finally
:
shadir_connection
.
close
()
if
result
.
status
!=
200
:
raise
DirectoryNotFound
(
result
.
read
())
except
urllib2
.
HTTPError
,
error
:
raise
DirectoryNotFound
(
"%s : %s"
%
(
error
.
code
,
error
.
msg
))
# Filtering...
data_list
=
json
.
loads
(
data
)
...
...
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