From b14d960e2f23ff728a77b9463f6f4a5bcdf961d6 Mon Sep 17 00:00:00 2001 From: "Dennis J. Bell" Date: Mon, 22 Jul 2024 11:34:42 -0700 Subject: [PATCH] Set default target based on search mode targeting [Improvements] * When using `search mode` targeting (i.e. `genesis @[:]`), the default bosh target is now set to `parent` if a type is specified, and `self` if no type is specified because not specifying the type implies that the target is the bosh director of the environment being targeted, whereas if a type is specified, the target is the deployment, and thus the bosh director desired is the parent of the deployment. --- bin/genesis | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bin/genesis b/bin/genesis index a0599d3e..1d551b67 100755 --- a/bin/genesis +++ b/bin/genesis @@ -1684,6 +1684,12 @@ sub main { if ($env_pattern) { require Genesis::Env; ($ENV{GENESIS_DEPLOYMENT_ROOT}, $path) = Genesis::Env->search_for_env_file($env_pattern, $type_pattern); + unless (exists $ENV{GENESIS_DEFAULT_BOSH_TARGET}) { + $ENV{GENESIS_DEFAULT_BOSH_TARGET} = $type_pattern ? 'parent' : 'self'; + # Since the user config has already been processed, we need to over- + # ride the default bosh target in the in-memory config as well. + $Genesis::RC->set('default_bosh_target', $ENV{GENESIS_DEFAULT_BOSH_TARGET}); + } } elsif ($type_pattern) { require Genesis::Top; ($ENV{GENESIS_DEPLOYMENT_ROOT},$path) = Genesis::Top->search_for_repo_path($type_pattern);