Skip to content

Commit

Permalink
Fix an issue in pulp_settings defining tuples
Browse files Browse the repository at this point in the history
fixes: #1122
  • Loading branch information
git-hyagi committed Oct 25, 2023
1 parent ae40338 commit 42e3392
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES/1122.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed an error in wrong definition of tuples in `settings.py`.
9 changes: 8 additions & 1 deletion controllers/repo_manager/secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package repo_manager
import (
"encoding/json"
"fmt"
"regexp"
"strconv"
"strings"

Expand Down Expand Up @@ -421,7 +422,13 @@ func addCustomPulpSettings(pulp *repomanagerpulpprojectorgv1beta2.Pulp, pulpSett
convertToString := cases.Title(language.English, cases.Compact).String(strconv.FormatBool(settingsJson[k].(bool)))
convertedSettings = convertedSettings + fmt.Sprintf("%v = %v\n", strings.ToUpper(k), convertToString)
default:
convertedSettings = convertedSettings + fmt.Sprintf("%v = \"%v\"\n", strings.ToUpper(k), settingsJson[k])
// if it is a tuple, we should not parse it as a string (do not add the quotes)
r, _ := regexp.Compile(`\(.*\)`)
if r.MatchString(settingsJson[k].(string)) {
convertedSettings = convertedSettings + fmt.Sprintf("%v = %v\n", strings.ToUpper(k), settingsJson[k])
} else {
convertedSettings = convertedSettings + fmt.Sprintf("%v = \"%v\"\n", strings.ToUpper(k), settingsJson[k])
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ func main() {
os.Exit(1)
}

setupLog.Info("pulp-operator version: 1.0.0-beta.3")
setupLog.Info("pulp-operator version: 1.0.1-beta.3")
setupLog.Info("starting manager")
if err := mgr.Start(ctrl.SetupSignalHandler()); err != nil {
setupLog.Error(err, "problem running manager")
Expand Down

0 comments on commit 42e3392

Please sign in to comment.