Skip to content

Commit

Permalink
Merge branch 'main' into feature/config-ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Clifford committed Aug 23, 2023
2 parents 3b1e3cc + cb5354f commit d4cbc65
Show file tree
Hide file tree
Showing 11 changed files with 134 additions and 76 deletions.
2 changes: 1 addition & 1 deletion assets/.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.6.4
v0.7.1
29 changes: 20 additions & 9 deletions cmd/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ var skipSourceCleanup bool
var skipTargetCleanup bool
var skipTargetImport bool
var localTransferResourceName string
var namedTransferResource string

var syncCmd = &cobra.Command{
Use: "sync [mariadb|files|mongodb|postgres|etc.]",
Expand Down Expand Up @@ -157,18 +158,27 @@ func syncCommandRun(cmd *cobra.Command, args []string) {
RsyncArgs: RsyncArguments,
}

// let's update the named transfer resource if it is set
if namedTransferResource != "" {
err = lagoonSyncer.SetTransferResource(namedTransferResource)
if err != nil {
utils.LogFatalError(err.Error(), nil)
}
}

utils.LogDebugInfo("Config that is used for SSH", sshOptions)

err = runSyncProcess(synchers.RunSyncProcessFunctionTypeArguments{
SourceEnvironment: sourceEnvironment,
TargetEnvironment: targetEnvironment,
LagoonSyncer: lagoonSyncer,
SyncerType: SyncerType,
DryRun: dryRun,
SshOptions: sshOptions,
SkipTargetCleanup: skipTargetCleanup,
SkipSourceCleanup: skipSourceCleanup,
SkipTargetImport: skipTargetImport,
SourceEnvironment: sourceEnvironment,
TargetEnvironment: targetEnvironment,
LagoonSyncer: lagoonSyncer,
SyncerType: SyncerType,
DryRun: dryRun,
SshOptions: sshOptions,
SkipTargetCleanup: skipTargetCleanup,
SkipSourceCleanup: skipSourceCleanup,
SkipTargetImport: skipTargetImport,
TransferResourceName: namedTransferResource,
})

if err != nil {
Expand Down Expand Up @@ -217,6 +227,7 @@ func init() {
syncCmd.PersistentFlags().BoolVar(&skipSourceCleanup, "skip-source-cleanup", false, "Don't clean up any of the files generated on the source")
syncCmd.PersistentFlags().BoolVar(&skipTargetCleanup, "skip-target-cleanup", false, "Don't clean up any of the files generated on the target")
syncCmd.PersistentFlags().BoolVar(&skipTargetImport, "skip-target-import", false, "This will skip the import step on the target, in combination with 'no-target-cleanup' this essentially produces a resource dump")
syncCmd.PersistentFlags().StringVarP(&namedTransferResource, "transfer-resource-name", "", "", "The name of the temporary file to be used to transfer generated resources (db dumps, etc) - random /tmp file otherwise")

// By default, we hook up the syncers.RunSyncProcess function to the runSyncProcess variable
// by doing this, it lets us easily override it for testing the command - but for most of the time
Expand Down
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ require (
github.com/spf13/viper v1.9.0
github.com/withmandala/go-log v0.1.0
golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa
golang.org/x/sys v0.0.0-20211113001501-0c823b97ae02 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/text v0.3.8 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/ini.v1 v1.64.0 // indirect
gopkg.in/yaml.v2 v2.4.0
Expand Down
17 changes: 13 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs=
go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g=
go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ=
Expand All @@ -321,6 +322,7 @@ golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa h1:idItI2DDfCokpg0N51B2VtiLdJ4vAuXC9fnCb2gACo4=
golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
Expand Down Expand Up @@ -358,6 +360,7 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
Expand Down Expand Up @@ -396,6 +399,7 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v
golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc=
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
Expand Down Expand Up @@ -423,6 +427,7 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
Expand Down Expand Up @@ -480,10 +485,12 @@ golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211113001501-0c823b97ae02 h1:7NCfEGl0sfUojmX78nK9pBJuUlSZWEJA/TwASvfiPLo=
golang.org/x/sys v0.0.0-20211113001501-0c823b97ae02/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f h1:v4INt8xihDGvnrfjMDVXGxw9wrfxYyCjk0KbXjhR55s=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand All @@ -492,8 +499,9 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.3.8 h1:nAL+RVCQ9uMn3vJZbV+MRnydTJFPf8qqY42YiA6MrqY=
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
Expand Down Expand Up @@ -553,6 +561,7 @@ golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down
6 changes: 5 additions & 1 deletion synchers/drupalconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func init() {

func (root DrupalconfigSyncRoot) PrepareSyncer() (Syncer, error) {
root.TransferId = strconv.FormatInt(time.Now().UnixNano(), 10)
return root, nil
return &root, nil
}

func (m DrupalconfigSyncRoot) IsInitialized() (bool, error) {
Expand Down Expand Up @@ -104,6 +104,10 @@ func (m DrupalconfigSyncRoot) GetTransferResource(environment Environment) Synce
IsDirectory: true}
}

func (m *DrupalconfigSyncRoot) SetTransferResource(transferResourceName string) error {
return fmt.Errorf("Setting the transfer resource is not supported for drupal config")
}

func (root DrupalconfigSyncRoot) GetOutputDirectory() string {
m := root.Config
if len(m.OutputDirectory) == 0 {
Expand Down
20 changes: 12 additions & 8 deletions synchers/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,39 +77,39 @@ func init() {
RegisterSyncer(FilesSyncPlugin{})
}

func (m FilesSyncRoot) IsInitialized() (bool, error) {
func (m *FilesSyncRoot) IsInitialized() (bool, error) {
return true, nil
}

func (root FilesSyncRoot) PrepareSyncer() (Syncer, error) {
func (root *FilesSyncRoot) PrepareSyncer() (Syncer, error) {
root.TransferId = strconv.FormatInt(time.Now().UnixNano(), 10)
return root, nil
}

func (root FilesSyncRoot) GetPrerequisiteCommand(environment Environment, command string) SyncCommand {
func (root *FilesSyncRoot) GetPrerequisiteCommand(environment Environment, command string) SyncCommand {
return SyncCommand{}
}

func (root FilesSyncRoot) GetRemoteCommand(environment Environment) []SyncCommand {
func (root *FilesSyncRoot) GetRemoteCommand(environment Environment) []SyncCommand {
return []SyncCommand{
generateNoOpSyncCommand(),
}
}

func (m FilesSyncRoot) GetLocalCommand(environment Environment) []SyncCommand {
func (m *FilesSyncRoot) GetLocalCommand(environment Environment) []SyncCommand {
return []SyncCommand{
generateNoOpSyncCommand(),
}
}

func (m FilesSyncRoot) GetFilesToCleanup(environment Environment) []string {
func (m *FilesSyncRoot) GetFilesToCleanup(environment Environment) []string {
transferResource := m.GetTransferResource(environment)
return []string{
transferResource.Name,
}
}

func (m FilesSyncRoot) GetTransferResource(environment Environment) SyncerTransferResource {
func (m *FilesSyncRoot) GetTransferResource(environment Environment) SyncerTransferResource {
config := m.Config
if environment.EnvironmentName == LOCAL_ENVIRONMENT_NAME {
config = m.getEffectiveLocalDetails()
Expand All @@ -122,7 +122,11 @@ func (m FilesSyncRoot) GetTransferResource(environment Environment) SyncerTransf
}
}

func (syncConfig FilesSyncRoot) getEffectiveLocalDetails() BaseFilesSync {
func (m *FilesSyncRoot) SetTransferResource(transferResourceName string) error {
return fmt.Errorf("Setting the transfer resource is not supported for files")
}

func (syncConfig *FilesSyncRoot) getEffectiveLocalDetails() BaseFilesSync {
returnDetails := BaseFilesSync{
SyncPath: syncConfig.Config.SyncPath,
}
Expand Down
36 changes: 23 additions & 13 deletions synchers/mariadb.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ type MariadbSyncLocal struct {
}

type MariadbSyncRoot struct {
Config BaseMariaDbSync
LocalOverrides MariadbSyncLocal `yaml:"local"`
TransferId string
Config BaseMariaDbSync
LocalOverrides MariadbSyncLocal `yaml:"local"`
TransferId string
TransferResourceOverride string
}

func (mariadbConfig *BaseMariaDbSync) setDefaults() {
Expand Down Expand Up @@ -96,7 +97,7 @@ func init() {
RegisterSyncer(MariadbSyncPlugin{})
}

func (m MariadbSyncRoot) IsInitialized() (bool, error) {
func (m *MariadbSyncRoot) IsInitialized() (bool, error) {

var missingEnvvars []string

Expand All @@ -123,12 +124,12 @@ func (m MariadbSyncRoot) IsInitialized() (bool, error) {
return true, nil
}

func (root MariadbSyncRoot) PrepareSyncer() (Syncer, error) {
func (root *MariadbSyncRoot) PrepareSyncer() (Syncer, error) {
root.TransferId = strconv.FormatInt(time.Now().UnixNano(), 10)
return root, nil
}

func (root MariadbSyncRoot) GetPrerequisiteCommand(environment Environment, command string) SyncCommand {
func (root *MariadbSyncRoot) GetPrerequisiteCommand(environment Environment, command string) SyncCommand {
lagoonSyncBin, _ := utils.FindLagoonSyncOnEnv()

return SyncCommand{
Expand All @@ -140,7 +141,7 @@ func (root MariadbSyncRoot) GetPrerequisiteCommand(environment Environment, comm
}
}

func (root MariadbSyncRoot) GetRemoteCommand(sourceEnvironment Environment) []SyncCommand {
func (root *MariadbSyncRoot) GetRemoteCommand(sourceEnvironment Environment) []SyncCommand {
m := root.Config

if sourceEnvironment.EnvironmentName == LOCAL_ENVIRONMENT_NAME {
Expand Down Expand Up @@ -184,7 +185,7 @@ func (root MariadbSyncRoot) GetRemoteCommand(sourceEnvironment Environment) []Sy
}
}

func (m MariadbSyncRoot) GetLocalCommand(targetEnvironment Environment) []SyncCommand {
func (m *MariadbSyncRoot) GetLocalCommand(targetEnvironment Environment) []SyncCommand {
l := m.Config
if targetEnvironment.EnvironmentName == LOCAL_ENVIRONMENT_NAME {
l = m.getEffectiveLocalDetails()
Expand Down Expand Up @@ -213,7 +214,7 @@ func (m MariadbSyncRoot) GetLocalCommand(targetEnvironment Environment) []SyncCo
}
}

func (m MariadbSyncRoot) GetFilesToCleanup(environment Environment) []string {
func (m *MariadbSyncRoot) GetFilesToCleanup(environment Environment) []string {
transferResource := m.GetTransferResource(environment)
resourceNameWithoutGz := strings.TrimSuffix(transferResource.Name, filepath.Ext(transferResource.Name))
return []string{
Expand All @@ -222,21 +223,30 @@ func (m MariadbSyncRoot) GetFilesToCleanup(environment Environment) []string {
}
}

func (m MariadbSyncRoot) GetTransferResource(environment Environment) SyncerTransferResource {
func (m *MariadbSyncRoot) GetTransferResource(environment Environment) SyncerTransferResource {
resourceName := fmt.Sprintf("%vlagoon_sync_mariadb_%v.sql.gz", m.GetOutputDirectory(), m.TransferId)
if m.TransferResourceOverride != "" {
resourceName = m.TransferResourceOverride
}
return SyncerTransferResource{
Name: fmt.Sprintf("%vlagoon_sync_mariadb_%v.sql.gz", m.GetOutputDirectory(), m.TransferId),
Name: resourceName,
IsDirectory: false}
}

func (root MariadbSyncRoot) GetOutputDirectory() string {
func (m *MariadbSyncRoot) SetTransferResource(transferResourceName string) error {
m.TransferResourceOverride = transferResourceName
return nil
}

func (root *MariadbSyncRoot) GetOutputDirectory() string {
m := root.Config
if len(m.OutputDirectory) == 0 {
return "/tmp/"
}
return m.OutputDirectory
}

func (syncConfig MariadbSyncRoot) getEffectiveLocalDetails() BaseMariaDbSync {
func (syncConfig *MariadbSyncRoot) getEffectiveLocalDetails() BaseMariaDbSync {
returnDetails := BaseMariaDbSync{
DbHostname: syncConfig.Config.DbHostname,
DbUsername: syncConfig.Config.DbUsername,
Expand Down
Loading

0 comments on commit d4cbc65

Please sign in to comment.