mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-23 20:36:33 +01:00
CP-13124: Use SSH private key for docker guest VM authentication.
1. Specify the key file location and name. 2. Update of the file name of docker command. Signed-off-by: Hui Zhang <hui.zhang@citrix.com>
This commit is contained in:
parent
784804c8d8
commit
c5d9445684
@ -1822,12 +1822,21 @@ namespace XenAdmin.TabPages
|
||||
try
|
||||
{
|
||||
//Write docker command to a temp file.
|
||||
string cmdFile = Path.Combine(Path.GetTempPath(), "cmdXSContainer.txt");
|
||||
string cmdFile = Path.Combine(Path.GetTempPath(), "ContainerManagementCommand.txt");
|
||||
File.WriteAllText(cmdFile, command);
|
||||
|
||||
//Invoke Putty, SSH to VM and execute docker command.
|
||||
var puttyPath = Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "putty.exe");
|
||||
var startInfo = new ProcessStartInfo(puttyPath, "-m " + cmdFile + " -t " + ipAddr);
|
||||
string args = "-m " + cmdFile + " -t " + ipAddr;
|
||||
|
||||
//Specify the key for SSH connection.
|
||||
var keyFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "ContainerManagement.ppk");
|
||||
if (File.Exists(keyFile))
|
||||
{
|
||||
args = args + " -i " + keyFile;
|
||||
}
|
||||
var startInfo = new ProcessStartInfo(puttyPath, args);
|
||||
|
||||
Process.Start(startInfo);
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
Loading…
Reference in New Issue
Block a user