pf-tools/pf-tools: Conf.pm: add HOSTNAME, HOSTNAMESITE and HOSTN...

parmelan-guest at users.alioth.debian.org parmelan-guest at users.alioth.debian.org
Wed Dec 10 07:43:23 UTC 2014


details:   http://hg.debian.org/hg/pf-tools/pf-tools/rev/081fb69eede2
changeset: 1365:081fb69eede2
user:      melkor <melkor at sitadelle.com>
date:      Wed Dec 10 08:43:18 2014 +0100
description:
Conf.pm: add HOSTNAME, HOSTNAMESITE and HOSTNAMESITE_ shortcut which are used in ADDFILE to find automatically spefics files in 'FILE' directories based on server's hostname

diffstat:

 lib/PFTools/Conf.pm |   3 +++
 t/13.conf.t         |  12 ++++++++++++
 2 files changed, 15 insertions(+), 0 deletions(-)

diffs (35 lines):

diff -r 1065da713a5d -r 081fb69eede2 lib/PFTools/Conf.pm
--- a/lib/PFTools/Conf.pm	Tue Dec 09 15:00:31 2014 +0100
+++ b/lib/PFTools/Conf.pm	Wed Dec 10 08:43:18 2014 +0100
@@ -368,6 +368,9 @@
     $result =~ s{ \A FILESITE [:] }{$site_dir/%POPNAME%/FILE/}xms;
     $result =~ s{ \A FILESITE_([^:]+) [:] }{$site_dir/$1/FILE/}xms;
     $result =~ s{ \A HOST [:] }{$files_dir/%HOSTTYPE%/}xms;
+    $result =~ s{ \A HOSTNAME [:] }{$files_dir/%HOSTNAME%/}xms;
+    $result =~ s{ \A HOSTNAMESITE [:] }{$site_dir/%POPNAME%/FILE/%HOSTNAME%/}xms;
+    $result =~ s{ \A HOSTNAMESITE_([^:]+) [:] }{$site_dir/$1/FILE/%HOSTNAME%/}xms;
     $result =~ s{ \A HOSTSITE [:] }{$site_dir/%POPNAME%/FILE/%HOSTTYPE%/}xms;
     $result =~ s{ \A HOSTSITE_([^:]+) [:] }{$site_dir/$1/FILE/%HOSTTYPE%/}xms;
     $result =~ s{ \A SHORTHOST [:] }{$files_dir/%SHORTHOSTTYPE%/}xms;
diff -r 1065da713a5d -r 081fb69eede2 t/13.conf.t
--- a/t/13.conf.t	Tue Dec 09 15:00:31 2014 +0100
+++ b/t/13.conf.t	Wed Dec 10 08:43:18 2014 +0100
@@ -307,6 +307,18 @@
     q{/var/lib/cvsguest/config/SITE/FOOBAR/FILE/myhost/my/path/to/file}
     => q{Good result for HOSTSITE_*:};
 
+is get_source( q{HOSTNAME:/my/path/to/file.%HOSTDIGITS%}, q{myhost00} ),
+    q{/var/lib/cvsguest/config/FILE/myhost00/my/path/to/file.00}
+    => q{Good result for HOST: and %HOSTDIGITS%};
+
+is get_source( q{HOSTNAMESITE:/my/path/to/file}, q{poo1-myhost00} ),
+    q{/var/lib/cvsguest/config/SITE/poo1/FILE/poo1-myhost00/my/path/to/file}
+    => q{Good result for HOSTSITE:};
+
+is get_source( q{HOSTNAMESITE_FOOBAR:/my/path/to/file}, q{myhost00} ),
+    q{/var/lib/cvsguest/config/SITE/FOOBAR/FILE/myhost00/my/path/to/file}
+    => q{Good result for HOSTSITE_*:};
+
 is get_source(q{MODEL:/my/path/to/file}),
     q{/var/lib/cvsguest/config/MODEL/my/path/to/file}
     => q{Good result for MODEL:};



More information about the pf-tools-commits mailing list