generate Shutdown command docs from strutc & use in hyperv

This commit is contained in:
Adrien Delorme 2019-06-14 12:43:12 +02:00
parent c11ef90cb6
commit 425ad1c67e
3 changed files with 36 additions and 26 deletions

View File

@ -1,3 +1,5 @@
//go:generate struct-markdown
package shutdowncommand
import (
@ -8,19 +10,19 @@ import (
)
type ShutdownConfig struct {
// The command to use to gracefully shut down
// the machine once all provisioning is complete. By default this is an
// empty string, which tells Packer to just forcefully shut down the
// machine. This setting can be safely omitted if for example, a shutdown
// command to gracefully halt the machine is configured inside a
// provisioning script. If one or more scripts require a reboot it is
// suggested to leave this blank (since reboots may fail) and instead
// specify the final shutdown command in your last script.
// The command to use to gracefully shut down the machine once all
// provisioning is complete. By default this is an empty string, which
// tells Packer to just forcefully shut down the machine. This setting can
// be safely omitted if for example, a shutdown command to gracefully halt
// the machine is configured inside a provisioning script. If one or more
// scripts require a reboot it is suggested to leave this blank (since
// reboots may fail) and instead specify the final shutdown command in your
// last script.
ShutdownCommand string `mapstructure:"shutdown_command" required:"false"`
// The amount of time to wait after executing
// the shutdown_command for the virtual machine to actually shut down.
// If the machine doesn't shut down in this time it is considered an
// error. By default, the time out is "5m" (five minutes).
// The amount of time to wait after executing the shutdown_command for the
// virtual machine to actually shut down. If the machine doesn't shut down
// in this time it is considered an error. By default, the time out is "5m"
// (five minutes).
RawShutdownTimeout string `mapstructure:"shutdown_timeout" required:"false"`
ShutdownTimeout time.Duration ``

View File

@ -80,20 +80,6 @@ builder.
created, must be empty prior to running the builder. By default this is
"output-BUILDNAME" where "BUILDNAME" is the name of the build.
- `shutdown_command` (string) - The command to use to gracefully shut down
the machine once all provisioning is complete. By default this is an
empty string, which tells Packer to just forcefully shut down the
machine. This setting can be safely omitted if for example, a shutdown
command to gracefully halt the machine is configured inside a
provisioning script. If one or more scripts require a reboot it is
suggested to leave this blank (since reboots may fail) and instead
specify the final shutdown command in your last script.
- `shutdown_timeout` (string) - The amount of time to wait after executing
the `shutdown_command` for the virtual machine to actually shut down.
If the machine doesn't shut down in this time it is considered an
error. By default, the time out is "5m" (five minutes).
<%= partial "partials/builder/hyperv/iso/Config-not-required" %>
## Http directory configuration reference
@ -103,6 +89,12 @@ builder.
<%= partial "partials/common/HTTPConfig-not-required" %>
## Shutdown configuration reference
### Optional:
<%= partial "partials/common/shutdowncommand/ShutdownConfig-not-required" %>
## Floppy configuration reference
<%= partial "partials/common/FloppyConfig" %>

View File

@ -0,0 +1,16 @@
<!-- Code generated from the comments of the ShutdownConfig struct in common/shutdowncommand/config.go; DO NOT EDIT MANUALLY -->
- `shutdown_command` (string) - The command to use to gracefully shut down
the machine once all provisioning is complete. By default this is an
empty string, which tells Packer to just forcefully shut down the
machine. This setting can be safely omitted if for example, a shutdown
command to gracefully halt the machine is configured inside a
provisioning script. If one or more scripts require a reboot it is
suggested to leave this blank (since reboots may fail) and instead
specify the final shutdown command in your last script.
- `shutdown_timeout` (string) - The amount of time to wait after executing
the shutdown_command for the virtual machine to actually shut down.
If the machine doesn't shut down in this time it is considered an
error. By default, the time out is "5m" (five minutes).