Ejemplo n.º 1
0
 public ModuleFileLoadMetricsRecorder(ILldbModuleUtil moduleUtil,
                                      IModuleFileFinder moduleFileFinder, Metrics.IAction action)
 {
     this.moduleUtil       = moduleUtil;
     this.moduleFileFinder = moduleFileFinder;
     this.action           = action;
 }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        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);
            }
        }
Ejemplo n.º 5
0
        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);
            }
        }
Ejemplo n.º 6
0
 public DataRecorder(Metrics.IAction action, File file)
 {
     _action = action;
     _file   = file;
 }
Ejemplo n.º 7
0
 public virtual IModuleFileLoadMetricsRecorder Create(Metrics.IAction action)
 {
     return(new ModuleFileLoadMetricsRecorder(moduleUtil, moduleFileFinder, action));
 }