From b6d61ec35ed5ad2249b97c1654a8074981dc6daa Mon Sep 17 00:00:00 2001 From: Fraser Waters Date: Wed, 23 Nov 2022 17:37:44 +0000 Subject: [PATCH] Don't print the update plan message if using --json --- ...nt-print-update-plan-message-with-json.yaml | 4 ++++ pkg/cmd/pulumi/preview.go | 18 ++++++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) create mode 100644 changelog/pending/20221123--cli--dont-print-update-plan-message-with-json.yaml diff --git a/changelog/pending/20221123--cli--dont-print-update-plan-message-with-json.yaml b/changelog/pending/20221123--cli--dont-print-update-plan-message-with-json.yaml new file mode 100644 index 000000000000..7f0d6e1d298b --- /dev/null +++ b/changelog/pending/20221123--cli--dont-print-update-plan-message-with-json.yaml @@ -0,0 +1,4 @@ +changes: +- type: fix + scope: cli + description: Don't print update plan message with --json. diff --git a/pkg/cmd/pulumi/preview.go b/pkg/cmd/pulumi/preview.go index 4e6e995729f8..1b22cd3e920b 100644 --- a/pkg/cmd/pulumi/preview.go +++ b/pkg/cmd/pulumi/preview.go @@ -261,14 +261,16 @@ func newPreviewCmd() *cobra.Command { return result.FromError(err) } - // Write out message on how to use the plan - var buf bytes.Buffer - fprintf(&buf, "Update plan written to '%s'", planFilePath) - fprintf( - &buf, - "\nRun `pulumi up --plan='%s'` to constrain the update to the operations planned by this preview", - planFilePath) - cmdutil.Diag().Infof(diag.RawMessage("" /*urn*/, buf.String())) + // Write out message on how to use the plan (if not writing out --json) + if !jsonDisplay { + var buf bytes.Buffer + fprintf(&buf, "Update plan written to '%s'", planFilePath) + fprintf( + &buf, + "\nRun `pulumi up --plan='%s'` to constrain the update to the operations planned by this preview", + planFilePath) + cmdutil.Diag().Infof(diag.RawMessage("" /*urn*/, buf.String())) + } } return nil }