Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added better error handling and messaging for scripts.v3 #1040

Merged
merged 4 commits into from
Nov 18, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions scripts.v3/capture.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ async function capture() {
yargs.resourceGroupName,
yargs.serviceName
);

await importerExporter.export();

console.log(`The content captured in "./dist/snapshot" folder.`);
Expand All @@ -61,7 +60,7 @@ capture()
process.exit(0);
})
.catch(error => {
console.error(error);
console.error(error.message);
process.exit(1);
});

Expand Down
2 changes: 1 addition & 1 deletion scripts.v3/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ generate()
process.exit(0);
})
.catch(error => {
console.error(error);
console.error(error.message);
process.exit(1);
});

Expand Down
25 changes: 15 additions & 10 deletions scripts.v3/migrate.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,20 @@ const yargs = require('yargs')
.argv;

async function migrate() {
const sourceImporterExporter = new ImporterExporter(yargs.sourceSubscriptionId, yargs.sourceResourceGroupName, yargs.sourceServiceName);
await sourceImporterExporter.export();

const destIimporterExporter = new ImporterExporter(yargs.destSubscriptionId, yargs.destResourceGroupName, yargs.destServiceName);
await destIimporterExporter.cleanup();
await destIimporterExporter.import();

/* New publishing endpoint is not deployed to production yet. */
// await destIimporterExporter.publish();
try {
const sourceImporterExporter = new ImporterExporter(yargs.sourceSubscriptionId, yargs.sourceResourceGroupName, yargs.sourceServiceName);
await sourceImporterExporter.export();

const destIimporterExporter = new ImporterExporter(yargs.destSubscriptionId, yargs.destResourceGroupName, yargs.destServiceName);
await destIimporterExporter.cleanup();
await destIimporterExporter.import();

/* New publishing endpoint is not deployed to production yet. */
// await destIimporterExporter.publish();
}
catch (error) {
throw new Error(`Unable to complete migration. ${error.message}`);
}
}

migrate()
Expand All @@ -85,6 +90,6 @@ migrate()
process.exit(0);
})
.catch(error => {
console.error(error);
console.error(error.message);
process.exit(1);
});
Loading