(self)
Restore the configuration files if target directory specified.
Restore the configuration files if target directory specified.
Restore the configuration files if target directory specified .
def slave_restore_config(self):
        """Restore the configuration files if target directory specified."""
        self.assert_is_master(False)

        cf_source_dir = self.cf.getfile("config_backup", "")
        cf_target_dir = self.cf.getfile("slave_config_dir", "")

        if not cf_source_dir:
            self.log.info("Configuration backup location not specified.")
            return

        if not cf_target_dir:
            self.log.info("Configuration directory not specified, config files not restored.")
            return

        if not os.path.exists(cf_target_dir):
            self.log.warning("Configuration directory does not exist: %s", cf_target_dir)
            return

        self.log.info("Restoring configuration files")
        for cf in ('postgresql.conf', 'pg_hba.conf', 'pg_ident.conf'):
            cfsrc = os.path.join(cf_source_dir, cf)
            cfdst = os.path.join(cf_target_dir, cf)

            if not os.path.isfile(cfsrc):
                self.log.warning("Missing configuration file backup: %s", cf)
                continue

            self.log.debug("Copy %s to %s", cfsrc, cfdst)
            if not self.not_really:
                copy_conf(cfsrc, cfdst)
                if cf == 'postgresql.conf':
                    self.slave_deconfigure_archiving(cfdst)
def slave_restore_config ( self ) : self . assert_is_master ( False ) cf_source_dir = self . cf . getfile ( "config_backup" , "" ) cf_target_dir = self . cf . getfile ( "slave_config_dir" , "" ) if not cf_source_dir : self . log . info ( "Configuration backup location not specified." ) return if not cf_target_dir : self . log . info ( "Configuration directory not specified, config files not restored." ) return if not os . path . exists ( cf_target_dir ) : self . log . warning ( "Configuration directory does not exist: %s" , cf_target_dir ) return self . log . info ( "Restoring configuration files" ) for cf in ( 'postgresql.conf' , 'pg_hba.conf' , 'pg_ident.conf' ) : cfsrc = os . path . join ( cf_source_dir , cf ) cfdst = os . path . join ( cf_target_dir , cf ) if not os . path . isfile ( cfsrc ) : self . log . warning ( "Missing configuration file backup: %s" , cf ) continue self . log . debug ( "Copy %s to %s" , cfsrc , cfdst ) if not self . not_really : copy_conf ( cfsrc , cfdst ) if cf == 'postgresql.conf' : self . slave_deconfigure_archiving ( cfdst )