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
Jérome Perrin
slapos.buildout
Commits
57345f87
Commit
57345f87
authored
Aug 19, 2011
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reimplement tests.
Use simple download recipe instead of relying on egg downloading.
parent
e8187176
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
211 additions
and
203 deletions
+211
-203
src/zc/buildout/networkcache.txt
src/zc/buildout/networkcache.txt
+211
-203
No files found.
src/zc/buildout/networkcache.txt
View file @
57345f87
...
@@ -45,6 +45,11 @@ Now let's prepare networkcache server:
...
@@ -45,6 +45,11 @@ Now let's prepare networkcache server:
>>> nc_data = tmpdir('nc_data')
>>> nc_data = tmpdir('nc_data')
>>> nc_url = start_nc(nc_data)
>>> nc_url = start_nc(nc_data)
And remote server:
>>> remote_server_data = tmpdir('remote_server_data')
>>> remote_server_url = start_server(remote_server_data)
Networkcache in buildout is optional, and during normal run no information
Networkcache in buildout is optional, and during normal run no information
is shown:
is shown:
...
@@ -55,19 +60,57 @@ is shown:
...
@@ -55,19 +60,57 @@ is shown:
... ''')
... ''')
>>> print system(buildout)
>>> print system(buildout)
But whenever networkcache configuration is enabled, it is possible to use it:
For some tests simple download recipe will be needed:
>>> mkdir(sample_buildout, 'download')
>>> write(sample_buildout, 'download', 'download.py',
... """
... import logging, os, zc.buildout
...
... class Download:
...
... def __init__(self, buildout, name, options):
... self.name, self.options, self.buildout = name, options, buildout
...
... def install(self):
... download = zc.buildout.download.Download(
... self.buildout['buildout'])
... path, is_temp = download(self.options['url'],
... md5sum=self.options.get('md5sum'))
... logging.getLogger(self.name).info(
... 'Downloaded %s', self.options['url'])
... return []
...
... update = install
... """)
>>> write(sample_buildout, 'download', 'setup.py',
... """
... from setuptools import setup
...
... setup(
... name = "download",
... entry_points = {'zc.buildout': ['default = download:Download']},
... )
... """)
>>> write(sample_buildout, 'download', 'README.txt', " ")
Let's create file on remote server:
>>> write(remote_server_data, 'hello.txt', 'Hello my friend')
It will be downloaded and stored into networkcache:
>>> write(sample_buildout, 'buildout.cfg',
>>> write(sample_buildout, 'buildout.cfg',
... '''
... '''
... [buildout]
... [buildout]
...
...
... networkcache-section = networkcache
... networkcache-section = networkcache
...
find-links = %(link_server)s
...
develop = download
... parts =
eggs
... parts =
download
...
...
... [
eggs
]
... [
download
]
... recipe =
zc.recipe.egg:eggs
... recipe =
download
...
eggs = demoneeded ==1.2c1
...
url = %(remote_server_url)shello.txt
...
...
... [networkcache]
... [networkcache]
... download-cache-url = %(nc_url)sshacache
... download-cache-url = %(nc_url)sshacache
...
@@ -79,39 +122,30 @@ But whenever networkcache configuration is enabled, it is possible to use it:
...
@@ -79,39 +122,30 @@ But whenever networkcache configuration is enabled, it is possible to use it:
Networkcache enabled.
Networkcache enabled.
Networkcache download cache: 'http://localhost/shacache', directory 'http://localhost/shadir'
Networkcache download cache: 'http://localhost/shacache', directory 'http://localhost/shadir'
Networkcache upload cache: 'http://localhost/shacache', directory 'http://localhost/shadir'
Networkcache upload cache: 'http://localhost/shacache', directory 'http://localhost/shadir'
Installing eggs.
Develop: '/sample-buildout/download'
Getting distribution for 'demoneeded==1.2c1'.
Installing download.
Downloading demoneeded-1.2c1.zip from network cache.
Downloading http://localhost/hello.txt
Failed to download from network cache demoneeded-1.2c1.zip: 404 : File not found
Downloading hello.txt from network cache.
Uploading http://localhost/demoneeded-1.2c1.zip into network cache.
Failed to download from network cache hello.txt: 404 : Not Found
Got demoneeded 1.2c1.
Uploading http://localhost/hello.txt into network cache.
<BLANKLINE>
download: Downloaded http://localhost/hello.txt
Now lets clean up buildout directory:
>>> import os, glob
>>> [remove(q) for q in glob.glob(os.path.join(sample_buildout, 'eggs', 'demoneeded*'))]
[None]
>>> remove('.installed.cfg')
And run it again, data will be downloaded from networkcache:
And run it again, data will be downloaded from networkcache:
>>> print system(buildout)
>>> print system(buildout)
Networkcache enabled.
Networkcache enabled.
Networkcache download cache: 'http://localhost
/shacache', directory 'http://localhost
/shadir'
Networkcache download cache: 'http://localhost
:29630/shacache', directory 'http://localhost:29630
/shadir'
Networkcache upload cache: 'http://localhost
/shacache', directory 'http://localhost
/shadir'
Networkcache upload cache: 'http://localhost
:29630/shacache', directory 'http://localhost:29630
/shadir'
Installing eggs.
Develop: '/tmp/tmpOkGTHmbuildoutSetUp/_TEST_/sample-buildout/download'
Getting distribution for 'demoneeded==1.2c1'
.
Updating download
.
Downloading
demoneeded-1.2c1.zip from network cache.
Downloading
http://localhost:25390/hello.txt
Got demoneeded 1.2c1
.
Downloading hello.txt from network cache
.
<BLANKLINE>
download: Downloaded http://localhost:25390/hello.txt
Now lets clean up buildout directory
:
Lets clean networkcache
:
>>> import os, glob
>>> rmdir(nc_data)
>>> [remove(q) for q in glob.glob(os.path.join(sample_buildout, 'eggs', 'demoneeded*'))]
>>> mkdir(nc_data)
[None]
>>> remove('.installed.cfg')
As one can see, in case if upload is not working, there is no problem with running buildout:
As one can see, in case if upload is not working, there is no problem with running buildout:
...
@@ -120,12 +154,12 @@ As one can see, in case if upload is not working, there is no problem with runni
...
@@ -120,12 +154,12 @@ As one can see, in case if upload is not working, there is no problem with runni
... [buildout]
... [buildout]
...
...
... networkcache-section = networkcache
... networkcache-section = networkcache
...
find-links = %(link_server)s
...
develop = download
... parts =
eggs
... parts =
download
...
...
... [
eggs
]
... [
download
]
... recipe =
zc.recipe.egg:eggs
... recipe =
download
...
eggs = demo
...
url = %(remote_server_url)shello.txt
...
...
... [networkcache]
... [networkcache]
... download-cache-url = %(nc_url)sshacache
... download-cache-url = %(nc_url)sshacache
...
@@ -137,24 +171,19 @@ As one can see, in case if upload is not working, there is no problem with runni
...
@@ -137,24 +171,19 @@ As one can see, in case if upload is not working, there is no problem with runni
Networkcache enabled.
Networkcache enabled.
Networkcache download cache: 'http://localhost/shacache', directory 'http://localhost/shadir'
Networkcache download cache: 'http://localhost/shacache', directory 'http://localhost/shadir'
Networkcache upload cache: 'http://127.0.0.1:1/sshacache', directory 'http://127.0.0.1:1/sshadir'
Networkcache upload cache: 'http://127.0.0.1:1/sshacache', directory 'http://127.0.0.1:1/sshadir'
Installing eggs.
Develop: '/sample-buildout/download'
Getting distribution for 'demo'.
Updating download.
Downloading demo-0.4c1-py2.7.egg from network cache.
Downloading http://localhost/hello.txt
Failed to download from network cache demo-0.4c1-py2.7.egg: 404 : File not found
Downloading hello.txt from network cache.
Uploading http://localhost/demo-0.4c1-py2.7.egg into network cache.
Failed to download from network cache hello.txt: 404 : Not Found
Uploading http://localhost/hello.txt into network cache.
Fail to upload file. [Errno 111] Connection refused
Fail to upload file. [Errno 111] Connection refused
Got demo 0.4c1.
download: Downloaded http://localhost/hello.txt
Getting distribution for 'demoneeded'.
Downloading demoneeded-1.2c1.zip from network cache.
Got demoneeded 1.2c1.
<BLANKLINE>
Now lets clean up buildout directory
:
Lets clean networkcache
:
>>> import os, glob
>>> rmdir(nc_data)
>>> [remove(q) for q in glob.glob(os.path.join(sample_buildout, 'eggs', 'demo*'))]
>>> mkdir(nc_data)
[None, None]
>>> remove('.installed.cfg')
Upload is optional, and then no upload will be tried:
Upload is optional, and then no upload will be tried:
...
@@ -163,12 +192,12 @@ Upload is optional, and then no upload will be tried:
...
@@ -163,12 +192,12 @@ Upload is optional, and then no upload will be tried:
... [buildout]
... [buildout]
...
...
... networkcache-section = networkcache
... networkcache-section = networkcache
...
find-links = %(link_server)s
...
develop = download
... parts =
eggs
... parts =
download
...
...
... [
eggs
]
... [
download
]
... recipe =
zc.recipe.egg:eggs
... recipe =
download
...
eggs = demo
...
url = %(remote_server_url)shello.txt
...
...
... [networkcache]
... [networkcache]
... download-cache-url = %(nc_url)sshacache
... download-cache-url = %(nc_url)sshacache
...
@@ -178,22 +207,12 @@ Upload is optional, and then no upload will be tried:
...
@@ -178,22 +207,12 @@ Upload is optional, and then no upload will be tried:
Networkcache enabled.
Networkcache enabled.
Networkcache download cache: 'http://localhost/shacache', directory 'http://localhost/shadir'
Networkcache download cache: 'http://localhost/shacache', directory 'http://localhost/shadir'
Networkcache upload cache: '', directory ''
Networkcache upload cache: '', directory ''
Installing eggs.
Develop: '/sample-buildout/download'
Getting distribution for 'demo'.
Updating download.
Downloading demo-0.4c1-py2.7.egg from network cache.
Downloading http://localhost/hello.txt
Failed to download from network cache demo-0.4c1-py2.7.egg: 404 : File not found
Downloading hello.txt from network cache.
Got demo 0.4c1.
Failed to download from network cache hello.txt: 404 : Not Found
Getting distribution for 'demoneeded'.
download: Downloaded http://localhost/hello.txt
Downloading demoneeded-1.2c1.zip from network cache.
Got demoneeded 1.2c1.
<BLANKLINE>
Now lets clean up buildout directory:
>>> import os, glob
>>> [remove(q) for q in glob.glob(os.path.join(sample_buildout, 'eggs', 'demo*'))]
[None, None]
>>> remove('.installed.cfg')
In case if download cache is failing, original resources are used:
In case if download cache is failing, original resources are used:
...
@@ -205,12 +224,12 @@ message not perfect error is shown like <urlopen...Connection Refused>)
...
@@ -205,12 +224,12 @@ message not perfect error is shown like <urlopen...Connection Refused>)
... [buildout]
... [buildout]
...
...
... networkcache-section = networkcache
... networkcache-section = networkcache
...
find-links = %(link_server)s
...
develop = download
... parts =
eggs
... parts =
download
...
...
... [
eggs
]
... [
download
]
... recipe =
zc.recipe.egg:eggs
... recipe =
download
...
eggs = demo
...
url = %(remote_server_url)shello.txt
...
...
... [networkcache]
... [networkcache]
... download-cache-url = http://127.0.0.1:1/shacache
... download-cache-url = http://127.0.0.1:1/shacache
...
@@ -222,32 +241,20 @@ message not perfect error is shown like <urlopen...Connection Refused>)
...
@@ -222,32 +241,20 @@ message not perfect error is shown like <urlopen...Connection Refused>)
Networkcache enabled.
Networkcache enabled.
Networkcache download cache: 'http://127.0.0.1:1/shacache', directory 'http://127.0.0.1:1/shadir'
Networkcache download cache: 'http://127.0.0.1:1/shacache', directory 'http://127.0.0.1:1/shadir'
Networkcache upload cache: 'http://127.0.0.1:1/sshacache', directory 'http://127.0.0.1:1/sshadir'
Networkcache upload cache: 'http://127.0.0.1:1/sshacache', directory 'http://127.0.0.1:1/sshadir'
Installing eggs.
Develop: '/sample-buildout/download'
Getting distribution for 'demo'.
Updating download.
Downloading demo-0.4c1-py2.7.egg from network cache.
Downloading http://localhost/hello.txt
Failed to download from network cache demo-0.4c1-py2.7.egg: <urlopen error [Errno 111] Connection refused>
Downloading hello.txt from network cache.
Uploading http://localhost/demo-0.4c1-py2.7.egg into network cache.
Failed to download from network cache hello.txt: <urlopen error [Errno 111] Connection refused>
Uploading http://localhost/hello.txt into network cache.
Fail to upload file. [Errno 111] Connection refused
Fail to upload file. [Errno 111] Connection refused
Got demo 0.4c1.
download: Downloaded http://localhost/hello.txt
Getting distribution for 'demoneeded'.
Downloading demoneeded-1.2c1.zip from network cache.
Failed to download from network cache demoneeded-1.2c1.zip: <urlopen error [Errno 111] Connection refused>
Uploading http://localhost/demoneeded-1.2c1.zip into network cache.
Fail to upload file. [Errno 111] Connection refused
Got demoneeded 1.2c1.
<BLANKLINE>
Now lets clean up buildout directory:
>>> import os, glob
>>> [remove(q) for q in glob.glob(os.path.join(sample_buildout, 'eggs', 'demo*'))]
[None, None]
>>> remove('.installed.cfg')
Creating
the signature files:
Lets create
the signature files:
>>> signature_data = tmpdir('signature_data')
>>> signature_data = tmpdir('signature_data')
>>> keydir = tmpdir('keydir')
>>> keydir = tmpdir('keydir')
>>> import os
>>> public_certificate_path = os.path.join(keydir, 'public.pem')
>>> public_certificate_path = os.path.join(keydir, 'public.pem')
>>> private_key_path = os.path.join(keydir, 'private.pem')
>>> private_key_path = os.path.join(keydir, 'private.pem')
>>> ignored = system(os.path.join(sample_buildout, 'bin', 'generate-signature-key') + ' --signature-certificate-file=' + public_certificate_path + ' --signature-private-key-file=' + private_key_path)
>>> ignored = system(os.path.join(sample_buildout, 'bin', 'generate-signature-key') + ' --signature-certificate-file=' + public_certificate_path + ' --signature-private-key-file=' + private_key_path)
...
@@ -255,59 +262,51 @@ Creating the signature files:
...
@@ -255,59 +262,51 @@ Creating the signature files:
- private.pem
- private.pem
- public.pem
- public.pem
First put not signed file in networkcache:
Enable signature, so it should not download any content which is not trusted :
>>> write(sample_buildout, 'buildout.cfg',
>>> write(sample_buildout, 'buildout.cfg',
... '''
... '''
... [buildout]
... [buildout]
...
...
... networkcache-section = networkcache
... networkcache-section = networkcache
...
find-links = %(link_server)s
...
develop = download
... parts =
eggs
... parts =
download
...
...
... [
eggs
]
... [
download
]
... recipe =
zc.recipe.egg:eggs
... recipe =
download
...
eggs = demoneeded ==1.2c1
...
url = %(remote_server_url)shello.txt
...
...
... [networkcache]
... [networkcache]
... download-cache-url = %(nc_url)sshacache
... download-cache-url = %(nc_url)sshacache
... download-dir-url = %(nc_url)sshadir
... download-dir-url = %(nc_url)sshadir
... upload-cache-url = %(nc_url)sshacache
... upload-cache-url = %(nc_url)sshacache
... upload-dir-url = %(nc_url)sshadir
... upload-dir-url = %(nc_url)sshadir
... signature-private-key-file = %(private_key_path)s
... signature-certificate-file = %(public_certificate_path)s
... ''' % globals())
... ''' % globals())
>>> print system(buildout)
>>> print system(buildout)
Networkcache enabled.
Networkcache enabled.
Networkcache download cache: 'http://localhost/shacache', directory 'http://localhost/shadir'
Networkcache download cache: 'http://localhost/shacache', directory 'http://localhost/shadir'
Networkcache upload cache: 'http://localhost/shacache', directory 'http://localhost/shadir'
Networkcache upload cache: 'http://localhost/shacache', directory 'http://localhost/shadir'
Installing eggs.
Develop: '/sample-buildout/download'
Getting distribution for 'demoneeded==1.2c1'.
Updating download.
Downloading demoneeded-1.2c1.zip from network cache.
Downloading http://localhost/hello.txt
Failed to download from network cache demoneeded-1.2c1.zip: Could not find a trustable entry.
Downloading hello.txt from network cache.
Uploading http://localhost/demoneeded-1.2c1.zip into network cache.
Failed to download from network cache hello.txt: 404 : Not Found
Got demoneeded 1.2c1.
Uploading http://localhost/hello.txt into network cache.
<BLANKLINE>
download: Downloaded http://localhost/hello.txt
Now lets clean up buildout directory:
>>> import os, glob
Now enable signature, so it should not download any content which is not trusted :
>>> [remove(q) for q in glob.glob(os.path.join(sample_buildout, 'eggs', 'demo*'))]
[None]
>>> remove('.installed.cfg')
Once it has a trusted content available into the server it should be abled to download it:
>>> write(sample_buildout, 'buildout.cfg',
>>> write(sample_buildout, 'buildout.cfg',
... '''
... '''
... [buildout]
... [buildout]
...
...
... networkcache-section = networkcache
... networkcache-section = networkcache
...
find-links = %(link_server)s
...
develop = download
... parts =
eggs
... parts =
download
...
...
... [
eggs
]
... [
download
]
... recipe =
zc.recipe.egg:eggs
... recipe =
download
...
eggs = demoneeded ==1.2c1
...
url = %(remote_server_url)shello.txt
...
...
... [networkcache]
... [networkcache]
... download-cache-url = %(nc_url)sshacache
... download-cache-url = %(nc_url)sshacache
...
@@ -321,20 +320,29 @@ Once it has a trusted content available into the server it should be abled to do
...
@@ -321,20 +320,29 @@ Once it has a trusted content available into the server it should be abled to do
Networkcache enabled.
Networkcache enabled.
Networkcache download cache: 'http://localhost/shacache', directory 'http://localhost/shadir'
Networkcache download cache: 'http://localhost/shacache', directory 'http://localhost/shadir'
Networkcache upload cache: 'http://localhost/shacache', directory 'http://localhost/shadir'
Networkcache upload cache: 'http://localhost/shacache', directory 'http://localhost/shadir'
Installing eggs.
Develop: '/sample-buildout/download'
Getting distribution for 'demoneeded==1.2c1'.
Updating download.
Downloading demoneeded-1.2c1.zip from network cache.
Downloading http://localhost/hello.txt
Got demoneeded 1.2c1.
Downloading hello.txt from network cache.
<BLANKLINE>
Failed to download from network cache hello.txt: Could not find a trustable entry.
Uploading http://localhost/hello.txt into network cache.
download: Downloaded http://localhost/hello.txt
Once it has a trusted content available into the server it should be abled to download it:
Now lets clean up buildout directory:
>>> print system(buildout)
Networkcache enabled.
Networkcache download cache: 'http://localhost:26283/shacache', directory 'http://localhost:26283/shadir'
Networkcache upload cache: 'http://localhost:26283/shacache', directory 'http://localhost:26283/shadir'
Develop: '/tmp/tmpO55kN1buildoutSetUp/_TEST_/sample-buildout/download'
Updating download.
Downloading http://localhost:22168/hello.txt
Downloading hello.txt from network cache.
download: Downloaded http://localhost:22168/hello.txt
>>> import os, glob
>>> [remove(q) for q in glob.glob(os.path.join(sample_buildout, 'eggs', 'demo*'))]
[None]
>>> remove('.installed.cfg')
Now lets create new signature files:
Now lets create new signature files:
>>> new_keydir = tmpdir('newkeydir')
>>> new_keydir = tmpdir('newkeydir')
>>> new_public_certificate_path = os.path.join(new_keydir, 'public2.pem')
>>> new_public_certificate_path = os.path.join(new_keydir, 'public2.pem')
>>> new_private_key_path = os.path.join(new_keydir, 'private2.pem')
>>> new_private_key_path = os.path.join(new_keydir, 'private2.pem')
...
@@ -344,148 +352,147 @@ Now lets create new signature files:
...
@@ -344,148 +352,147 @@ Now lets create new signature files:
- public2.pem
- public2.pem
There is a new certificate file, so it should not download the old content:
There is a new certificate file, so it should not download the old content:
>>> write(sample_buildout, 'buildout.cfg',
>>> write(sample_buildout, 'buildout.cfg',
... '''
... '''
... [buildout]
... [buildout]
...
...
... networkcache-section = networkcache
... networkcache-section = networkcache
...
find-links = %(link_server)s
...
develop = download
... parts =
eggs
... parts =
download
...
...
... [
eggs
]
... [
download
]
... recipe =
zc.recipe.egg:eggs
... recipe =
download
...
eggs = demoneeded ==1.2c1
...
url = %(remote_server_url)shello.txt
...
...
... [networkcache]
... [networkcache]
... download-cache-url = %(nc_url)sshacache
... download-cache-url = %(nc_url)sshacache
... download-dir-url = %(nc_url)sshadir
... download-dir-url = %(nc_url)sshadir
... signature-private-key-file = %(new_private_key_path)s
... signature-certificate-file = %(new_public_certificate_path)s
... signature-certificate-file = %(new_public_certificate_path)s
... ''' % globals())
... ''' % globals())
>>> print system(buildout)
>>> print system(buildout)
Networkcache enabled.
Networkcache enabled.
Networkcache download cache: 'http://localhost/shacache', directory 'http://localhost/shadir'
Networkcache download cache: 'http://localhost/shacache', directory 'http://localhost/shadir'
Networkcache upload cache: '', directory ''
Networkcache upload cache: '', directory ''
Installing eggs.
Develop: '/sample-buildout/download'
Getting distribution for 'demoneeded==1.2c1'.
Updating download.
Downloading demoneeded-1.2c1.zip from network cache.
Downloading http://localhost/hello.txt
Failed to download from network cache demoneeded-1.2c1.zip: Could not find a trustable entry.
Downloading hello.txt from network cache.
Got demoneeded 1.2c1.
Failed to download from network cache hello.txt: Could not find a trustable entry.
<BLANKLINE>
download: Downloaded http://localhost/hello.txt
Now lets clean up buildout directory:
>>> import os, glob
>>> [remove(q) for q in glob.glob(os.path.join(sample_buildout, 'eggs', 'demo*'))]
[None]
>>> remove('.installed.cfg')
If it can not find a trustable entry into server, it should upload the files using new signature:
If it can not find a trustable entry into server, it should upload the files using new signature:
>>> write(sample_buildout, 'buildout.cfg',
>>> write(sample_buildout, 'buildout.cfg',
... '''
... '''
... [buildout]
... [buildout]
...
...
... networkcache-section = networkcache
... networkcache-section = networkcache
...
find-links = %(link_server)s
...
develop = download
... parts =
eggs
... parts =
download
...
...
... [
eggs
]
... [
download
]
... recipe =
zc.recipe.egg:eggs
... recipe =
download
...
eggs = demoneeded ==1.2c1
...
url = %(remote_server_url)shello.txt
...
...
... [networkcache]
... [networkcache]
... download-cache-url = %(nc_url)sshacache
... download-cache-url = %(nc_url)sshacache
... download-dir-url = %(nc_url)sshadir
... download-dir-url = %(nc_url)sshadir
... upload-cache-url = %(nc_url)sshacache
... upload-dir-url = %(nc_url)sshadir
... signature-private-key-file = %(new_private_key_path)s
... signature-private-key-file = %(new_private_key_path)s
... signature-certificate-file = %(new_public_certificate_path)s
... signature-certificate-file = %(new_public_certificate_path)s
... upload-cache-url = %(nc_url)sshacache
... upload-dir-url = %(nc_url)sshadir
... ''' % globals())
... ''' % globals())
>>> print system(buildout)
>>> print system(buildout)
Networkcache enabled.
Networkcache enabled.
Networkcache download cache: 'http://localhost/shacache', directory 'http://localhost/shadir'
Networkcache download cache: 'http://localhost/shacache', directory 'http://localhost/shadir'
Networkcache upload cache: 'http://localhost/shacache', directory 'http://localhost/shadir'
Networkcache upload cache: 'http://localhost/shacache', directory 'http://localhost/shadir'
Installing eggs.
Develop: '/sample-buildout/download'
Getting distribution for 'demoneeded==1.2c1'.
Updating download.
Downloading demoneeded-1.2c1.zip from network cache.
Downloading http://localhost/hello.txt
Failed to download from network cache demoneeded-1.2c1.zip: Could not find a trustable entry.
Downloading hello.txt from network cache.
Uploading http://localhost/demoneeded-1.2c1.zip into network cache.
Failed to download from network cache hello.txt: Could not find a trustable entry.
Got demoneeded 1.2c1.
Uploading http://localhost/hello.txt into network cache.
<BLANKLINE>
download: Downloaded http://localhost/hello.txt
Now lets clean up buildout directory:
>>> import os, glob
>>> [remove(q) for q in glob.glob(os.path.join(sample_buildout, 'eggs', 'demo*'))]
[None]
>>> remove('.installed.cfg')
Buildout can download the content using the old certificatei, because it still available in the cache server:
Buildout can download the content using the old certificatei, because it still available in the cache server:
>>> write(sample_buildout, 'buildout.cfg',
>>> write(sample_buildout, 'buildout.cfg',
... '''
... '''
... [buildout]
... [buildout]
...
...
... networkcache-section = networkcache
... networkcache-section = networkcache
...
find-links = %(link_server)s
...
develop = download
... parts =
eggs
... parts =
download
...
...
... [
eggs
]
... [
download
]
... recipe =
zc.recipe.egg:eggs
... recipe =
download
...
eggs = demoneeded ==1.2c1
...
url = %(remote_server_url)shello.txt
...
...
... [networkcache]
... [networkcache]
... download-cache-url = %(nc_url)sshacache
... download-cache-url = %(nc_url)sshacache
... download-dir-url = %(nc_url)sshadir
... download-dir-url = %(nc_url)sshadir
... signature-private-key-file = %(private_key_path)s
... signature-certificate-file = %(public_certificate_path)s
... signature-certificate-file = %(public_certificate_path)s
... upload-cache-url = %(nc_url)sshacache
... upload-dir-url = %(nc_url)sshadir
... ''' % globals())
... ''' % globals())
>>> print system(buildout)
>>> print system(buildout)
Networkcache enabled.
Networkcache enabled.
Networkcache download cache: 'http://localhost/shacache', directory 'http://localhost/shadir'
Networkcache download cache: 'http://localhost/shacache', directory 'http://localhost/shadir'
Networkcache upload cache: '', directory ''
Networkcache upload cache: 'http://localhost/shacache', directory 'http://localhost/shadir'
Installing eggs.
Develop: '/sample-buildout/download'
Getting distribution for 'demoneeded==1.2c1'.
Updating download.
Downloading demoneeded-1.2c1.zip from network cache.
Downloading http://localhost/hello.txt
Got demoneeded 1.2c1.
Downloading hello.txt from network cache.
<BLANKLINE>
download: Downloaded http://localhost/hello.txt
Now lets clean up buildout directory:
>>> import os, glob
>>> [remove(q) for q in glob.glob(os.path.join(sample_buildout, 'eggs', 'demo*'))]
[None]
>>> remove('.installed.cfg')
Buildout can download the content using the new certificate, because it still available in the cache server:
Buildout can download the content using the new certificate, because it still available in the cache server:
>>> write(sample_buildout, 'buildout.cfg',
>>> write(sample_buildout, 'buildout.cfg',
... '''
... '''
... [buildout]
... [buildout]
...
...
... networkcache-section = networkcache
... networkcache-section = networkcache
...
find-links = %(link_server)s
...
develop = download
... parts =
eggs
... parts =
download
...
...
... [
eggs
]
... [
download
]
... recipe =
zc.recipe.egg:eggs
... recipe =
download
...
eggs = demoneeded ==1.2c1
...
url = %(remote_server_url)shello.txt
...
...
... [networkcache]
... [networkcache]
... download-cache-url = %(nc_url)sshacache
... download-cache-url = %(nc_url)sshacache
... download-dir-url = %(nc_url)sshadir
... download-dir-url = %(nc_url)sshadir
... signature-certificate-file = %(new_public_certificate_path)s
... signature-private-key-file = %(private_key_path)s
... signature-certificate-file = %(public_certificate_path)s
... upload-cache-url = %(nc_url)sshacache
... upload-dir-url = %(nc_url)sshadir
... ''' % globals())
... ''' % globals())
>>> print system(buildout)
>>> print system(buildout)
Networkcache enabled.
Networkcache enabled.
Networkcache download cache: 'http://localhost/shacache', directory 'http://localhost/shadir'
Networkcache download cache: 'http://localhost/shacache', directory 'http://localhost/shadir'
Networkcache upload cache: '', directory ''
Networkcache upload cache: 'http://localhost/shacache', directory 'http://localhost/shadir'
Installing eggs.
Develop: '/sample-buildout/download'
Getting distribution for 'demoneeded==1.2c1'.
Updating download.
Downloading demoneeded-1.2c1.zip from network cache.
Downloading http://localhost/hello.txt
Got demoneeded 1.2c1.
Downloading hello.txt from network cache.
<BLANKLINE>
download: Downloaded http://localhost/hello.txt
Todo:
* downloading eggs
* downloading extensions?
* showing that wrong md5sum will fail to upload
###############
###############
# PARSING URL #
# PARSING URL #
###############
###############
Check if the parsing url method works correctly, in low-level:
Check if the parsing url method works correctly, in low-level:
>>> get_filename_from_url("http://localhost/lib/patch/?id=700c7d5382b01f94e7141")
>>> get_filename_from_url("http://localhost/lib/patch/?id=700c7d5382b01f94e7141")
'id=700c7d5382b01f94e7141'
'id=700c7d5382b01f94e7141'
>>> get_filename_from_url("http://localhost/tarball-5.1.tar.gz?id=700")
>>> get_filename_from_url("http://localhost/tarball-5.1.tar.gz?id=700")
...
@@ -495,6 +502,7 @@ Check if the parsing url method works correctly, in low-level:
...
@@ -495,6 +502,7 @@ Check if the parsing url method works correctly, in low-level:
Check if the networkcache upload method is using the correct method to
Check if the networkcache upload method is using the correct method to
parse the original url and get the file name:
parse the original url and get the file name:
>>> tmp_dir = tmpdir('tmp_dir')
>>> tmp_dir = tmpdir('tmp_dir')
>>> write(tmp_dir, 'tmp_file', 'Content of temp file.')
>>> write(tmp_dir, 'tmp_file', 'Content of temp file.')
>>> get_filename_from_upload_network_cached(
>>> get_filename_from_upload_network_cached(
...
...
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