don't give log-file prepopulate flag a default (#3237)
Passing the default logging file into flag pre-population causes the logger to assume the flag is always passed in and never falls back to the ENV setting. This ensures that if no flag is provided, the env log file setting is used. --- #### Does this PR need a docs update or release note? - [x] ✅ Yes, it's included #### Type of change - [x] 🐛 Bugfix #### Test Plan - [x] 💪 Manual - [x] ⚡ Unit test - [x] 💚 E2E
This commit is contained in:
parent
c2af75da9c
commit
85f322fe97
3
.github/workflows/sanity-test.yaml
vendored
3
.github/workflows/sanity-test.yaml
vendored
@ -235,8 +235,7 @@ jobs:
|
||||
set -euo pipefail
|
||||
./sanityCheck
|
||||
|
||||
|
||||
# Onedrive test
|
||||
# Onedrive test
|
||||
|
||||
# run the tests
|
||||
- name: Backup onedrive test
|
||||
|
||||
@ -29,6 +29,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Fixed edge case in incremental backups where moving a subfolder, deleting and recreating the subfolder's original parent folder, and moving the subfolder back to where it started would skip backing up unchanged items in the subfolder.
|
||||
- SharePoint now correctly displays site urls on `backup list`, instead of the site id.
|
||||
- Drives with a directory containing a folder named 'folder' will now restore without error.
|
||||
- The CORSO_LOG_FILE env is appropriately utilized if no --log-file flag is provided.
|
||||
|
||||
### Known Issues
|
||||
- Restoring a OneDrive or SharePoint file with the same name as a file with that name as its M365 ID may restore both items.
|
||||
|
||||
@ -126,16 +126,15 @@ type Settings struct {
|
||||
// AddLogLevelFlag() and AddLogFileFlag() ensures the flags are
|
||||
// displayed as part of the help/usage output.
|
||||
func PreloadLoggingFlags(args []string) Settings {
|
||||
dlf := defaultLogLocation()
|
||||
fs := pflag.NewFlagSet("seed-logger", pflag.ContinueOnError)
|
||||
fs.ParseErrorsWhitelist.UnknownFlags = true
|
||||
addFlags(fs, dlf)
|
||||
addFlags(fs, "")
|
||||
|
||||
// prevents overriding the corso/cobra help processor
|
||||
fs.BoolP("help", "h", false, "")
|
||||
|
||||
ls := Settings{
|
||||
File: dlf,
|
||||
File: "",
|
||||
Level: LogLevelFV,
|
||||
PIIHandling: SensitiveInfoFV,
|
||||
}
|
||||
@ -186,6 +185,11 @@ func GetLogFile(logFileFlagVal string) string {
|
||||
r = os.Getenv("CORSO_LOG_FILE")
|
||||
}
|
||||
|
||||
// if no flag or env is specified, fall back to the default
|
||||
if len(r) == 0 {
|
||||
r = defaultLogLocation()
|
||||
}
|
||||
|
||||
if r == "-" {
|
||||
r = Stdout
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user