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

fix(cli): wait for snapshot to be done #378

Merged
merged 3 commits into from
Jul 26, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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: 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