public override void Initialize(IHostContext hostContext) { ArgUtil.NotNull(hostContext, nameof(hostContext)); base.Initialize(hostContext); Trace.Verbose("Creating _store"); _store = hostContext.GetService <IConfigurationStore>(); Trace.Verbose("store created"); _term = hostContext.GetService <ITerminal>(); _locationServer = hostContext.GetService <ILocationServer>(); _serverUtil = new ServerUtil(); }
public override void Initialize(IHostContext hostContext) { ArgUtil.NotNull(hostContext, nameof(hostContext)); base.Initialize(hostContext); _terminal = hostContext.GetService <ITerminal>(); _agentServer = HostContext.GetService <IAgentServer>(); var configStore = HostContext.GetService <IConfigurationStore>(); var settings = configStore.GetSettings(); _poolId = settings.PoolId; _agentId = settings.AgentId; _serverUrl = settings.ServerUrl; var credManager = HostContext.GetService <ICredentialManager>(); _creds = credManager.LoadCredentials(); _locationServer = HostContext.GetService <ILocationServer>(); _hashValidationDisabled = AgentKnobs.DisableHashValidation.GetValue(_knobContext).AsBoolean(); }
/// <summary> /// Determine server deployment type based on connection data (Hosted/OnPremises) if it has not been determined yet. /// </summary> public async Task DetermineDeploymentType(string serverUrl, VssCredentials credentials, ILocationServer locationServer) { // Check if deployment type has not been determined yet if (_deploymentType == DeploymentFlags.None) { // Determine the service deployment type based on connection data. (Hosted/OnPremises) var connectionData = await GetConnectionData(serverUrl, credentials, locationServer); _deploymentType = connectionData.DeploymentType; } }
private async Task <Location.ConnectionData> GetConnectionData(string serverUrl, VssCredentials credentials, ILocationServer locationServer) { VssConnection connection = VssUtil.CreateConnection(new Uri(serverUrl), credentials, trace: _trace); await locationServer.ConnectAsync(connection); return(await locationServer.GetConnectionDataAsync()); }