Commits

Mikhail Korobov committed 06a3e6a

Docs for run_as decorator

  • Participants
  • Parent commits a93cac6

Comments (0)

Files changed (2)

File docs/fabfile.rst

 commands, there are some helpers to make writing them easier.
 
 .. autofunction:: fab_deploy.utils.inside_project
+
+.. autofunction:: fab_deploy.utils.run_as

File fab_deploy/utils.py

 from fabric.state import _AttributeDict
 
 def run_as(user):
+    """
+    Decorator. Runs fabric command as specified user. It is most useful to
+    run commands that require root access to server::
+
+        from fabric.api import run
+        from fab_deploy.utils import run_as
+
+        @run_as('root')
+        def aptitude_update():
+            run('aptitude update')
+
+    """
     def decorator(func):
         @wraps(func)
         def inner(*args, **kwargs):