From 69f455808bb753075907bc92fc736e7c5a97371a Mon Sep 17 00:00:00 2001 From: Shang Yuanchun Date: Tue, 7 Jul 2020 22:36:37 +0800 Subject: [PATCH] Fix getting version of aliyun cli. (#1150) * Fix getting version of aliyun cli. It has a version sub command, and --version is used to specify product api version, not to get version of aliyun cli. * Change title of aliyun-cli --- images/linux/scripts/installers/aliyun-cli.sh | 2 +- images/win/scripts/SoftwareReport/SoftwareReport.Tools.psm1 | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/images/linux/scripts/installers/aliyun-cli.sh b/images/linux/scripts/installers/aliyun-cli.sh index e3e1ec14cdf5..0f44110df1d0 100644 --- a/images/linux/scripts/installers/aliyun-cli.sh +++ b/images/linux/scripts/installers/aliyun-cli.sh @@ -22,6 +22,6 @@ if ! command -v aliyun ; then fi # Document what was added to the image -aliyun_version="$(aliyun --version | grep "Alibaba Cloud Command Line Interface Version" | cut -d " " -f 7)" +aliyun_version="$(aliyun version)" echo "Lastly, documenting what we added to the metadata file" DocumentInstalledItem "Alibaba Cloud CLI ($aliyun_version)" \ No newline at end of file diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.Tools.psm1 b/images/win/scripts/SoftwareReport/SoftwareReport.Tools.psm1 index 14c7da764527..2a096ca157cc 100644 --- a/images/win/scripts/SoftwareReport/SoftwareReport.Tools.psm1 +++ b/images/win/scripts/SoftwareReport/SoftwareReport.Tools.psm1 @@ -163,9 +163,8 @@ function Get-AWSSAMVersion { } function Get-AlibabaCLIVersion { - $(aliyun --version | Select-String "Alibaba Cloud Command Line Interface") -match "(?\d+\.\d+\.\d+)" | Out-Null - $alicliVersion = $Matches.Version - return "Alibaba CLI $alicliVersion" + $alicliVersion = $(aliyun version) + return "Alibaba Cloud CLI $alicliVersion" } function Get-CloudFoundryVersion {