Source code for fabtools.utils

"""
Utilities
=========
"""
from fabric.api import env, run, sudo


[docs]def run_as_root(command, *args, **kwargs): """ Run a remote command as the root user. When connecting as root to the remote system, this will use Fabric's ``run`` function. In other cases, it will use ``sudo``. """ if env.user == 'root': func = run else: func = sudo return func(command, *args, **kwargs)

Project Versions

This Page