Skip to content

Commit d6bbabb

Browse files
authored
Merge pull request #12 from vmware-labs/fix-drivers-downloads
fix drivers download
2 parents 8b27de8 + db62530 commit d6bbabb

File tree

5 files changed

+45
-10
lines changed

5 files changed

+45
-10
lines changed

cmd/docs.go

+7-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ const (
1414
getVersions = ` # List of available versions of sub-products vmtools of vmware_tools
1515
vcc get versions -p vmware_tools -s vmtools`
1616

17-
getMajorVersions = ` # List of available major versions of product vmware_tools
18-
vcc get versions -p vmware_tools`
17+
getMajorVersions = ` # List of available major versions of product vmware_tools.
18+
# Only used with download types: drivers_tools, custom_isos and addons
19+
vcc get majorversions -p vmware_tools`
1920

2021
getFiles = ` # List of available files of version 11.3.0 of vmware_tools
2122
vcc get files -p vmware_tools -s vmtools -v 11.3.0`
@@ -27,6 +28,10 @@ const (
2728
# If using a * in the filename value, make sure to wrap the text in single quotes on linux/macos
2829
vcc download -p vmware_tools -s vmtools -v 11.* -f 'VMware-Tools-darwin-*.zip' --accepteula
2930
31+
# To download from from drivers_tools, custom_iso and addons, you must add -t <download type>.
32+
# Version can be globbed, as 1 subproduct maps to 1 version, but make sure to wrap the * in a speech mark.
33+
vcc download -p vmware_vsphere -t drivers_tools -s vs-mgmt-sdk80u2 -v '*' -f VMware-vSphere-SDK-*.zip --accepteula
34+
3035
# Download files using a manifest file
3136
# Show an example manifest using 'vcc get manifestexample'
3237
vcc download -m manifest.yml --accepteula`

cmd/major_versions.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ var majorVersionsSlug string
1616
var MajorVersionsCmd = &cobra.Command{
1717
Use: "majorversions",
1818
Aliases: []string{"v"},
19-
Short: "List available majors versions",
19+
Short: "List available majors versions (for driver_tools, custom_iso, addons)",
2020
Long: "List available major versions to help query drives_tools, custom_isos and addons",
2121
Example: getMajorVersions,
2222
Run: func(cmd *cobra.Command, args []string) {

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ require (
88
github.com/orirawlings/persistent-cookiejar v0.3.2
99
github.com/spf13/cobra v1.8.0
1010
github.com/stretchr/testify v1.8.1
11-
github.com/vmware-labs/vmware-customer-connect-sdk v0.0.0-20231208115351-81519e7588c7
11+
github.com/vmware-labs/vmware-customer-connect-sdk v0.0.0-20231212133750-ad52df1677f3
1212
gopkg.in/yaml.v3 v3.0.1
1313
)
1414

go.sum

+2
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ github.com/vmware-labs/vmware-customer-connect-sdk v0.0.0-20231207154734-713cae3
125125
github.com/vmware-labs/vmware-customer-connect-sdk v0.0.0-20231207154734-713cae36dd56/go.mod h1:DqQ9L5crjmVDoeoNNc4VJ4xZapfKfKcq7p2z5u9n7Os=
126126
github.com/vmware-labs/vmware-customer-connect-sdk v0.0.0-20231208115351-81519e7588c7 h1:LHS5Z0/6ssDwAQQV7iK9jqDcs6R/0BCDfBmLjdRDX0k=
127127
github.com/vmware-labs/vmware-customer-connect-sdk v0.0.0-20231208115351-81519e7588c7/go.mod h1:DqQ9L5crjmVDoeoNNc4VJ4xZapfKfKcq7p2z5u9n7Os=
128+
github.com/vmware-labs/vmware-customer-connect-sdk v0.0.0-20231212133750-ad52df1677f3 h1:faIXOAHZfikmnJBUNcHj7kwIU9ByEQnOB4QwxNWNI7s=
129+
github.com/vmware-labs/vmware-customer-connect-sdk v0.0.0-20231212133750-ad52df1677f3/go.mod h1:DqQ9L5crjmVDoeoNNc4VJ4xZapfKfKcq7p2z5u9n7Os=
128130
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
129131
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
130132
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=

test/bats/download.bats

+34-6
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,49 @@ teardown() {
1616
echo ""
1717
}
1818

19-
@test "download single file successfully to temp" {
19+
@test "download driver file successfully to temp" {
2020
$VCC_CMD logout
2121
rm -f $TEMP_DIR/*
22-
local cmd="$VCC_CMD download -p vmware_horizon_clients -s cart+andrd_x8632 -v 2106 -f VMware-Horizon-Client-AndroidOS-x86-*-store.apk --accepteula -o $TEMP_DIR"
23-
echo $cmd
24-
run $cmd
22+
# command cannot be stored as a variable because bats does not properly process the speech mark needed for the -v flag
23+
run $VCC_CMD download -p vmware_vsphere -t drivers_tools -s vs-mgmt-sdk80u2 -v '*' -f VMware-vSphere-SDK-*.zip --accepteula -o $TEMP_DIR
2524
echo "$output"
2625
[[ "$output" != *"No output directory set."* ]]
2726
[[ "$output" == *"Collecting download payload"* ]]
2827
[[ "$output" == *"Download started to"* ]]
2928
[[ "$output" == *"Download finished"* ]]
3029
[ "$status" -eq 0 ]
31-
[ -f $TEMP_DIR/VMware-Horizon-Client-*.apk ]
30+
[ -f $TEMP_DIR/VMware-vSphere-SDK-*.zip ]
3231
}
3332

34-
@test "download driver file successfully to temp" {
33+
@test "download iso file successfully to temp" {
34+
$VCC_CMD logout
35+
rm -f $TEMP_DIR/*
36+
# command cannot be stored as a variable because bats does not properly process the speech mark needed for the -v flag
37+
run $VCC_CMD download -p vmware_vsphere -t custom_iso -s oem-esxi80u2-hitachi -v '*' -f VMware-ESXi-*.iso --accepteula -o $TEMP_DIR
38+
echo "$output"
39+
[[ "$output" != *"No output directory set."* ]]
40+
[[ "$output" == *"Collecting download payload"* ]]
41+
[[ "$output" == *"Download started to"* ]]
42+
[[ "$output" == *"Download finished"* ]]
43+
[ "$status" -eq 0 ]
44+
[ -f $TEMP_DIR/VMware-ESXi-*.iso ]
45+
}
46+
47+
@test "download addon file successfully to temp" {
48+
$VCC_CMD logout
49+
rm -f $TEMP_DIR/*
50+
# command cannot be stored as a variable because bats does not properly process the speech mark needed for the -v flag
51+
run $VCC_CMD download -p vmware_vsphere -t addons -s addon_esxi80u2_hitachi -v '*' -f VMware-ESXi-8.0*.zip --accepteula -o $TEMP_DIR
52+
echo "$output"
53+
[[ "$output" != *"No output directory set."* ]]
54+
[[ "$output" == *"Collecting download payload"* ]]
55+
[[ "$output" == *"Download started to"* ]]
56+
[[ "$output" == *"Download finished"* ]]
57+
[ "$status" -eq 0 ]
58+
[ -f $TEMP_DIR/VMware-ESXi-8.0*.zip ]
59+
}
60+
61+
@test "download single file successfully to temp" {
3562
$VCC_CMD logout
3663
rm -f $TEMP_DIR/*
3764
local cmd="$VCC_CMD download -p vmware_horizon_clients -s cart+andrd_x8632 -v 2106 -f VMware-Horizon-Client-AndroidOS-x86-*-store.apk --accepteula -o $TEMP_DIR"
@@ -46,6 +73,7 @@ teardown() {
4673
[ -f $TEMP_DIR/VMware-Horizon-Client-*.apk ]
4774
}
4875

76+
4977
@test "re-download single file successfully to temp" {
5078
$VCC_CMD logout
5179
rm -f $TEMP_DIR/*

0 commit comments

Comments
 (0)