Skip to content

Commit

Permalink
fix(cli): wait for snapshot to be done (#378)
Browse files Browse the repository at this point in the history
  • Loading branch information
y-lakhdar authored Jul 26, 2021
1 parent d898858 commit 9eb81a2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/cli/src/commands/org/config/pull.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ export default class Pull extends Command {

@Preconditions(IsAuthenticated())
public async run() {
cli.action.start('Creating Snapshot');
const snapshot = await this.getSnapshot();

cli.action.start('Updating project with Snapshot');
Expand Down Expand Up @@ -96,11 +95,13 @@ export default class Pull extends Command {
const {flags} = this.parse(Pull);
const target = await getTargetOrg(this.configuration, flags.target);
if (flags.snapshotId) {
cli.action.start('Retrieving Snapshot');
return SnapshotFactory.createFromExistingSnapshot(
flags.snapshotId,
target
);
}
cli.action.start('Creating Snapshot');
return SnapshotFactory.createFromOrg(
this.ResourceSnapshotTypesToExport,
target
Expand Down
6 changes: 5 additions & 1 deletion packages/cli/src/lib/snapshot/snapshotFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ export class SnapshotFactory {
const model = await client.resourceSnapshot.get(snapshotId, {
includeReports: true,
});
return new Snapshot(model, client);

const snapshot = new Snapshot(model, client);
await snapshot.waitUntilDone();

return snapshot;
}

public static async createFromOrg(
Expand Down

0 comments on commit 9eb81a2

Please sign in to comment.