Merge lp:~rvb/maas-test/fix-cache-config into lp:maas-test
Proposed by
Raphaël Badin
Status: | Merged |
---|---|
Merged at revision: | 72 |
Proposed branch: | lp:~rvb/maas-test/fix-cache-config |
Merge into: | lp:maas-test |
Diff against target: |
142 lines (+67/-3) (has conflicts) 2 files modified
maastest/proxyfixture.py (+22/-1) maastest/tests/test_proxyfixture.py (+45/-2) Text conflict in maastest/tests/test_proxyfixture.py |
To merge this branch: | bzr merge lp:~rvb/maas-test/fix-cache-config |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Gavin Panella (community) | Approve | ||
Review via email: mp+196737@code.launchpad.net |
Commit message
Configure the proxy to actually cache things.
Description of the change
By default, the proxy was configured to cache things in /var/cache/polipo… which, obviously, didn't work at all since the proxy is not run as root. This branch fixes that by configuring the proxy to write its cache into '~/.maas-
To post a comment you must log in.
Looks good. A couple of things need fixing, but there's no need to block
landing once they're done.
[1]
+# TODO: '.maas-test' shouln't be harcoded like that, it should re(). test/proxy_ cache/'
+# be a parameter passed to LocalProxyFixtu
+DISK_CACHE_ROOT = '~/.maas-
Or refer to the XDG spec, and use XDG_CACHE_HOME. There's an xdg module
which you could use like so:
from xdg.BaseDirectory import save_cache_path path("maas- test", "proxy-cache")
DISK_CACHE_ROOT = save_cache_
See the xdg.BaseDirectory module source for more.
The packages are python-xdg and python3-xdg.
[2]
+ def create_ cache_root( self): expanduser( DISK_CACHE_ ROOT) cache_root)
+ cache_root = os.path.
+ try:
+ os.makedirs(
+ except OSError:
+ # Directory already exists.
+ pass
Please check for os.EEXIST:
try:
os. makedirs( cache_root)
raise
except OSError as error:
if error.code != errno.EEXIST: