func SetupPluginForBackup()

in s3plugin/backup.go [20:41]


func SetupPluginForBackup(c *cli.Context) error {
	scope := (Scope)(c.Args().Get(2))
	if scope != Master && scope != Coordinator && scope != SegmentHost {
		return nil
	}
	config, sess, err := readConfigAndStartSession(c)
	if err != nil {
		return err
	}
	localBackupDir := c.Args().Get(1)
	_, timestamp := filepath.Split(localBackupDir)
	testFileName := fmt.Sprintf("gpbackup_%s_report", timestamp)
	testFilePath := fmt.Sprintf("%s/%s", localBackupDir, testFileName)
	fileKey := GetS3Path(config.Options.Folder, testFilePath)
	file, err := os.Create("/tmp/" + testFileName) // dummy empty reader for probe
	defer file.Close()
	if err != nil {
		return err
	}
	_, _, err = uploadFile(sess, config, fileKey, file)
	return err
}