Skip to content

Commit bfc5244

Browse files
committed
Fix async issues in snap preseeding
1 parent 8bba9e4 commit bfc5244

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

‎src/preseed-snaps.js‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ let requestCache = {};
4646

4747
fs.mkdirSync(SNAPS_DIR, { recursive: true });
4848
fs.mkdirSync(ASSERTIONS_DIR, { recursive: true });
49+
fs.mkdirSync(LIVE_SNAPS_DIR, { recursive: true });
50+
fs.mkdirSync(LIVE_ASSERTIONS_DIR, { recursive: true });
4951

5052
/**
5153
*
@@ -243,9 +245,12 @@ async function main(isLiveLayer=false) {
243245
}
244246

245247
main();
246-
main(true);
247-
248-
// Remove duplicates
249-
fs.readdirSync(LIVE_BASE_SEED_DIR, { withFileTypes: false, recursive: true })
250-
.filter(filename => filename !== 'seed.yaml' && !filename.includes('ubuntu-desktop-bootstrap'))
251-
.forEach(filename => fs.rmSync(filename))
248+
main(true).then(() => {
249+
// Remove duplicates
250+
fs.readdirSync(LIVE_BASE_SEED_DIR, {
251+
withFileTypes: false,
252+
recursive: true
253+
})
254+
.filter(filename => filename !== 'seed.yaml' && !filename.includes('ubuntu-desktop-bootstrap'))
255+
.forEach(filename => fs.rmSync(filename))
256+
});

0 commit comments

Comments
 (0)