Page MenuHomeVyOS Platform

Error shown on commit
Closed, ResolvedPublicBUG

Description

We have config archival activated but no source address defined.
When you do a committhe following error appears:

Use of uninitialized value $source_address in concatenation (.) or string at /etc/commit/post-hooks.d/02vyatta-commit-push.pl line 78.

When I have a look at that part of the file it looks the following:

my $source_address = $config->returnEffectiveValue('source-address');
# If so, we're going to pass that to the Python funcall.
if (defined($source_address)) {
    print("Using source address $source_address\n");
}
# The string needs to be wrapped in quotes, even if it's empty.
$source_address = '"' . $source_address . '"';

The last line is the one which brings up the error.
In my opinion the code should be corrected:

my $source_address = $config->returnEffectiveValue('source-address');
# If so, we're going to pass that to the Python funcall.
if (defined($source_address)) {
    print("Using source address $source_address\n");
    $source_address = '"' . $source_address . '"';
} else {
    # The string needs to be wrapped in quotes, even if it's empty.
    $source_address = '""';
}

Details

Difficulty level
Easy (less than an hour)
Version
1.3.0
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Unspecified (please specify)

Event Timeline

@adestis Could you share commands, on how to reproduce this bug? Thanks.

@Viacheslav steps to reproduce:

Use a VyOS 1.3 system and activate config archival:

set system config-management commit-archive location 'ftp://user:password@hostname'
commit

Then make any change and commit. e.g.

[edit]
user@vyos# set int dummy dum0 description "Test"
[edit]
user@vyos# commit
Use of uninitialized value $source_address in concatenation (.) or string at /etc/commit/post-hooks.d/02vyatta-commit-push.pl line 78.
Archiving config...
  ftp://host/

When you make the suggested change in the 02vyatta-commit-push.pl file it works for me.

/Markus

I could commit a merge request but I have not figured out in which repo the file is located.

Seems like this is already handled in T4101