Skip to content

Commit

Permalink
Fix bug with variants overriding existing configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
stmh committed May 28, 2019
1 parent 0639321 commit 601e5b7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Configuration/BlueprintConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,13 @@ public function expandVariants($blueprints)
foreach ($blueprints as $data) {
$template = $this->getTemplate($data['configName']);
foreach ($data['variants'] as $variant) {
$this->configuration->addHost($template->expand($variant));
$host = $template->expand($variant);
if (!$this->configuration->hasHostConfig($host['configName'])) {
$this->configuration->addHost($template->expand($variant));
}
else {
$this->configuration->getLogger()->notice('There\'s an existing config with that name, skipping creating one from blueprint');
}
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/Configuration/ConfigurationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -710,4 +710,8 @@ protected function inheritFromBlueprint(string $config_name, $data): array

return $data;
}

public function hasHostConfig($configName) {
return !empty($this->hosts[$configName]);
}
}

0 comments on commit 601e5b7

Please sign in to comment.