Files
sql-scripts/TPDT-268 - ACP in task sequence/9_Update_FTPLogin_Central.sql
Thierry Schork 88a89d84fe TPDT-283
* Adapted the powershell to connect to the central with a dedicated sql login
* reverted script 9_Update_FTPLogin_Central to the original version
* script 9_Update_FTPLogin_Central is executed on the central directly with a dedicated login
* reverted scripts 20_update_system_site_centrale.sql and 21_update_point_of_sale_centrale.sql to work locally only
*  scripts scripts 20_update_system_site_centrale.sql and 21_update_point_of_sale_centrale.sql are executed on the cenrtal with a specific login and on the local instance
* when fetching the mac addresses, only take up interfaces in account and group the results by mac addresses, to avoid virtual mac addresses duplicate causing an error
2024-03-15 11:23:24 +01:00

46 lines
2.6 KiB
Transact-SQL

IF EXISTS ( SELECT 1
FROM [Arizona].[dbo].[System_site] SS
JOIN [Arizona].[dbo].[System_site_transfer] SST
ON SST.SST_dest_system_site = SS.System_site_ID
WHERE SS.SS_server_name = '$fqdn'
AND SST.SST_bmc_task = 109)
BEGIN
UPDATE [Arizona].[dbo].[System_site_transfer]
SET SST_connection_info = '<ConnectionInfos><Ftp username="centralinfra\svc-APH-trans" pwd="$ftppass"/></ConnectionInfos>'
FROM [Arizona].[dbo].[System_site] SS
JOIN [Arizona].[dbo].[System_site_transfer] SST
ON SST.SST_dest_system_site = SS.System_site_ID
WHERE SS.SS_server_name = '$fqdn';
END;
ELSE
BEGIN
IF EXISTS ( SELECT 1
FROM Arizona.dbo.System_site
WHERE SS_server_name = '$fqdn')
BEGIN
UPDATE Arizona.dbo.Bmc_ID_counter
SET BMCID_last_number = ( SELECT BMCID_last_number + 1
FROM Arizona.dbo.Bmc_ID_counter
WHERE BMCID_key = 'system_site_transfer')
FROM Arizona.dbo.Bmc_ID_counter
WHERE BMCID_key = 'system_site_transfer';
INSERT INTO [Arizona].[dbo].[System_site_transfer] ([System_site_transfer_ID],
[SST_source_system_site],
[SST_dest_system_site],
[SST_bmc_task],
[SST_transfer_type],
[SST_VGUID],
[SST_master_ID],
[SST_connection_info],
[SST_start_date],
[SST_end_date])
VALUES (( SELECT BMCID_last_number
FROM Arizona.dbo.Bmc_ID_counter
WHERE BMCID_key = 'system_site_transfer'), 102, ( SELECT System_site_ID
FROM Arizona.dbo.System_site
WHERE SS_server_name = '$fqdn'), 109, 1,
DEFAULT, NULL,
'<ConnectionInfos><Ftp username="centralinfra\svc-APH-trans" pwd="$ftppass"/></ConnectionInfos>',
(SELECT CONVERT(CHAR(10), GETDATE(), 126)), NULL);
END;
END;