Add separate functions to fetch the pgdata directory and directories assigned to tablespaces.
Add a function to run queries remotely on the primary node.
Change multiple exit points in archive_func to a simple try ... except block. Note that this changes the behavior of the archiver from ignoring the hosts that we failed to both rsync the archive file to and copy the archive file to the queue to exiting on the first failure and letting PostgreSQL retry the whole operation (for every host) later. That's probably ok, cause the former behavior lead to the loss of archive segments, in case the process failed for one of the slaves and succeeded for subsequent ones, the new code is free from this defect.
Do not attempt to enqueue the wal segments archived during flush, cause there is no wal segment there.
Merge branch 'master' of https://github.com/alexeyklyukin/PITRTools
Merge pull request #11 from alexeyklyukin/master

Essential fixes for the archiver process.
Merge pull request #14 from soulhunter/master

Make cmd_standby cleanup pg_xlog dir on base backup while using streaming replication.
Fix numerous spacing and identation issues, no functionality changes.
Remove unused modules references.
Remove extra code that does nothing.
Merge remote-tracking branch 'upstream/master'

Conflicts:
	cmd_standby
Merge pull request #15 from alexeyklyukin/master

Mostly indentation and spacing fixes, added a new function to run queries remotely and an SQL function for getting pgdata w/o tablespaces
Code refactoring: separate scattered pieces of code into functions.
Eliminate tons of global variables by using a single global dictionary,
that can be converted to class definition in a straightforward way.
Avoid code duplication when possible.

Add root check to the archiver.
Fix and unqualified global variable reference.
Fix yet another undefined global name.
Add missing semicolon in SQL funciton definition.
Fix invalid code identiation in base_backup_func which lead to incorrect behavior.
Attempt to get rid of the requirement to have the same pgdata path on primary and standby during base backup.
Use 'ssh_timeout' name instead of 'timeout'.
Add missing call to set ssh and scp options on standby. Fix identation.