Skip to content

Commit

Permalink
[Bug fix] Configure shir dialog was blank (#26007)
Browse files Browse the repository at this point in the history
* fixed SHIR issue

* enable next gen GP
  • Loading branch information
stuti149 authored Oct 29, 2024
1 parent df6f44a commit 00c9e74
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 5 deletions.
16 changes: 14 additions & 2 deletions extensions/sql-migration/src/api/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -782,8 +782,14 @@ export async function createPowershellscriptContentContainer(view: azdata.ModelV
}).component();

const scriptpath = path.join(__dirname, '../scripts/SHIR-auto-configuration.ps1');
const scriptpath2 = path.join(__dirname, '../../scripts/SHIR-auto-configuration.ps1');

const scriptContent = await fs.readFile(scriptpath);
let scriptContent;
try {
scriptContent = await fs.readFile(scriptpath);
} catch (err) {
scriptContent = await fs.readFile(scriptpath2);
}

// inject auth keys in the script
const authKeys = await retrieveAuthKeys(migrationStateModel);
Expand All @@ -792,7 +798,13 @@ export async function createPowershellscriptContentContainer(view: azdata.ModelV

// write it back to different file
const modifiedScriptPath = path.join(__dirname, '../scripts/SHIR-auto-configuration-with-auth-keys.ps1');
await fs.writeFile(modifiedScriptPath, modifiedScriptContent);
const modifiedScriptPath2 = path.join(__dirname, '../../scripts/SHIR-auto-configuration.ps1');

try {
await fs.writeFile(modifiedScriptPath, modifiedScriptContent);
} catch (err) {
await fs.writeFile(modifiedScriptPath2, modifiedScriptContent);
}

saveScriptButton.onDidClick(async () => {
const options: vscode.SaveDialogOptions = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,14 @@ export class ConfigureIRDialog {

// get the SHIR script
const scriptPath = path.join(__dirname, '../scripts/SHIR-auto-configuration.ps1');
const scriptPath2 = path.join(__dirname, '../../../scripts/SHIR-auto-configuration.ps1');

const scriptContent = await fs.readFile(scriptPath);
let scriptContent;
try {
scriptContent = await fs.readFile(scriptPath);
} catch (err) {
scriptContent = await fs.readFile(scriptPath2);
}

// inject auth keys in the script
const authKeys = await retrieveAuthKeys(this._migrationStateModel);
Expand All @@ -199,7 +205,14 @@ export class ConfigureIRDialog {

// write it back to different file
this.modifiedScriptPath = path.join(__dirname, '../scripts/SHIR-auto-configuration-with-auth-keys.ps1');
await fs.writeFile(this.modifiedScriptPath, modifiedScriptContent);
const modifiedScriptPath2 = path.join(__dirname, '../../../scripts/SHIR-auto-configuration.ps1');

try {
await fs.writeFile(this.modifiedScriptPath, modifiedScriptContent);
} catch (err) {
await fs.writeFile(modifiedScriptPath2, modifiedScriptContent);
this.modifiedScriptPath = modifiedScriptPath2;
}

const powershellScriptExpander = view.modelBuilder.button().withProps(
{
Expand Down
2 changes: 1 addition & 1 deletion extensions/sql-migration/src/service/features.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export class SqlMigrationService extends MigrationExtensionService implements co
includePreviewSkus: includePreviewSkus,
databaseAllowList: databaseAllowList,
isPremiumSSDV2Enabled: true,
isNextGenGPEnabled: includePreviewSkus
isNextGenGPEnabled: true
};

try {
Expand Down

0 comments on commit 00c9e74

Please sign in to comment.