diff options
| author | Daniil Baturin <daniil@baturin.org> | 2019-07-25 17:45:18 +0200 |
|---|---|---|
| committer | Daniil Baturin <daniil@baturin.org> | 2019-07-25 17:45:18 +0200 |
| commit | 43ab6976b70ab2247fd9899dcf4507b6b618c7df (patch) | |
| tree | 4c5fc4fd4c0b72292893b3d57a898d57e8597e1b /scripts | |
| parent | f09160d42ba845eb366f020eb84faac397fe78dd (diff) | |
| download | vyatta-config-mgmt-43ab6976b70ab2247fd9899dcf4507b6b618c7df.tar.gz vyatta-config-mgmt-43ab6976b70ab2247fd9899dcf4507b6b618c7df.zip | |
T1543: add source address option for commit archive host connections.
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/vyatta-commit-push.pl | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/scripts/vyatta-commit-push.pl b/scripts/vyatta-commit-push.pl index 6edfd10..2a1f495 100755 --- a/scripts/vyatta-commit-push.pl +++ b/scripts/vyatta-commit-push.pl @@ -68,6 +68,13 @@ my $hostname = hostname(); $hostname = 'vyos' if ! defined $hostname; my $save_file = "config.boot-$hostname" . $timestamp; +my $source_addr = $config->returnEffectiveValue('source-address'); +my $src_opt = ""; +if( defined($source_addr) ) { + $src_opt = "--interface $source_addr"; + print("Using source address $source_addr\n"); +} + print "Archiving config...\n"; foreach my $uri (@uris) { my $u = URI->new($uri); @@ -100,13 +107,13 @@ foreach my $uri (@uris) { or die "Cannot open known_hosts: $!"; print $known_hosts "$rsa_key\n"; close($known_hosts); - $cmd = "curl -g -s -S -T $tmp_push_file $uri/$save_file"; + $cmd = "curl $src_opt -g -s -S -T $tmp_push_file $uri/$save_file"; $rc = system($cmd); print "\n"; } } } else { - $cmd = "curl -s -T $tmp_push_file $uri/$save_file"; + $cmd = "curl $src_opt -s -T $tmp_push_file $uri/$save_file"; $rc = system($cmd); } |
