> +
> slashEncodedIds.getSecondId());
> + if
> (instance.getMetadata().getItems().get(GCE_DELETE_BOOT_DISK_METADATA_KEY).equals("true"))
> {
> + Optional<AttachedDisk> disk = tryFind(instance.getDisks(), new
> Predicate<AttachedDisk>() {
> + @Override
> + public boolean apply(AttachedDisk input) {
> + return PersistentAttachedDisk.class.isInstance(input) &&
> + PersistentAttachedDisk.class.cast(input).isBoot();
> + }
> + });
> + if (disk.isPresent()) {
> + diskName =
> PersistentAttachedDisk.class.cast(disk.get()).getSourceDiskName();
> + }
> + }
> + } catch (Exception e) {
> + // TODO: what exception actually gets thrown here if the instance
> doesn't really exist?
> + }
>
> waitOperationDone(api.getInstanceApiForProject(userProject.get()).deleteInZone(slashEncodedIds.getFirstId(),
> slashEncodedIds.getSecondId()));
Aaaah, actually, if the instance doesn't exist, we have no way of knowing what
the disk is and whether we should be deleting it in the first place...
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-google/pull/17/files#r8320354