wuttamess.sync

Synchronize Files

See Usage for a basic example.

wuttamess.sync.check_isync(c, root, selector=None, **kwargs)[source]

Sync all files and return boolean indicating whether any actual modifications were made.

Arguments are the same as for isync(), which this calls.

Returns:

True if any sync result indicates a file was modified; otherwise False.

wuttamess.sync.isync(c, root, selector=None, tags=None, echo=True, **kwargs)[source]

Sync files, yielding the result for each as it goes.

This is a convenience wrapper around fabsync.isync().

Parameters:
  • c – Fabric connection.

  • root – File tree “root” object as obtained from make_root().

  • selector – This can be a simple “subpath” string, indicating a section of the file tree (e.g. 'etc/postfix'). Or can be a fabsync.ItemSelector instance.

  • tags – Optional iterable of tags to select. If selector is a subpath string, and you specify tags then they will be included when creating the actual selector.

  • echo – Flag indicating whether the path for each file synced should be echoed to stdout. Generally thought to be useful but may be disabled.

  • **kwargs – Any remaining kwargs are passed as-is to fabsync.isync().

wuttamess.sync.make_root(path, dest='/')[source]

Make and return a “root” object for use with future sync calls.

This is a convenience wrapper around fabsync.load().

Parameters:
  • path – Path to local file tree. Usually this is relative to the fabfile.py location, otherwise should be absolute.

  • dest – Path for target file tree.

wuttamess.sync.make_selector(subpath=None, **kwargs)[source]

Make and return an “item selector” for use with a sync call.

This is a convenience wrapper around fabsync.ItemSelector.new().

Parameters:
  • subpath – (Optional) Relative subpath of the file tree to sync, e.g. 'etc/postfix'.

  • tags – Optional iterable of tags to include; excluding any files which are not so tagged. E.g. {'foo'}