public ModuleFileLoadMetricsRecorder(ILldbModuleUtil moduleUtil, IModuleFileFinder moduleFileFinder, Metrics.IAction action) { this.moduleUtil = moduleUtil; this.moduleFileFinder = moduleFileFinder; this.action = action; }
public async Task EnableSshAsync(Gamelet gamelet, Metrics.IAction action) { var sshKey = await sshKeyLoader.LoadOrCreateAsync(); sshKnownHostsWriter.CreateOrUpdate(gamelet); action.UpdateEvent(new DeveloperLogEvent { GameletData = GameletData.FromGamelet(gamelet) }); // Try to optimistically connect, but only if we already have a key file. try { await remoteCommand.RunWithSuccessAsync(new SshTarget(gamelet), "/bin/true"); return; } catch (ProcessException e) { Trace.WriteLine("Optimistic SSH check failed; fallback to calling EnableSSH; " + "error: " + e.ToString()); } // Generate a new key, if necessary, and upload it to the gamelet. var gameletClient = gameletClientFactory.Create(cloudRunner.Intercept(action)); await gameletClient.EnableSshAsync(gamelet.Id, sshKey.PublicKey); }
public async Task DeployLldbServerAsync(SshTarget target, Metrics.IAction action) { DataRecorder record = new DataRecorder(action, DataRecorder.File.LLDB_SERVER); record.SetCopyAttempted(true); string localLldbServerPath = GetLldbServerPath(); string remotePath = Path.Combine(YetiConstants.LldbServerLinuxPath, YetiConstants.LldbServerLinuxExecutable); await DeployToTargetAsync(record, new NothingToCancel(), target, localLldbServerPath, YetiConstants.LldbServerLinuxPath); await SetRemoteExecutableBitAsync(target, remotePath, record); }
public async Task ExecuteCustomCommandAsync(IAsyncProject project, Gamelet gamelet, Metrics.IAction action) { DataRecorder record = new DataRecorder(action, DataRecorder.File.GAME_EXECUTABLE); record.Gamelet(gamelet); string customDeployCommand = await project.GetCustomDeployOnLaunchAsync(); bool attemptedCustomDeploy = !string.IsNullOrEmpty(customDeployCommand); record.SetAttemptedCustomCommand(attemptedCustomDeploy); if (attemptedCustomDeploy) { await CustomCommandAsync(project, gamelet, record, customDeployCommand); } }
public async Task DeployGameExecutableAsync(IAsyncProject project, SshTarget target, ICancelable task, Metrics.IAction action) { DataRecorder record = new DataRecorder(action, DataRecorder.File.GAME_EXECUTABLE); DeployOnLaunchSetting deploySetting = await GetDeployOnLaunchSettingAsync(project); if (deploySetting != DeployOnLaunchSetting.FALSE) { string localPath = await project.GetTargetPathAsync(); bool force = (deploySetting == DeployOnLaunchSetting.ALWAYS); await DeployToTargetAsync(record, task, target, localPath, YetiConstants.RemoteDeployPath, force); string targetName = Path.GetFileName(localPath); string remotePath = Path.Combine(YetiConstants.RemoteDeployPath, targetName); await SetRemoteExecutableBitAsync(target, remotePath, record); } else { record.SetCopyAttempted(false); record.SignatureCheckResult(BinarySignatureCheck.Types.Result.NoCopy); } }
public DataRecorder(Metrics.IAction action, File file) { _action = action; _file = file; }
public virtual IModuleFileLoadMetricsRecorder Create(Metrics.IAction action) { return(new ModuleFileLoadMetricsRecorder(moduleUtil, moduleFileFinder, action)); }