diff options
author | erkin <e.altunbas@vyos.io> | 2021-12-16 18:57:45 +0300 |
---|---|---|
committer | erkin <e.altunbas@vyos.io> | 2021-12-16 18:57:45 +0300 |
commit | 9b9d2caa72639479309bc6e19dc811cc8aeaf384 (patch) | |
tree | ff9af098300985f5a8e45a6f590ad14bb99946fa /scripts/vyatta-commit-push.pl | |
parent | 74abdfd4f0ee4def3625e0fae58d8dad1bb674bd (diff) | |
download | vyatta-config-mgmt-9b9d2caa72639479309bc6e19dc811cc8aeaf384.tar.gz vyatta-config-mgmt-9b9d2caa72639479309bc6e19dc811cc8aeaf384.zip |
remote: Cleanly handle the case of no source address
Diffstat (limited to 'scripts/vyatta-commit-push.pl')
-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); |