pf-tools/pf-tools: 4 new changesets

parmelan-guest at users.alioth.debian.org parmelan-guest at users.alioth.debian.org
Wed Jul 30 16:10:17 UTC 2014


details:   http://hg.debian.org/hg/pf-tools/pf-tools/rev/a35b231a36ec
changeset: 1287:a35b231a36ec
user:      shad
date:      Wed Jul 30 17:50:18 2014 +0200
description:
dont erase the directory containing the rsa key

details:   http://hg.debian.org/hg/pf-tools/pf-tools/rev/535c81f913c0
changeset: 1288:535c81f913c0
user:      shad
date:      Wed Jul 30 17:50:57 2014 +0200
description:
use a default value for resolv.conf template

details:   http://hg.debian.org/hg/pf-tools/pf-tools/rev/cece43283311
changeset: 1289:cece43283311
user:      shad
date:      Wed Jul 30 17:53:44 2014 +0200
description:
pxe files were created 0644 due to filer right policy

details:   http://hg.debian.org/hg/pf-tools/pf-tools/rev/ce119bcb147e
changeset: 1290:ce119bcb147e
user:      shad
date:      Wed Jul 30 18:10:10 2014 +0200
description:
test

diffstat:

 lib/PFTools/Utils.pm   |  15 ++++++++++++++-
 lib/PFTools/VCS/CVS.pm |  14 +++++++-------
 lib/PFTools/VCS/HG.pm  |  12 +++++++-----
 lib/PFTools/VCS/SVN.pm |  12 +++++++-----
 sbin/mk_resolvconf     |   1 +
 t/20.files.t           |   4 ++--
 6 files changed, 38 insertions(+), 20 deletions(-)

diffs (163 lines):

diff -r faab156cf62e -r ce119bcb147e lib/PFTools/Utils.pm
--- a/lib/PFTools/Utils.pm	Tue Jul 29 18:04:12 2014 +0200
+++ b/lib/PFTools/Utils.pm	Wed Jul 30 18:10:10 2014 +0200
@@ -213,6 +213,7 @@
         }
     );
 
+    # default files are created 0600
     # sgid doesn't seems to work properly
     chmod 0644, $filename;
 
@@ -299,6 +300,10 @@
         }
     );
 
+    # default files are created 0600
+    # sgid doesn't seems to work properly
+    chmod 0644, $pxe_boot_file;
+
     return 1;
 }
 
@@ -350,6 +355,8 @@
 
 =item I<global_config> a reference to the global configuration hash
 
+=item I<pf_config> a reference to the pf-tools configuration hash
+
 =back
 
 =cut
@@ -1520,7 +1527,8 @@
     my ($args_ref) = @_;
 
     check_mandatory_true_args_type( $args_ref, q{},
-        qw( hostname site_name template_filename ) );
+        qw( hostname site_name ) );
+    check_optional_args_type( $args_ref, q{}, qw( template_filename ) );
 
     check_mandatory_args_type( $args_ref, q{HASH}, qw( global_config ) );
 
@@ -1559,6 +1567,11 @@
         domain      => $domain,
         nameservers => \@nameservers,
     };
+
+    my $templates_dirname
+        = $args_ref->{'pf_config'}->{'path'}->{'templates_dir'};
+
+    $template_filename ||= join q{/}, $templates_dirname, q{resolv.conf.tpl};
     my $lines_ref = [
         split qr{ \n }xms,
         __read_and_process_template( $template_filename, $vars_ref ), -1
diff -r faab156cf62e -r ce119bcb147e lib/PFTools/VCS/CVS.pm
--- a/lib/PFTools/VCS/CVS.pm	Tue Jul 29 18:04:12 2014 +0200
+++ b/lib/PFTools/VCS/CVS.pm	Wed Jul 30 18:10:10 2014 +0200
@@ -28,8 +28,6 @@
 use File::Path qw( make_path remove_tree );
 use Proc::Reliable;
 
-#use PFTools::Logger;
-
 our @EXPORT = qw(
     checkout
 );
@@ -96,12 +94,14 @@
     }
 
     my $co_dir = $pf_config->{'path'}->{'checkout_dir'};
-    if ( -e $co_dir ) {
-        remove_tree $co_dir
-            or croak qq{ERROR: Unable to remove $co_dir : $OS_ERROR};
+    if ( -e "$co_dir/$pf_config->{'vcs'}->{'module'}" ) {
+        remove_tree "$co_dir/$pf_config->{'vcs'}->{'module'}"
+            or croak
+            qq{ERROR: Unable to remove $co_dir/$pf_config->{'vcs'}->{'module'} : $OS_ERROR};
     }
-    make_path $co_dir
-        or croak qq{ERROR: Unable to create $co_dir : $OS_ERROR};
+    make_path "$co_dir/$pf_config->{'vcs'}->{'module'}"
+        or croak
+        qq{ERROR: Unable to create $co_dir/$pf_config->{'vcs'}->{'module'} : $OS_ERROR};
 
     my $exec = Proc::Reliable->new();
     my ( $stdout, $stderr, $status, $msg )
diff -r faab156cf62e -r ce119bcb147e lib/PFTools/VCS/HG.pm
--- a/lib/PFTools/VCS/HG.pm	Tue Jul 29 18:04:12 2014 +0200
+++ b/lib/PFTools/VCS/HG.pm	Wed Jul 30 18:10:10 2014 +0200
@@ -84,12 +84,14 @@
     }
 
     my $co_dir = $pf_config->{'path'}->{'checkout_dir'};
