From c563daacc76dd440031212d08682fbbb2f0322d0 Mon Sep 17 00:00:00 2001 From: karchnu Date: Tue, 19 Jan 2016 05:47:10 +0100 Subject: [PATCH] don't copy zonefile from the ns server if already in tmpdir --- lib/zone.pm | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/zone.pm b/lib/zone.pm index c3bb352..e50b26e 100644 --- a/lib/zone.pm +++ b/lib/zone.pm @@ -96,7 +96,21 @@ sub get_zonefile { my $file = $self->get_remote_zf_(); my $dest = $self->get_ztmp_file_(); - copycat ($file, $dest); + my $path = $dest; + + # dest is the filename + if($dest =~ "://") { + my $fileuri = URI->new($dest); + $path = $fileuri->path; + } + + if( -f $path ) { + say "FILE $path already exists : do not copy from ns server"; + } + else { + copycat ($file, $dest); + } + zonefile->new(domain => $$self{domain}, zonefile => $dest); }