Skip to content

Commit

Permalink
Added better error handling and messaging for scripts.v3 (#1040)
Browse files Browse the repository at this point in the history
  • Loading branch information
azaslonov authored Nov 18, 2020
1 parent 70fa9e3 commit 8d01d66
Show file tree
Hide file tree
Showing 4 changed files with 197 additions and 118 deletions.
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

0 comments on commit 8d01d66

Please sign in to comment.