Skip to content

Instantly share code, notes, and snippets.

@eecsmap
Created April 3, 2024 19:19
Show Gist options
  • Save eecsmap/edb9f533ca55ba1735ab20d30ce03569 to your computer and use it in GitHub Desktop.
Save eecsmap/edb9f533ca55ba1735ab20d30ce03569 to your computer and use it in GitHub Desktop.
diff --git a/internal/command/create/vm.go b/internal/command/create/vm.go
index d9ef9dd..b025272 100644
--- a/internal/command/create/vm.go
+++ b/internal/command/create/vm.go
@@ -3,11 +3,12 @@ package create
import (
"errors"
"fmt"
+ "os"
+ "strings"
+
"github.com/cirruslabs/orchard/pkg/client"
v1 "github.com/cirruslabs/orchard/pkg/resource/v1"
"github.com/spf13/cobra"
- "os"
- "strings"
)
var ErrVMFailed = errors.New("failed to create VM")
@@ -23,6 +24,8 @@ var restartPolicy string
var startupScript string
var hostDirsRaw []string
var imagePullPolicy string
+var userName string
+var password string
func newCreateVMCommand() *cobra.Command {
command := &cobra.Command{
@@ -53,6 +56,8 @@ func newCreateVMCommand() *cobra.Command {
fmt.Sprintf("image pull policy for this VM, by default the image is only pulled if it doesn't "+
"exist in the cache (%q), specify %q to always try to pull the image",
v1.ImagePullPolicyIfNotPresent, v1.ImagePullPolicyAlways))
+ command.PersistentFlags().StringVar(&userName, "username", "", "VM login user")
+ command.PersistentFlags().StringVar(&password, "password", "", "VM login password")
return command
}
@@ -83,6 +88,8 @@ func runCreateVM(cmd *cobra.Command, args []string) error {
NetBridged: netBridged,
Headless: headless,
HostDirs: hostDirs,
+ Username: userName,
+ Password: password,
}
// Convert resources
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment