From cc3389de89dcbda37e36ca717acebd8ab9afd4f1 Mon Sep 17 00:00:00 2001 From: Shenglong Li Date: Tue, 31 May 2022 13:25:10 -0700 Subject: [PATCH 1/3] Fix bicep build --stdout --- src/azure-cli/azure/cli/command_modules/resource/custom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/resource/custom.py b/src/azure-cli/azure/cli/command_modules/resource/custom.py index 5aa6332713b..e1cfee3167f 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/custom.py +++ b/src/azure-cli/azure/cli/command_modules/resource/custom.py @@ -3678,10 +3678,10 @@ def build_bicep_file(cmd, file, stdout=None, outdir=None, outfile=None, no_resto args += ["--outdir", outdir] if outfile: args += ["--outfile", outfile] - if stdout: - args += ["--stdout"] if no_restore: args += ["--no-restore"] + if stdout: + args += ["--stdout"] print(run_bicep_command(args)) return run_bicep_command(args) From f6f228f1b16020c78c5d3fe3226a80d6e80d7d5c Mon Sep 17 00:00:00 2001 From: Shenglong Li Date: Tue, 31 May 2022 14:35:24 -0700 Subject: [PATCH 2/3] Only call run_bicep_command once --- .../azure/cli/command_modules/resource/custom.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/resource/custom.py b/src/azure-cli/azure/cli/command_modules/resource/custom.py index e1cfee3167f..1a4d17a5f56 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/custom.py +++ b/src/azure-cli/azure/cli/command_modules/resource/custom.py @@ -3682,9 +3682,11 @@ def build_bicep_file(cmd, file, stdout=None, outdir=None, outfile=None, no_resto args += ["--no-restore"] if stdout: args += ["--stdout"] - print(run_bicep_command(args)) - return - run_bicep_command(args) + + output = run_bicep_command(args) + + if stdout: + print(output) def publish_bicep_file(cmd, file, target): From 2078b9a1a816e52f3e9c7464d57bea7d4827d0c1 Mon Sep 17 00:00:00 2001 From: Shenglong Li Date: Tue, 31 May 2022 14:52:41 -0700 Subject: [PATCH 3/3] Fix style --- src/azure-cli/azure/cli/command_modules/resource/custom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/azure-cli/azure/cli/command_modules/resource/custom.py b/src/azure-cli/azure/cli/command_modules/resource/custom.py index 1a4d17a5f56..1f5dcce6fe5 100644 --- a/src/azure-cli/azure/cli/command_modules/resource/custom.py +++ b/src/azure-cli/azure/cli/command_modules/resource/custom.py @@ -3684,7 +3684,7 @@ def build_bicep_file(cmd, file, stdout=None, outdir=None, outfile=None, no_resto args += ["--stdout"] output = run_bicep_command(args) - + if stdout: print(output)