diff options
author | Daniil Baturin <daniil@vyos.io> | 2021-12-16 23:17:25 +0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-16 23:17:25 +0700 |
commit | 261b265ab0b271a69f05014e05e13c097789fc54 (patch) | |
tree | ff9af098300985f5a8e45a6f590ad14bb99946fa | |
parent | 74abdfd4f0ee4def3625e0fae58d8dad1bb674bd (diff) | |
parent | 9b9d2caa72639479309bc6e19dc811cc8aeaf384 (diff) | |
download | vyatta-config-mgmt-261b265ab0b271a69f05014e05e13c097789fc54.tar.gz vyatta-config-mgmt-261b265ab0b271a69f05014e05e13c097789fc54.zip |
Merge pull request #9 from erkin/current
remote: Cleanly handle the case of no source address
-rwxr-xr-x | scripts/vyatta-commit-push.pl | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/scripts/vyatta-commit-push.pl b/scripts/vyatta-commit-push.pl index d5637ca..6e5752b 100755 --- a/scripts/vyatta-commit-push.pl +++ b/scripts/vyatta-commit-push.pl @@ -73,13 +73,9 @@ 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. - $source_address = '"' . $source_address . '"'; -} -# Otherwise, we're going to pass None. -else { - $source_address = "None"; } +# The string needs to be wrapped in quotes, even if it's empty. +$source_address = '"' . $source_address . '"'; print "Archiving config...\n"; foreach my $uri (@uris) { @@ -97,12 +93,7 @@ foreach my $uri (@uris) { $remote .= "$path" if defined $path; print " $remote "; - # Don't set var 'source_host' if 'source-address' not in configuration - if ($source_address eq "None") { - system("python3 -c 'from vyos.remote import upload; upload(\"$tmp_push_file\", \"$uri/$save_file\")'"); - } else { - system("python3 -c 'from vyos.remote import upload; upload(\"$tmp_push_file\", \"$uri/$save_file\", source_host=$source_address)'"); - } + system("python3 -c 'from vyos.remote import upload; upload(\"$tmp_push_file\", \"$uri/$save_file\", source_host=$source_address)'"); } move($tmp_push_file, $last_push_file); |