Giter Site home page Giter Site logo

Can't start or stop CHE instances about 2lcs HOT 5 CLOSED

torpede avatar torpede commented on June 1, 2024
Can't start or stop CHE instances

from 2lcs.

Comments (5)

petrjanikac avatar petrjanikac commented on June 1, 2024 2

I checked what parameters LCS currently sends on start/stop and compared to 2LCS and there is an extra parameter EnvironmentId. I did a quick test and after adding the EnvironmentId parameter, the start/stop action is already performed correctly.

internal async Task<bool> StartStopDeployment(CloudHostedInstance instance, string action)
{
    var parameters = $"{action}=&ActivityId={instance.ActivityId}&ProductName={WebUtility.UrlEncode(instance.ProductName)}&TopologyName={instance.TopologyName}&TopologyInstanceId={instance.InstanceId}&AzureSubscriptionId={instance.AzureSubscriptionId}&EnvironmentGroup=0&EnvironmentId={instance.EnvironmentId}";
    using (_stringContent = new StringContent(parameters, Encoding.UTF8, "application/x-www-form-urlencoded"))
    {
        SetRequestVerificationToken($"{LcsUrl}/V2");
        var result = await _httpClient.PostAsync($"{LcsUrl}/DeploymentPortal/StartStopDeployment/{LcsProjectId}", _stringContent);
        result.EnsureSuccessStatusCode();
        var responseBody = result.Content.ReadAsStringAsync().Result;
        return responseBody == "true";
    }
}

from 2lcs.

fandas-eu avatar fandas-eu commented on June 1, 2024

We observe the same behavior :-(

from 2lcs.

FH-Inway avatar FH-Inway commented on June 1, 2024

Thanks for reporting, I can reproduce a similar issue with version 0.43.0. For me, when trying to stop a CHE, I first get a dialog "Please login to LCS again. Your cookie probably expired". After I confirm with OK, the blank login form appears for a few seconds, then vanishes and the "Choose LCS project" form is shown instead.
I also tried logging out and in again, but that did not resolve the issue.

image

The error occurs here (line 713):

internal async Task<bool> StartStopDeployment(CloudHostedInstance instance, string action)
{
var parameters = $"{action}=&ActivityId={instance.ActivityId}&ProductName={WebUtility.UrlEncode(instance.ProductName)}&TopologyName={instance.TopologyName}&TopologyInstanceId={instance.InstanceId}&AzureSubscriptionId={instance.AzureSubscriptionId}&EnvironmentGroup=0";
using (_stringContent = new StringContent(parameters, Encoding.UTF8, "application/x-www-form-urlencoded"))
{
SetRequestVerificationToken($"{LcsUrl}/V2");
var result = await _httpClient.PostAsync($"{LcsUrl}/DeploymentPortal/StartStopDeployment/{LcsProjectId}", _stringContent);
result.EnsureSuccessStatusCode();
var responseBody = result.Content.ReadAsStringAsync().Result;
return responseBody == "true";
}
}

What happens is that the call to the LCS API returns a 500 status code (internal server error). /DeploymentPortal/StartStopDeployment is not part of the official LCS API to start/stop environments. This part of 2LCS was probably written before that API was available. It is also possible that the official API would not work with the 2LCS approach of authentication. My guess would be that Microsoft made changes to the /DeploymentPortal/StartStopDeployment part of the API.

@TomekMelissa This is a bit out of my wheel house. Do you know if /DeploymentPortal/StartStopDeployment can still be used and what changes we would have to make?

from 2lcs.

FH-Inway avatar FH-Inway commented on June 1, 2024

Awesome, thank you @petrjanikac . A new version with the fix is available in https://github.com/microsoft/2LCS/releases/tag/v.0.44.0.

from 2lcs.

torpede avatar torpede commented on June 1, 2024

Awesome indeed, thank you @petrjanikac for a fast fix. Verified that it works :)

from 2lcs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.