public override HttpHandlerResult Get() { var sessionId = GetQuery("session"); try { if (!PhotonServer.Instance.Sessions.TryGet(sessionId, out var session)) { return(Response.BadRequest().SetText($"Server Session '{sessionId}' was not found!")); } if (!(session is ServerDeploySession deploySession)) { throw new Exception($"Session '{sessionId}' is not a valid deploy session!"); } var response = new HttpDeployResultResponse { Result = deploySession.Result, }; return(Response.Json(response)); } catch (Exception error) { return(Response.Exception(error)); } }
public async Task Run(CommandContext context) { var server = context.Servers.Get(ServerName); HttpSessionStartResponse startResult = null; await AuthRetryAsync(async() => { startResult = await StartSession(server); }); var sessionId = startResult?.SessionId; if (string.IsNullOrEmpty(sessionId)) { throw new ApplicationException($"An invalid session-id was returned! [{sessionId}]"); } var position = 0; while (true) { var data = await UpdateOutput(server, sessionId, position); if (data == null) { throw new ApplicationException("An empty session-output response was returned!"); } if (data.IsComplete) { break; } if (!data.IsModified) { await Task.Delay(PollIntervalMs); continue; } position = data.NewLength; ConsoleEx.Out.WriteLine(data.NewText, ConsoleColor.Gray); } Result = await GetResult(server, sessionId); }