[Checkins] SVN: zc.recipe.deployment/branches/aaron-explicit-crontab-user/src/zc/recipe/deployment/ Crontab accepts an explicit user agument. Added test.
Aaron Lehmann
aaron at zope.com
Tue Oct 13 14:25:05 EDT 2009
Log message for revision 105054:
Crontab accepts an explicit user agument. Added test.
Changed:
U zc.recipe.deployment/branches/aaron-explicit-crontab-user/src/zc/recipe/deployment/README.txt
U zc.recipe.deployment/branches/aaron-explicit-crontab-user/src/zc/recipe/deployment/__init__.py
-=-
Modified: zc.recipe.deployment/branches/aaron-explicit-crontab-user/src/zc/recipe/deployment/README.txt
===================================================================
--- zc.recipe.deployment/branches/aaron-explicit-crontab-user/src/zc/recipe/deployment/README.txt 2009-10-13 18:13:19 UTC (rev 105053)
+++ zc.recipe.deployment/branches/aaron-explicit-crontab-user/src/zc/recipe/deployment/README.txt 2009-10-13 18:25:05 UTC (rev 105054)
@@ -402,7 +402,50 @@
>>> open('/etc/cron.d/bar-cron').read()
'30 23 * * *\tjim\techo hello world!\n'
+The crontab recipe gets its user from the buildout's deployment by default,
+but it doesn't have to.
+ >>> write('buildout.cfg',
+ ... '''
+ ... [buildout]
+ ... parts = foo cron
+ ...
+ ... [foo]
+ ... recipe = zc.recipe.deployment
+ ... name = bar
+ ... user = jim
+ ...
+ ... [cron]
+ ... recipe = zc.recipe.deployment:crontab
+ ... times = 30 23 * * *
+ ... user = bob
+ ... command = echo hello world!
+ ... deployment = foo
+ ... ''')
+
+ >>> print system(join('bin', 'buildout')),
+ Uninstalling cron.
+ Uninstalling foo.
+ Running uninstall recipe.
+ zc.recipe.deployment: Removing '/etc/foo'
+ zc.recipe.deployment: Removing '/var/log/foo'.
+ zc.recipe.deployment: Removing '/var/run/foo'.
+ Installing foo.
+ zc.recipe.deployment:
+ Creating '/etc/bar',
+ mode 755, user 'root', group 'root'
+ zc.recipe.deployment:
+ Creating '/var/log/bar',
+ mode 755, user 'jim', group 'jim'
+ zc.recipe.deployment:
+ Creating '/var/run/bar',
+ mode 750, user 'jim', group 'jim'
+ Installing cron.
+
+ >>> open('/etc/cron.d/bar-cron').read()
+ '30 23 * * *\tbob\techo hello world!\n'
+
+
.. cleanup
>>> print system(join('bin', 'buildout')+' buildout:parts='),
Modified: zc.recipe.deployment/branches/aaron-explicit-crontab-user/src/zc/recipe/deployment/__init__.py
===================================================================
--- zc.recipe.deployment/branches/aaron-explicit-crontab-user/src/zc/recipe/deployment/__init__.py 2009-10-13 18:13:19 UTC (rev 105053)
+++ zc.recipe.deployment/branches/aaron-explicit-crontab-user/src/zc/recipe/deployment/__init__.py 2009-10-13 18:25:05 UTC (rev 105054)
@@ -132,12 +132,13 @@
self.options = options
deployment = options['deployment']
+ user = options.get('user', buildout[deployment]['user'])
deployment_name = buildout[deployment]['name']
options['location'] = os.path.join(
buildout[deployment]['crontab-directory'],
deployment_name + '-' + name)
options['entry'] = '%s\t%s\t%s\n' % (
- options['times'], buildout[deployment]['user'], options['command'])
+ options['times'], user, options['command'])
def install(self):
options = self.options
More information about the checkins
mailing list