Skip to content

Commit

Permalink
Set default target based on search mode targeting
Browse files Browse the repository at this point in the history
[Improvements]

* When using `search mode` targeting (i.e. `genesis @<env>[:<type>]`), 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.
  • Loading branch information
dennisjbell committed Jul 22, 2024
1 parent 0219322 commit b14d960
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions bin/genesis
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit b14d960

Please sign in to comment.