Skip to content

Commit

Permalink
panic when no mongodb + remove files when no longer available + do no…
Browse files Browse the repository at this point in the history
…t cleanup recordings by default, however cleanup when recordings have been uploaded
  • Loading branch information
cedricve committed Jul 31, 2023
1 parent 414f747 commit 384448d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion machinery/src/capture/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (

func CleanupRecordingDirectory(configDirectory string, configuration *models.Configuration) {
autoClean := configuration.Config.AutoClean
if autoClean != "false" {
if autoClean == "true" {
maxSize := configuration.Config.MaxDirectorySize
if maxSize == 0 {
maxSize = 300
Expand Down
2 changes: 1 addition & 1 deletion machinery/src/cloud/KerberosHub.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func UploadKerberosHub(configuration *models.Configuration, fileName string) (bo
if err != nil {
err := "UploadKerberosHub: Upload Failed, file doesn't exists anymore."
log.Log.Info(err)
return false, true, errors.New(err)
return false, false, errors.New(err)
}

// Check if we are allowed to upload to the hub with these credentials.
Expand Down
2 changes: 1 addition & 1 deletion machinery/src/cloud/KerberosVault.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func UploadKerberosVault(configuration *models.Configuration, fileName string) (
if err != nil {
err := "UploadKerberosVault: Upload Failed, file doesn't exists anymore."
log.Log.Info(err)
return false, true, errors.New(err)
return false, false, errors.New(err)
}

publicKey := config.KStorage.CloudKey
Expand Down
12 changes: 12 additions & 0 deletions machinery/src/components/Config.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,18 @@ func OpenConfig(configDirectory string, configuration *models.Configuration) {

if res.Err() != nil {
log.Log.Error("Could not find global configuration, using default configuration.")
panic("Could not find global configuration, using default configuration.")
}
err := res.Decode(&globalConfig)
if err != nil {
log.Log.Error("Could not find global configuration, using default configuration.")
panic("Could not find global configuration, using default configuration.")
}
if globalConfig.Type != "global" {
log.Log.Error("Could not find global configuration, might missed the mongodb connection.")
panic("Could not find global configuration, might missed the mongodb connection.")
}

configuration.GlobalConfig = globalConfig

var customConfig models.Config
Expand All @@ -110,6 +117,11 @@ func OpenConfig(configDirectory string, configuration *models.Configuration) {
if err != nil {
log.Log.Error("Could not find configuration for " + deploymentName + ", using global configuration.")
}

if customConfig.Type != "config" {
log.Log.Error("Could not find custom configuration, might missed the mongodb connection.")
panic("Could not find custom configuration, might missed the mongodb connection.")
}
configuration.CustomConfig = customConfig

// We will merge both configs in a single config file.
Expand Down

0 comments on commit 384448d

Please sign in to comment.