Skip to content

Commit

Permalink
fix(disks): attach default disk first if needed (#551)
Browse files Browse the repository at this point in the history
Fixes #518
  • Loading branch information
bcoe authored May 4, 2021
1 parent 11618c5 commit b30e33e
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions packages/google-cloud-compute/src/zone.js
Original file line number Diff line number Diff line change
Expand Up @@ -649,13 +649,17 @@ class Zone extends common.ServiceObject {
}
delete body.os;
body.disks = body.disks || [];
body.disks.push({
autoDelete: true,
boot: true,
initializeParams: {
sourceImage: image.selfLink,
},
});
// Only push an additional disk configuration if the disk provided
// is not bootable:
if (body.disks.length === 0 || !body.disks[0].boot) {
body.disks.unshift({
autoDelete: true,
boot: true,
initializeParams: {
sourceImage: image.selfLink,
},
});
}
self.createVM(name, body, callback);
});
return;
Expand Down

0 comments on commit b30e33e

Please sign in to comment.