[Checkins] SVN: zc.recipe.deployment/trunk/src/zc/recipe/deployment/ Merged the aaron-explicit-crontab-user, which lets you specify a user

Jim Fulton jim at zope.com
Mon Feb 1 17:54:58 EST 2010


Log message for revision 108698:
  Merged the aaron-explicit-crontab-user, which lets you specify a user
  for crontab entries that is different than a deployment user.
  

Changed:
  U   zc.recipe.deployment/trunk/src/zc/recipe/deployment/README.txt
  U   zc.recipe.deployment/trunk/src/zc/recipe/deployment/__init__.py

-=-
Modified: zc.recipe.deployment/trunk/src/zc/recipe/deployment/README.txt
===================================================================
--- zc.recipe.deployment/trunk/src/zc/recipe/deployment/README.txt	2010-02-01 22:40:07 UTC (rev 108697)
+++ zc.recipe.deployment/trunk/src/zc/recipe/deployment/README.txt	2010-02-01 22:54:58 UTC (rev 108698)
@@ -500,6 +500,38 @@
     >>> open(os.path.join(sample_buildout, 'etc/cron.d/bar-cron')).read()
     '30 23 * * *\tUSER\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
+    ... prefix = %s
+    ... user = %s
+    ... etc-user = %s
+    ...
+    ... [cron]
+    ... recipe = zc.recipe.deployment:crontab
+    ... times = 30 23 * * *
+    ... user = bob
+    ... command = echo hello world!
+    ... deployment = foo
+    ... ''' % (sample_buildout, user, user))
+
+    >>> print system(join('bin', 'buildout')), # doctest: +NORMALIZE_WHITESPACE
+    Uninstalling cron.
+    Updating foo.
+    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/trunk/src/zc/recipe/deployment/__init__.py
===================================================================
--- zc.recipe.deployment/trunk/src/zc/recipe/deployment/__init__.py	2010-02-01 22:40:07 UTC (rev 108697)
+++ zc.recipe.deployment/trunk/src/zc/recipe/deployment/__init__.py	2010-02-01 22:54:58 UTC (rev 108698)
@@ -145,12 +145,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