1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-10-30 23:37:45 +02:00

Add id param for hosts created with host-add.

The host-*-ip variable is created from the id param so the name param can be changed without affecting the host-*-ip variable. If id is not specified then it is copied from name.
This commit is contained in:
David Steele
2018-02-21 18:10:53 -05:00
parent 246d441507
commit 5eb682a569
3 changed files with 16 additions and 2 deletions

View File

@@ -817,6 +817,15 @@ sub hostKey
image => $self->{oManifest}->variableReplace($oHost->paramGet('image')),
};
if (defined($oHost->paramGet('id', false)))
{
$hCacheKey->{id} = $self->{oManifest}->variableReplace($oHost->paramGet('id'));
}
else
{
$hCacheKey->{id} = $hCacheKey->{name};
}
if (defined($oHost->paramGet('option', false)))
{
$$hCacheKey{option} = $self->{oManifest}->variableReplace($oHost->paramGet('option'));
@@ -997,7 +1006,7 @@ sub sectionChildProcess
if ($bCacheHit)
{
$self->{oManifest}->variableSet("host-$$hCacheKey{name}-ip", $$hCacheValue{ip}, true);
$self->{oManifest}->variableSet('host-' . $hCacheKey->{id} . '-ip', $hCacheValue->{ip}, true);
}
else
{
@@ -1017,7 +1026,7 @@ sub sectionChildProcess
$$hCacheKey{option});
$self->{host}{$$hCacheKey{name}} = $oHost;
$self->{oManifest}->variableSet("host-$$hCacheKey{name}-ip", $oHost->{strIP}, true);
$self->{oManifest}->variableSet('host-' . $hCacheKey->{id} . '-ip', $oHost->{strIP}, true);
$$hCacheValue{ip} = $oHost->{strIP};
# Add to the host group