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
Thomas Leymonerie
slapos.buildout
Commits
79064a17
Commit
79064a17
authored
Sep 22, 2011
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Proof that bindings to nc are immutable.
parent
b9795d85
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
152 additions
and
0 deletions
+152
-0
src/zc/buildout/networkcache.txt
src/zc/buildout/networkcache.txt
+152
-0
No files found.
src/zc/buildout/networkcache.txt
View file @
79064a17
...
...
@@ -836,3 +836,155 @@ parse the original url and get the file name:
... path=globals().get('tmp_dir') + '/tmp_file',
... nc_server_path=sample_buildout)
'id=700c7d5382b01f94e7141'
Buildout bindings to networkcache are immune on slapos.libnetworkcache problems.
Lets prepare networkcache with errors:
>>> mkdir(sample_buildout, 'damagednc')
>>> mkdir(sample_buildout, 'damagednc', 'slapos')
>>> write(sample_buildout, 'damagednc', 'slapos', '__init__.py',
... """
... # See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
... try:
... __import__('pkg_resources').declare_namespace(__name__)
... except ImportError:
... from pkgutil import extend_path
... __path__ = extend_path(__path__, __name__)
... """)
>>> write(sample_buildout, 'damagednc', 'slapos', 'libnetworkcache.py',
... """
... += die during import
... """)
>>> write(sample_buildout, 'damagednc', 'setup.py',
... """
... from setuptools import setup, find_packages
...
... setup(
... name = "slapos.libnetworkcache",
... namespace_packages=['slapos'],
... packages=find_packages(),
... install_requires=['setuptools']
... )
... """)
>>> write(sample_buildout, 'damagednc', 'README.txt', " ")
And install it in buildout:
>>> write(sample_buildout, 'buildout.cfg',
... '''
... [buildout]
... parts = networkcache
... develop = damagednc
... # Do not register this buildout run
... installed =
...
... [networkcache]
... recipe = zc.recipe.egg
... eggs =
... slapos.libnetworkcache
... zc.buildout
... ''')
>>> print system(buildout)
Develop: '/sample-buildout/damagednc'
Installing networkcache.
Generated script '/sample-buildout/bin/buildout'.
So lets use such damaged networkcache:
>>> write(sample_buildout, 'buildout.cfg',
... '''
... [buildout]
...
... networkcache-section = networkcache
... develop = download damagednc
... parts = download
...
... [download]
... recipe = download
... url = %(remote_server_url)shello.txt
...
... [networkcache]
... download-cache-url = %(nc_url)sshacache
... download-dir-url = %(nc_url)sshadir
... ''' % globals())
>>> print system(buildout)
There was problem while trying to import slapos.libnetworkcache:
Traceback (most recent call last):
...
SyntaxError: invalid syntax
<BLANKLINE>
Networkcache forced to be disabled.
There was problem while trying to import slapos.libnetworkcache:
Traceback (most recent call last):
...
SyntaxError: invalid syntax
<BLANKLINE>
Networkcache forced to be disabled.
Develop: '/sample-buildout/download'
Develop: '/sample-buildout/damagednc'
Unused options for buildout: 'networkcache-section'.
Installing download.
Downloading http://localhost/hello.txt
download: Downloaded http://localhost/hello.txt
If networkcache internally has issues, or its API got changed, buildout will
still work:
>>> write(sample_buildout, 'damagednc', 'slapos', 'libnetworkcache.py',
... """
... class NetworkcacheClient(object):
... def parseUrl(*args, **kwargs):
... raise Die
... def __init__(*args, **kwargs):
... raise Die
... def upload(*args, **kwargs):
... raise Die
... def download(*args, **kwargs):
... raise Die
... def select(*args, **kwargs):
... raise Die
... class UploadError: pass
... class DirectoryNotFound: pass
... """)
>>> write(sample_buildout, 'buildout.cfg',
... '''
... [buildout]
...
... networkcache-section = networkcache
... develop = download damagednc
... parts = download
...
... [download]
... recipe = download
... url = %(remote_server_url)shello.txt
...
... [networkcache]
... download-cache-url = %(nc_url)sshacache
... download-dir-url = %(nc_url)sshadir
... upload-cache-url = %(nc_url)sshacache
... upload-dir-url = %(nc_url)sshadir
... ''' % globals())
>>> print system(buildout)
Networkcache enabled.
Networkcache download cache: 'http://localhost/shacache', directory 'http://localhost/shadir'
Networkcache upload cache: 'http://localhost/shacache', directory 'http://localhost/shadir'
Develop: '/sample-buildout/download'
Develop: '/sample-buildout/damagednc'
Updating download.
Downloading http://localhost/hello.txt
There was problem while calling method 'download_network_cached':
Traceback (most recent call last):
...
raise Die
NameError: global name 'Die' is not defined
<BLANKLINE>
Uploading http://localhost/hello.txt into network cache.
There was problem while calling method 'upload_network_cached':
Traceback (most recent call last):
...
raise Die
NameError: global name 'Die' is not defined
<BLANKLINE>
download: Downloaded http://localhost:20863/hello.txt
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