Don't print prelude in terminal mode (#3890)

We can't correctly print simple messages for prelude events when doing progress based display in a terminal, as it would lead to resetting the display of the table rendering.

This does mean that `--show-config` no longer works in the default terminal display mode - but it's not clear it *can* work correctly (at least as currently implemented) since it doesn't cleanly participate in the table rendering.

For cases where `--show-config` is not set (the norm) -nothing would have been printed anyway, so the changes here just avoid resetting the table rendering unnecessarily.

Fixes #3469.
This commit is contained in:
Luke Hoban 2020-02-07 12:44:22 -08:00 committed by GitHub
parent 060450395c
commit f6e37c25ad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 2 deletions

View file

@ -2,6 +2,9 @@ CHANGELOG
=========
## HEAD (unreleased)
- Avoid duplicated messages in preview/update progress display.
[#3890](https://github.com/pulumi/pulumi/pull/3890)
- Improve CPU utilization in the Python SDK when waiting for resource operations.
[#3892](https://github.com/pulumi/pulumi/pull/3892)

View file

@ -855,9 +855,21 @@ func (display *ProgressDisplay) processNormalEvent(event engine.Event) {
// A prelude event can just be printed out directly to the console.
// Note: we should probably make sure we don't get any prelude events
// once we start hearing about actual resource events.
payload := event.Payload.(engine.PreludeEventPayload)
display.writeSimpleMessage(renderPreludeEvent(payload, display.opts))
preludeEventString := renderPreludeEvent(payload, display.opts)
if display.isTerminal {
display.processNormalEvent(engine.Event{
Type: engine.DiagEvent,
Payload: engine.DiagEventPayload{
Ephemeral: false,
Severity: diag.Info,
Color: cmdutil.GetGlobalColorization(),
Message: preludeEventString,
},
})
} else {
display.writeSimpleMessage(preludeEventString)
}
return
case engine.SummaryEvent:
// keep track of the summar event so that we can display it after all other