Skip to content

Commit cbad7ca

Browse files
committed
govc: validate library.deploy arguments
- add example of using library.export to generate options.json Fixes #2599 Fixes #2598
1 parent d99e995 commit cbad7ca

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

govc/library/deploy.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,16 @@ func (cmd *deploy) Description() string {
8888
8989
Examples:
9090
govc library.deploy /library_name/ovf_template vm_name
91-
govc library.deploy /library_name/ovf_template -options deploy.json`
91+
govc library.export /library_name/ovf_template/*.ovf # save local copy of .ovf
92+
govc import.spec *.ovf > deploy.json # generate options from .ovf
93+
# edit deploy.json as needed
94+
govc library.deploy -options deploy.json /library_name/ovf_template`
9295
}
9396

9497
func (cmd *deploy) Run(ctx context.Context, f *flag.FlagSet) error {
98+
if f.NArg() > 2 {
99+
return flag.ErrHelp
100+
}
95101
path := f.Arg(0)
96102
name := f.Arg(1)
97103

govc/test/library.bats

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,9 @@ load test_helper
221221
}
222222
EOF
223223

224+
run govc library.deploy "my-content/$TTYLINUX_NAME" -options "$BATS_TMPDIR/ttylinux.json"
225+
assert_failure # see issue #2599
226+
224227
run govc library.deploy -options "$BATS_TMPDIR/ttylinux.json" "my-content/$TTYLINUX_NAME"
225228
assert_success
226229
rm "$BATS_TMPDIR/ttylinux.json"

0 commit comments

Comments
 (0)