Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail to start server/agent on unknown config #1714

Merged
merged 1 commit into from
Jul 8, 2020

Conversation

azdagron
Copy link
Member

@azdagron azdagron commented Jul 8, 2020

Also allows for consumers who are extending the CLI to opt-out of the unknown configuration check.

Fixes #1101, fixes #1432

Copy link
Member

@amartinezfayo amartinezfayo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It all looks good to me. I have only one suggestion.

l.WithFields(logrus.Fields{
"section": section,
"keys": strings.Join(keys, ","),
}).Error("Unknown configuration detected")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this effectively terminates the program, we may use the fatal level?

Suggested change
}).Error("Unknown configuration detected")
}).Fatal("Unknown configuration detected")

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure! Updated.

l.WithFields(logrus.Fields{
"section": section,
"keys": strings.Join(keys, ","),
}).Error("Unknown configuration detected")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this effectively terminates the program, we may use the fatal level?

Suggested change
}).Error("Unknown configuration detected")
}).Fatal("Unknown configuration detected")

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure! Updated.

@@ -24,6 +24,16 @@ func AssertLogs(t *testing.T, entries []*logrus.Entry, expected []LogEntry) {
assert.Equal(t, expected, convertLogEntries(entries), "unexpected logs")
}

func AssertLogsAnyOrder(t *testing.T, entries []*logrus.Entry, expected []LogEntry) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

amartinezfayo
amartinezfayo previously approved these changes Jul 8, 2020
Copy link
Member

@amartinezfayo amartinezfayo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this @azdagron!

@azdagron
Copy link
Member Author

azdagron commented Jul 8, 2020

Actually, we don't want Fatal. It calls os.Exit(). I'm going to change it back to Error level. I'll also squash and rebase.

Also allows for consumers who are extending the CLI to opt-out of the
unknown configuration check.

Signed-off-by: Andrew Harding <andrew.harding@hpe.com>
@azdagron azdagron merged commit 78db671 into spiffe:master Jul 8, 2020
@azdagron azdagron deleted the bail-on-unknown-config branch July 8, 2020 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Detection of invalid config option should be fatal Server and agent should detect unknown config options
2 participants