@@ -647,24 +647,29 @@ func (v *MachineVM) SSH(name string, opts machine.SSHOptions) error {
647
647
return cmd .Run ()
648
648
}
649
649
650
- // SSHocker does a reverse sshfs mount over a SSH connection.
651
- func (v * MachineVM ) SSHocker (name string , source , target string , readonly bool ) error {
652
- volumeDefinition := source + ":" + target
653
- if readonly {
654
- volumeDefinition += ":ro"
655
- }
656
-
650
+ func (v * MachineVM ) sshConfig () string {
657
651
config := fmt .Sprintf ("Host %s\n " , v .Name )
658
652
config += fmt .Sprintf (" IdentityFile %s\n " , v .IdentityPath )
659
653
config += fmt .Sprintf (" User %s\n " , v .RemoteUsername )
660
654
config += fmt .Sprintf (" Hostname %s\n " , "localhost" )
661
655
config += fmt .Sprintf (" Port %d\n " , v .Port )
662
656
config += fmt .Sprintf (" UserKnownHostsFile %s\n " , "/dev/null" )
663
657
config += fmt .Sprintf (" StrictHostKeyChecking %s\n " , "no" )
658
+ return config
659
+ }
660
+
661
+ // SSHocker does a reverse sshfs mount over a SSH connection.
662
+ func (v * MachineVM ) SSHocker (name string , source , target string , readonly bool ) error {
663
+ volumeDefinition := source + ":" + target
664
+ if readonly {
665
+ volumeDefinition += ":ro"
666
+ }
667
+
664
668
vmConfigDir , err := machine .GetConfDir (vmtype )
665
669
if err != nil {
666
670
return err
667
671
}
672
+ config := v .sshConfig ()
668
673
sshConfigFile := filepath .Join (vmConfigDir , v .Name + ".config" )
669
674
err = ioutil .WriteFile (sshConfigFile , []byte (config ), 0666 )
670
675
if err != nil {
0 commit comments