wuttamess.util

Misc. Utilities

wuttamess.util.exists(c, path)[source]

Returns True if given path exists on the host, otherwise False.

wuttamess.util.get_home_path(c, user=None)[source]

Get the path to user’s home folder on target machine.

Parameters:
  • c – Fabric connection.

  • user – Username whose home folder you want. If not specified, the username for the current connection is assumed.

Returns:

Home folder path as string.

Check if the given path is a symlink.

Parameters:
  • c – Fabric connection.

  • path – Path to check, on target machine.

Returns:

True if path is a symlink, else False.

wuttamess.util.mako_renderer(c, env={})[source]

This returns a function suitable for use as a fabsync file renderer. The function assumes the file is a Mako template.

Parameters:
  • c – Fabric connection.

  • env – Environment dictionary to be used as Mako template context.

Typical usage is something like:

from fabric import task
from wuttamess import sync, util

root = sync.make_root('files')
env = {}

@task
def foo(c):

    # define possible renderers for fabsync
    renderers = {'mako': util.mako_renderer(c, env)}

    sync.check_isync(c, root, 'etc/postfix', renderers=renderers)
wuttamess.util.set_timezone(c, timezone)[source]

Set the system timezone.

Parameters:
  • c – Fabric connection.

  • timezone – Standard timezone name, e.g. 'America/Chicago'.