Skip to content
This repository has been archived by the owner on Jan 25, 2019. It is now read-only.

Commit

Permalink
Fix paths
Browse files Browse the repository at this point in the history
  • Loading branch information
Jc2k committed May 13, 2012
1 parent b7de26c commit 2a71228
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions badgerproxy/recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def __init__(self, buildout, name, options):
self.buildout = buildout

self.parts_directory = os.path.join(self.buildout['buildout']['parts-directory'], self.name)
self.var_directory = os.path.join(self.buildout['buildout']['directory'], 'var')

self.options.setdefault('userconf', os.path.abspath(os.path.join(self.parts_directory, "user.conf")))
self.options.setdefault('systemconf', os.path.abspath(os.path.join(self.parts_directory, "system.conf")))
Expand All @@ -27,14 +28,16 @@ def install(self):
shutil.copyfile(self.options["template"], self.options["userconf"])
self.options.created(self.options["userconf"])

pprefix = os.path.join(self.var_directory, self.name)

with open(self.options['systemconf'], "w") as fp:
fp.write(
"socket: /tmp/badgerproxy.socket\n"
"pidfile: /tmp/badgerproxy.pid\n"
"resolver_cache: /tmp/badgerproxy.resolvercache\n"
"socket: %(pprefix)s.socket\n"
"pidfile: %(pprefix)s.pid\n"
"resolver_cache: %(pprefix)s\n"
"\n"
".include:\n"
" - user.conf\n"
" - user.conf\n" % dict(pprefix=pprefix)
)
self.options.created(self.options["systemconf"])

Expand Down

0 comments on commit 2a71228

Please sign in to comment.