(self, source_dir, dst_loc)
rsync a pg_log or pg_xlog directory - ignore most of the
        directory contents, and pay attention to symlinks
rsync a pg_log or pg_xlog directory - ignore most of the
        directory contents, and pay attention to symlinks
rsync a pg_log or pg_xlog directory - ignore most of the directory contents and pay attention to symlinks
def rsync_log_directory(self, source_dir, dst_loc):
        """rsync a pg_log or pg_xlog directory - ignore most of the
        directory contents, and pay attention to symlinks
        """
        keep_symlinks = self.cf.getint("keep_symlinks", 1)

        subdir = os.path.basename(source_dir)
        if not os.path.exists(source_dir):
            self.log.info("%s does not exist, skipping", subdir)
            return

        cmdline = []

        # if this is a symlink, copy it's target first
        if os.path.islink(source_dir) and keep_symlinks:
            self.log.info('%s is a symlink, attempting to create link target', subdir)

            # expand the link
            link = os.readlink(source_dir)
            if not link.startswith("/"):
                link = os.path.join(os.getcwd(), link)
            link_target = os.path.join(link, "")

            slave_host = self.cf.get("slave")
            remote_target = "%s:%s" % (slave_host, link_target)
            options = [ "--include=archive_status", "--exclude=/**" ]
            if self.exec_rsync( options + [ link_target, remote_target ]):
                # unable to create the link target, just convert the links
                # to directories in PGDATA
                self.log.warning('Unable to create symlinked %s on target, copying', subdir)
                cmdline += [ "--copy-unsafe-links" ]

        cmdline += [ "--exclude=pg_log/*" ]
        cmdline += [ "--exclude=pg_xlog/archive_status/*" ]
        cmdline += [ "--include=pg_xlog/archive_status" ]
        cmdline += [ "--exclude=pg_xlog/*" ]

        self.exec_big_rsync(cmdline + [ source_dir, dst_loc ])
def rsync_log_directory ( self , source_dir , dst_loc ) : keep_symlinks = self . cf . getint ( "keep_symlinks" , 1 ) subdir = os . path . basename ( source_dir ) if not os . path . exists ( source_dir ) : self . log . info ( "%s does not exist, skipping" , subdir ) return cmdline = [ ] # if this is a symlink, copy it's target first if os . path . islink ( source_dir ) and keep_symlinks : self . log . info ( '%s is a symlink, attempting to create link target' , subdir ) # expand the link link = os . readlink ( source_dir ) if not link . startswith ( "/" ) : link = os . path . join ( os . getcwd ( ) , link ) link_target = os . path . join ( link , "" ) slave_host = self . cf . get ( "slave" ) remote_target = "%s:%s" % ( slave_host , link_target ) options = [ "--include=archive_status" , "--exclude=/**" ] if self . exec_rsync ( options + [ link_target , remote_target ] ) : # unable to create the link target, just convert the links # to directories in PGDATA self . log . warning ( 'Unable to create symlinked %s on target, copying' , subdir ) cmdline += [ "--copy-unsafe-links" ] cmdline += [ "--exclude=pg_log/*" ] cmdline += [ "--exclude=pg_xlog/archive_status/*" ] cmdline += [ "--include=pg_xlog/archive_status" ] cmdline += [ "--exclude=pg_xlog/*" ] self . exec_big_rsync ( cmdline + [ source_dir , dst_loc ] )