-    if ( -e $co_dir ) {
-        remove_tree $co_dir
-            or croak qq{ERROR: Unable to remove $co_dir : $OS_ERROR};
+    if ( -e "$co_dir/$pf_config->{'vcs'}->{'module'}" ) {
+        remove_tree "$co_dir/$pf_config->{'vcs'}->{'module'}"
+            or croak
+            qq{ERROR: Unable to remove $co_dir/$pf_config->{'vcs'}->{'module'} : $OS_ERROR};
     }
-    make_path $co_dir
-        or croak qq{ERROR: Unable to create $co_dir : $OS_ERROR};
+    make_path "$co_dir/$pf_config->{'vcs'}->{'module'}"
+        or croak
+        qq{ERROR: Unable to create $co_dir/$pf_config->{'vcs'}->{'module'} : $OS_ERROR};
 
     my $exec = Proc::Reliable->new();
     my ( $stdout, $stderr, $status, $msg )
diff -r faab156cf62e -r ce119bcb147e lib/PFTools/VCS/SVN.pm
--- a/lib/PFTools/VCS/SVN.pm	Tue Jul 29 18:04:12 2014 +0200
+++ b/lib/PFTools/VCS/SVN.pm	Wed Jul 30 18:10:10 2014 +0200
@@ -88,12 +88,14 @@
     }
 
     my $co_dir = $pf_config->{'path'}->{'checkout_dir'};
-    if ( -e $co_dir ) {
-        remove_tree $co_dir
-            or croak qq{ERROR: Unable to remove $co_dir : $OS_ERROR};
+    if ( -e "$co_dir/$pf_config->{'vcs'}->{'module'}" ) {
+        remove_tree "$co_dir/$pf_config->{'vcs'}->{'module'}"
+            or croak
+            qq{ERROR: Unable to remove $co_dir/$pf_config->{'vcs'}->{'module'} : $OS_ERROR};
     }
-    make_path $co_dir
-        or croak qq{ERROR: Unable to create $co_dir : $OS_ERROR};
+    make_path "$co_dir/$pf_config->{'vcs'}->{'module'}"
+        or croak
+        qq{ERROR: Unable to create $co_dir/$pf_config->{'vcs'}->{'module'} : $OS_ERROR};
 
     my $exec = Proc::Reliable->new();
     my ( $stdout, $stderr, $status, $msg )
diff -r faab156cf62e -r ce119bcb147e sbin/mk_resolvconf
--- a/sbin/mk_resolvconf	Tue Jul 29 18:04:12 2014 +0200
+++ b/sbin/mk_resolvconf	Wed Jul 30 18:10:10 2014 +0200
@@ -91,6 +91,7 @@
         hostname          => $options->{'host'},
         filename          => $options->{'output'},
         global_config     => $global_config,
+        pf_config         => $pf_config,
     }
 );
 
diff -r faab156cf62e -r ce119bcb147e t/20.files.t
--- a/t/20.files.t	Tue Jul 29 18:04:12 2014 +0200
+++ b/t/20.files.t	Wed Jul 30 18:10:10 2014 +0200
@@ -921,7 +921,7 @@
 
 LABEL install
 \tkernel debian-installer/lenny/amd64/linux
-\tappend DEBCONF_PRIORITY=critical vga=normal auto=true initrd=debian-installer/lenny/amd64/initrd.gz interface=eth0 netcfg/no_default_route=true url=http://vip-deploy.vlan-systeme.private/preseed_cbv4-rdeploy01 url/checksum=e09982b86a653dd4602033e14255f6a7 -- default pci=bfsort
+\tappend DEBCONF_PRIORITY=critical vga=normal auto=true initrd=debian-installer/lenny/amd64/initrd.gz interface=eth0 netcfg/no_default_route=true url=http://vip-deploy.vlan-systeme.private/preseed/preseed_cbv4-rdeploy01 url/checksum=e09982b86a653dd4602033e14255f6a7 -- default pci=bfsort
 
 LABEL linux
 \tkernel amd64/vmlinuz-2.6.26.5-universal-grm2.1.12
@@ -933,7 +933,7 @@
 EOT
 
 $result = PFTools::Utils::__read_file_in_array(
-    q{/tmp/pf-test/distrib/tftpboot/pxelinux.cfg/00-1e-c9-ff-42-0b}
+    q{/tmp/pf-test/distrib/tftpboot/pxelinux.cfg/01-00-1e-c9-ff-42-0b}
 );
 is_deeply $result, $expected_result
     => q{Builds the expected pxe_boot_file content for host cbv4-rdeploy01 site cbv4'}



More information about the pf-tools-commits mailing list