From 67b165a3d4096899bfcee1bdc2754b68aeac4033 Mon Sep 17 00:00:00 2001 From: John Stange Date: Wed, 4 Mar 2020 17:26:06 -0500 Subject: [PATCH] Adoption: be a little better at resolving deploy_ids in Refs; Google::ContainerCluster: don't add dependencies for service accounts in other deploys --- modules/mu/adoption.rb | 6 ++++-- modules/mu/clouds/google/container_cluster.rb | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/mu/adoption.rb b/modules/mu/adoption.rb index f9b2d2833..a3f511e53 100644 --- a/modules/mu/adoption.rb +++ b/modules/mu/adoption.rb @@ -473,7 +473,9 @@ def scrub_globals(h, field) def resolveReferences(cfg, deploy, parent) if cfg.is_a?(MU::Config::Ref) + cfg.kitten(deploy) || cfg.kitten hashcfg = cfg.to_h + if cfg.kitten(deploy) littermate = deploy.findLitterMate(type: cfg.type, name: cfg.name, cloud_id: cfg.id, habitat: cfg.habitat) @@ -496,14 +498,14 @@ def resolveReferences(cfg, deploy, parent) hashcfg.delete("name") if cfg.id and !cfg.deploy_id end end - elsif hashcfg["id"] # reference to raw cloud ids is reasonable + elsif hashcfg["id"] and !hashcfg["name"] hashcfg.delete("deploy_id") - hashcfg.delete("name") else pp parent.cloud_desc raise Incomplete, "Failed to resolve reference on behalf of #{parent}" end hashcfg.delete("deploy_id") if hashcfg['deploy_id'] == deploy.deploy_id + if parent and parent.config cred_cfg = MU::Cloud.const_get(parent.cloud).credConfig(parent.credentials) diff --git a/modules/mu/clouds/google/container_cluster.rb b/modules/mu/clouds/google/container_cluster.rb index 5577e0ff7..ca258d6df 100644 --- a/modules/mu/clouds/google/container_cluster.rb +++ b/modules/mu/clouds/google/container_cluster.rb @@ -1031,7 +1031,8 @@ def self.validateConfig(cluster, configurator) type: "habitats" ) if cluster['service_account']['name'] and - !cluster['service_account']['id'] + !cluster['service_account']['id'] and + !cluster['service_account']['deploy_id'] cluster['dependencies'] ||= [] cluster['dependencies'] << { "type" => "user",