public PNetPowerShell GetPower(string hostName) { if (_power is null) { _power = new PNetPowerShell(hostName, "root", null); //remote } return(_power); }
public LinuxNodeService(IOptions <HypervCsiDriverOptions> options) { _options = options.Value; if (string.IsNullOrEmpty(_options.HostName)) //local { _power = new PNetPowerShell(); } else //remote for debug { _power = new PNetPowerShell(_options.HostName, _options.UserName, _options.KeyFile); } }
public LinuxNodeService(IOptions <HypervCsiDriverOptions> options, ILogger <LinuxNodeService>?logger) { _logger = logger ?? (ILogger)NullLogger.Instance; _options = options.Value; if (string.IsNullOrEmpty(_options.HostName)) //local { _power = new PNetPowerShell(); } else //remote for debug { _power = new PNetPowerShell(_options.HostName, _options.UserName, _options.KeyFile); } }
public async Task redirect_stderr_from_local_native_commands() { var power = new PNetPowerShell(); Command cmd; var commands = new List <Command>(2); cmd = new Command("& more -? 2>&1", true); commands.Add(cmd); var results = await power.InvokeAsync(commands) .ToListAsync(); Assert.NotEmpty(results); Assert.Equal("Cannot access file -?", results.Last()); }
public async Task throw_on_errors_from_local_native_commands() { var power = new PNetPowerShell(); Command cmd; var commands = new List <Command>(2); cmd = new Command("& more -?", true); commands.Add(cmd); await Assert.ThrowsAsync <System.Management.Automation.RemoteException>(async() => { var result = await power.InvokeAsync(commands).ThrowOnError() .FirstOrDefaultAsync(); }); }
public LinuxNodeService(string hostName, string userName, string?keyFile = null, ILogger <LinuxNodeService>?logger = null) { _logger = logger ?? (ILogger)NullLogger.Instance; _power = new PNetPowerShell(hostName, userName, keyFile); //remote }
public HypervHost(string hostName, string userName, string keyFile = null) { _power = new PNetPowerShell(hostName, userName, keyFile); _hostName = hostName; }
public LinuxNodeService(string hostName, string userName, string keyFile = null) { _power = new PNetPowerShell(hostName, userName, keyFile); //remote }