mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-16 18:47:57 -05:00
Fix Sql Auth for Migration Assessments (#1182)
* pass connection string to dma engine * cleanup * remove optional parameter * modified query
This commit is contained in:
@@ -55,9 +55,13 @@ SELECT @filepath AS FilePath
|
|||||||
SELECT [name], [description], [endpoint], [protocol_desc] FROM .[sys].[dm_cluster_endpoints]
|
SELECT [name], [description], [endpoint], [protocol_desc] FROM .[sys].[dm_cluster_endpoints]
|
||||||
END TRY
|
END TRY
|
||||||
BEGIN CATCH
|
BEGIN CATCH
|
||||||
DECLARE @endpoint VARCHAR(max)
|
DECLARE @endpoint VARCHAR(MAX)
|
||||||
select @endpoint = CONVERT(VARCHAR(max),SERVERPROPERTY('ControllerEndpoint'))
|
SELECT @endpoint = CONVERT(VARCHAR(MAX),SERVERPROPERTY('ControllerEndpoint'))
|
||||||
|
-- If the endpoint is empty/null then return 0 rows (we don't have any cluster endpoints)
|
||||||
|
IF @endpoint <> ''
|
||||||
SELECT 'controller' AS name, 'Cluster Management Service' AS description, @endpoint as endpoint, SUBSTRING(@endpoint, 0, CHARINDEX(':', @endpoint))
|
SELECT 'controller' AS name, 'Cluster Management Service' AS description, @endpoint as endpoint, SUBSTRING(@endpoint, 0, CHARINDEX(':', @endpoint))
|
||||||
|
ELSE
|
||||||
|
SELECT TOP 0 ''
|
||||||
END CATCH
|
END CATCH
|
||||||
";
|
";
|
||||||
public const string GetHostInfo = @"SELECT [host_platform], [host_distribution], [host_release], [host_service_pack_level], [host_sku], [os_language_version] FROM sys.dm_os_host_info";
|
public const string GetHostInfo = @"SELECT [host_platform], [host_distribution], [host_release], [host_service_pack_level], [host_sku], [os_language_version] FROM sys.dm_os_host_info";
|
||||||
|
|||||||
@@ -119,7 +119,6 @@ namespace Microsoft.SqlTools.ServiceLayer.Migration
|
|||||||
await ConnectionService.Connect(connectParams);
|
await ConnectionService.Connect(connectParams);
|
||||||
|
|
||||||
var connection = await ConnectionService.Instance.GetOrOpenConnection(randomUri, ConnectionType.Default);
|
var connection = await ConnectionService.Instance.GetOrOpenConnection(randomUri, ConnectionType.Default);
|
||||||
|
|
||||||
var serverInfo = ReliableConnectionHelper.GetServerVersion(connection);
|
var serverInfo = ReliableConnectionHelper.GetServerVersion(connection);
|
||||||
var hostInfo = ReliableConnectionHelper.GetServerHostInfo(connection);
|
var hostInfo = ReliableConnectionHelper.GetServerHostInfo(connection);
|
||||||
|
|
||||||
@@ -136,8 +135,8 @@ namespace Microsoft.SqlTools.ServiceLayer.Migration
|
|||||||
};
|
};
|
||||||
|
|
||||||
var db = SqlAssessmentService.GetDatabaseLocator(server, connection.Database);
|
var db = SqlAssessmentService.GetDatabaseLocator(server, connection.Database);
|
||||||
|
var connectionString = ConnectionService.BuildConnectionString(connInfo.ConnectionDetails);
|
||||||
var results = await GetAssessmentItems(server);
|
var results = await GetAssessmentItems(server, connectionString);
|
||||||
var result = new MigrationAssessmentResult();
|
var result = new MigrationAssessmentResult();
|
||||||
result.Items.AddRange(results);
|
result.Items.AddRange(results);
|
||||||
await requestContext.SendResult(result);
|
await requestContext.SendResult(result);
|
||||||
@@ -179,9 +178,9 @@ namespace Microsoft.SqlTools.ServiceLayer.Migration
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal async Task<List<MigrationAssessmentInfo>> GetAssessmentItems(SqlObjectLocator target)
|
internal async Task<List<MigrationAssessmentInfo>> GetAssessmentItems(SqlObjectLocator target, string connectionString)
|
||||||
{
|
{
|
||||||
DmaEngine engine = new DmaEngine(target);
|
DmaEngine engine = new DmaEngine(connectionString);
|
||||||
var assessmentResults = await engine.GetTargetAssessmentResultsList();
|
var assessmentResults = await engine.GetTargetAssessmentResultsList();
|
||||||
|
|
||||||
var result = new List<MigrationAssessmentInfo>();
|
var result = new List<MigrationAssessmentInfo>();
|
||||||
|
|||||||
Reference in New Issue
Block a user