66
77 "github.com/containers/podman-bootc/pkg/bootc"
88 "github.com/containers/podman-bootc/pkg/config"
9+ "github.com/containers/podman-bootc/pkg/credentials"
910 "github.com/containers/podman-bootc/pkg/user"
1011 "github.com/containers/podman-bootc/pkg/utils"
1112 "github.com/containers/podman-bootc/pkg/vm"
@@ -19,7 +20,6 @@ type osVmConfig struct {
1920 CloudInitDir string
2021 KsFile string
2122 Background bool
22- NoCredentials bool
2323 RemoveVm bool // Kill the running VM when it exits
2424 RemoveDiskImage bool // After exit of the VM, remove the disk image
2525 Quiet bool
@@ -47,7 +47,6 @@ func init() {
4747 runCmd .Flags ().StringVar (& vmConfig .CloudInitDir , "cloudinit" , "" , "--cloudinit <cloud-init data directory>" )
4848
4949 runCmd .Flags ().StringVar (& diskImageConfigInstance .Filesystem , "filesystem" , "" , "Override the root filesystem (e.g. xfs, btrfs, ext4)" )
50- runCmd .Flags ().BoolVar (& vmConfig .NoCredentials , "no-creds" , false , "Do not inject default SSH key via credentials; also implies --background" )
5150 runCmd .Flags ().BoolVarP (& vmConfig .Background , "background" , "B" , false , "Do not spawn SSH, run in background" )
5251 runCmd .Flags ().BoolVar (& vmConfig .RemoveVm , "rm" , false , "Remove the VM and it's disk when the SSH session exits. Cannot be used with --background" )
5352 runCmd .Flags ().BoolVar (& vmConfig .Quiet , "quiet" , false , "Suppress output from bootc disk creation and VM boot console" )
@@ -104,16 +103,20 @@ func doRun(flags *cobra.Command, args []string) error {
104103 }
105104 }()
106105
106+ sSHIdentityPath , err := credentials .Generatekeys (bootcVM .CacheDir ())
107+ if err != nil {
108+ return fmt .Errorf ("unable to generate ssh key: %w" , err )
109+ }
110+
107111 cmd := args [1 :]
108112 err = bootcVM .Run (vm.RunVMParameters {
109113 Cmd : cmd ,
110114 CloudInitDir : vmConfig .CloudInitDir ,
111- NoCredentials : vmConfig .NoCredentials ,
112115 CloudInitData : flags .Flags ().Changed ("cloudinit" ),
113116 RemoveVm : vmConfig .RemoveVm ,
114117 Background : vmConfig .Background ,
115118 SSHPort : sshPort ,
116- SSHIdentity : machine . SSHIdentityPath ,
119+ SSHIdentity : sSHIdentityPath ,
117120 VMUser : vmConfig .User ,
118121 })
119122
0 commit comments