[Checkins]
SVN: zc.recipe.deployment/trunk/src/zc/recipe/deployment/
Added some documentation.
Jim Fulton
jim at zope.com
Thu Jan 11 15:04:05 EST 2007
Log message for revision 71932:
Added some documentation.
Simplified the recipe.
Adjusted the ownership and modes of generated directories.
Include rc-directory in options.
Changed:
A zc.recipe.deployment/trunk/src/zc/recipe/deployment/README.txt
U zc.recipe.deployment/trunk/src/zc/recipe/deployment/__init__.py
-=-
Added: zc.recipe.deployment/trunk/src/zc/recipe/deployment/README.txt
===================================================================
--- zc.recipe.deployment/trunk/src/zc/recipe/deployment/README.txt 2007-01-11 20:04:03 UTC (rev 71931)
+++ zc.recipe.deployment/trunk/src/zc/recipe/deployment/README.txt 2007-01-11 20:04:04 UTC (rev 71932)
@@ -0,0 +1,32 @@
+Unix Deployment Support
+=======================
+
+The zc.recope.deploymemt recipe provides support for deploying
+applications with multiple processes on Unix systems. It creates
+directories to hold application instance configuration, log and
+run-time files. It also sets or reads options that can be read by
+other programs to find out where to place files:
+
+etc-directory
+ The name of the directory where configurtion files should be
+ placed. This is /etc/NAME, where NAME is the deployment
+ name.
+
+log-directory
+ The name of the directory where application instances should write
+ their log files. This is /var/log/NAME, where NAME is
+ the deployment name.
+
+run-directory
+ The name of the directory where application instances should put
+ their run-time files such as pid files and inter-process
+ communication socket files. This is /var/run/NAME, where
+ NAME is the deployment name.
+
+rc-directory
+ The name of the directory where run-control scripts should be
+ installed. This is /etc/init.d.
+
+The log and run directories are created in such a way that the
+directorie are owned by the user specified in the user option and are
+writable by the user and the user's group.
Property changes on: zc.recipe.deployment/trunk/src/zc/recipe/deployment/README.txt
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: zc.recipe.deployment/trunk/src/zc/recipe/deployment/__init__.py
===================================================================
--- zc.recipe.deployment/trunk/src/zc/recipe/deployment/__init__.py 2007-01-11 20:04:03 UTC (rev 71931)
+++ zc.recipe.deployment/trunk/src/zc/recipe/deployment/__init__.py 2007-01-11 20:04:04 UTC (rev 71932)
@@ -18,44 +18,30 @@
import os, pwd, shutil
+
class Recipe:
def __init__(self, buildout, name, options):
self.name, self.options = name, options
+ create = []
+
options['run-directory'] = os.path.join(options.get('run', '/var/run'),
name)
options['log-directory'] = os.path.join(options.get('log', '/var/log'),
name)
options['etc-directory'] = os.path.join(options.get('etc', '/etc'),
name)
-
- def make_dirs(self, name, uid, gid, created):
- # modified from standard lib
- head, tail = os.path.split(name)
- if not tail:
- head, tail = os.path.split(head)
- if head and tail and not os.path.exists(head):
- self.make_dirs(head, uid, gid, created)
- if tail == os.curdir: # xxx/newdir/. exists if xxx/newdir exists
- return
- os.mkdir(name, 0755)
- created.append(name)
- os.chown(name, uid, gid)
+ options['rc-directory'] = options.get('rc-directory', '/etc/init.d')
def install(self):
options = self.options
- user = options.get('user')
- if user:
- uid, gid = pwd.getpwnam(user)[2:4]
- else:
- uid = os.getuid()
- gid = os.getgid()
+ user = options['user']
+ uid, gid = pwd.getpwnam(user)[2:4]
created = []
try:
- for d in 'run', 'log', 'etc':
- d = options[d+'-directory']
- if not os.path.isdir(d):
- self.make_dirs(d, uid, gid, created)
+ make_dir(options['etc-directory'], 0, 0, 0755, created)
+ make_dir(options['log-directory'], uid, gid, 0755, created)
+ make_dir(options['run-directory'], uid, gid, 0750, created)
return created
except Exception, e:
for d in created:
@@ -68,3 +54,9 @@
def update(self):
pass
+
+
+def make_dir(name, uid, gid, mode, created):
+ os.mkdir(name, mode)
+ created.append(name)
+ os.chown(name, uid, gid)
More information about the Checkins
mailing list