Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.buildout
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
Rafael Monnerat
slapos.buildout
Commits
519543aa
Commit
519543aa
authored
Jun 23, 2011
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix naming.
parent
a306e450
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
src/zc/buildout/networkcache.py
src/zc/buildout/networkcache.py
+7
-7
No files found.
src/zc/buildout/networkcache.py
View file @
519543aa
...
...
@@ -51,7 +51,7 @@ def get_directory_key(url):
return
'slapos-buildout-%s'
%
urlmd5
def
download_network_cached
(
d
ownload_dir_url
,
download_
cache_url
,
path
,
url
,
logger
,
md5sum
=
None
):
def
download_network_cached
(
d
ir_url
,
cache_url
,
path
,
url
,
logger
,
md5sum
=
None
):
"""Downloads from a network cache provider
If something fail (providor be offline, or hash_string fail), we ignore
...
...
@@ -62,7 +62,7 @@ def download_network_cached(download_dir_url, download_cache_url, path, url, log
if
not
LIBNETWORKCACHE_ENABLED
:
return
False
if
download_
cache_url
in
(
None
,
''
,):
if
cache_url
in
(
None
,
''
,):
# Not able to use network cache
return
False
if
md5sum
is
None
:
...
...
@@ -74,7 +74,7 @@ def download_network_cached(download_dir_url, download_cache_url, path, url, log
logger
.
info
(
'Downloading %s from network cache.'
%
file_name
)
try
:
nc
=
NetworkcacheClient
(
shacache
=
download_cache_url
,
shadir
=
download_
dir_url
)
nc
=
NetworkcacheClient
(
shacache
=
cache_url
,
shadir
=
dir_url
)
file_content
=
nc
.
select
(
directory_key
)
f
=
open
(
path
,
'w+b'
)
...
...
@@ -95,12 +95,12 @@ def download_network_cached(download_dir_url, download_cache_url, path, url, log
return
True
def
upload_network_cached
(
download_cache_url
,
download_
dir_url
,
external_url
,
path
,
logger
):
def
upload_network_cached
(
cache_url
,
dir_url
,
external_url
,
path
,
logger
):
"""Upload file to a network cache server"""
if
not
LIBNETWORKCACHE_ENABLED
:
return
False
if
download_cache_url
in
[
None
,
''
]
or
download_
dir_url
in
[
None
,
''
]:
if
cache_url
in
[
None
,
''
]
or
dir_url
in
[
None
,
''
]:
logger
.
debug
(
'Upload cache ignored, shacache or shadir was not provided!'
)
return
False
...
...
@@ -112,8 +112,8 @@ def upload_network_cached(download_cache_url, download_dir_url, external_url, pa
f
=
open
(
path
,
'r'
)
try
:
nc
=
NetworkcacheClient
(
shacache
=
download_
cache_url
,
shadir
=
d
ownload_d
ir_url
)
nc
=
NetworkcacheClient
(
shacache
=
cache_url
,
shadir
=
dir_url
)
data
=
nc
.
upload
(
f
,
directory_key
,
**
kw
)
except
(
IOError
,
UploadError
),
e
:
logger
.
info
(
'Fail to upload file. %s'
%
\
...
...
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