pf-tools/pf-tools: 5 new changesets
parmelan-guest at users.alioth.debian.org
parmelan-guest at users.alioth.debian.org
Fri Dec 5 10:19:02 UTC 2014
details: http://hg.debian.org/hg/pf-tools/pf-tools/rev/71239b5c4f28
changeset: 1346:71239b5c4f28
user: shad
date: Fri Dec 05 11:02:56 2014 +0100
description:
more coherent shortcut naming
details: http://hg.debian.org/hg/pf-tools/pf-tools/rev/e302eab75b6a
changeset: 1347:e302eab75b6a
user: shad
date: Fri Dec 05 11:03:13 2014 +0100
description:
more coherent shortcut naming (doc)
details: http://hg.debian.org/hg/pf-tools/pf-tools/rev/ff76661d8c2d
changeset: 1348:ff76661d8c2d
user: shad
date: Fri Dec 05 11:03:36 2014 +0100
description:
more coherent shortcut naming (test)
details: http://hg.debian.org/hg/pf-tools/pf-tools/rev/1d0d1716ac31
changeset: 1349:1d0d1716ac31
user: shad
date: Fri Dec 05 11:17:36 2014 +0100
description:
merge tom's modif
details: http://hg.debian.org/hg/pf-tools/pf-tools/rev/5883cb175ea1
changeset: 1350:5883cb175ea1
user: shad
date: Fri Dec 05 11:18:02 2014 +0100
description:
merge melkor's modif
diffstat:
Makefile | 7 +-
doc/networkfile-syntax | 12 +-
doc/updatefile-syntax | 12 +-
lib/PFTools/Conf.pm | 19 +-
t/10.whitespace.t | 15 +-
t/13.conf.cfg1/config-export/COMMON/private-network | 4 +-
t/13.conf.cfg1/config-export/SITE/cbv4-pfds/CONFIG/hostfile-cbv4-spawn | 2 +-
t/13.conf.cfg1/config-export/SITE/cbv4-pfds/CONFIG/update-cbv4-spawn | 8 +-
t/13.conf.cfg1/config-export/SITE/cbv4/CONFIG/hostfile-cbv4-rdeploy | 2 +-
t/13.conf.t | 52 +++------
t/20.files.t | 16 +-
tools/Translate_old_config | 6 +-
12 files changed, 68 insertions(+), 87 deletions(-)
diffs (427 lines):
diff -r 5650873f92c7 -r 5883cb175ea1 Makefile
--- a/Makefile Wed Dec 03 18:21:51 2014 +0100
+++ b/Makefile Fri Dec 05 11:18:02 2014 +0100
@@ -35,9 +35,10 @@
test:
prove -lr
- @echo "if you want to run all test, you must either use 'sudo make test'"
- @echo "or 'make alltest' which will require you to be in sudoers"
- @echo "this is used to realize chown/chmod test"
+ @echo "if you want to run all tests, you must either use 'sudo make test'"
+ @echo "or 'make alltest' (which will require you to be in sudoers)"
+ @echo "or 'fakeroot make test' (which won't require sudo privileges)"
+ @echo "(this is used to realize the chown/chmod tests)"
alltest:
sudo prove -lr
diff -r 5650873f92c7 -r 5883cb175ea1 doc/networkfile-syntax
--- a/doc/networkfile-syntax Wed Dec 03 18:21:51 2014 +0100
+++ b/doc/networkfile-syntax Fri Dec 05 11:18:02 2014 +0100
@@ -51,18 +51,16 @@
! type ::= include
there are some shortcut defined that resolve to path relatively to VCS root
and 'module' defined in pf-tool.conf file
- - GLOBAL: resolve to /module/GLOBAL/
- - CVS: resolve to /
- - CONFIG: resolve to /module/
+ - ROOT: resolve to /module/
- COMMON: resolve to /module/COMMON/
- HOST: resolve to /module/bar/ (if the hosttype of machine is bar)
- HOSTSITE_foo: resolve to /module/SITE/foo/bar/ (if the hosttype of machine is bar)
- SITE: resolve to /module/SITE/
- SITE_foo: resolve to /module/SITE/foo/
- - CONF: resolve to /module/CONFIG/
- - CONFSITE_foo: resolve to /module/SITE/foo/CONFIG/
- - MOD: resolve to /module/MODEL/
- - MODSITE_foo: resolve to /module/SITE/foo/MODEL/
+ - CONFIG: resolve to /module/CONFIG/
+ - CONFIGSITE_foo: resolve to /module/SITE/foo/CONFIG/
+ - MODEL: resolve to /module/MODEL/
+ - MODELSITE_foo: resolve to /module/SITE/foo/MODEL/
[<SERVICE_NAME>]
! type ::= service
diff -r 5650873f92c7 -r 5883cb175ea1 doc/updatefile-syntax
--- a/doc/updatefile-syntax Wed Dec 03 18:21:51 2014 +0100
+++ b/doc/updatefile-syntax Fri Dec 05 11:18:02 2014 +0100
@@ -175,15 +175,13 @@
! action ::= include
there are some shortcut defined that resolve to path relatively to VCS root
and 'module' defined in pf-tool.conf file
- - GLOBAL: resolve to /module/SITE/foo/MODEL/
- - CVS: resolve to /
- - CONFIG: resolve to /module/
+ - ROOT: resolve to /module/
- COMMON: resolve to /module/COMMON/
- HOST: resolve to /module/bar/ (if the hosttype of machine is bar)
- HOSTSITE_foo: resolve to /module/SITE/foo/bar/ (if the hosttype of machine is bar)
- SITE: resolve to /module/SITE/
- SITE_foo: resolve to /module/SITE/foo/
- - CONF: resolve to /module/CONFIG/
- - CONFSITE_foo: resolve to /module/SITE/foo/CONFIG/
- - MOD: resolve to /module/MODEL/
- - MODSITE_foo: resolve to /module/SITE/foo/MODEL/
+ - CONFIG: resolve to /module/CONFIG/
+ - CONFIGSITE_foo: resolve to /module/SITE/foo/CONFIG/
+ - MODEL: resolve to /module/MODEL/
+ - MODELSITE_foo: resolve to /module/SITE/foo/MODEL/
diff -r 5650873f92c7 -r 5883cb175ea1 lib/PFTools/Conf.pm
--- a/lib/PFTools/Conf.pm Wed Dec 03 18:21:51 2014 +0100
+++ b/lib/PFTools/Conf.pm Fri Dec 05 11:18:02 2014 +0100
@@ -356,20 +356,21 @@
my $result = $source;
$result
- =~ s{ \A MODSITE_([^:]+) [:] }{$vcs_work_dir/$module/SITE/$1/MODEL/}xms;
- $result =~ s{ \A MOD [:] }{$vcs_work_dir/$module/MODEL/}xms;
+ =~ s{ \A MODELSITE_([^:]+) [:] }{$vcs_work_dir/$module/SITE/$1/MODEL/}xms;
+ $result =~ s{ \A MODEL [:] }{$vcs_work_dir/$module/MODEL/}xms;
$result
- =~ s{ \A CONFSITE_([^:]+) [:] }{$vcs_work_dir/$module/SITE/$1/CONFIG/}xms;
- $result =~ s{ \A CONF [:] }{$vcs_work_dir/$module/CONFIG/}xms;
+ =~ s{ \A CONFIGSITE_([^:]+) [:] }{$vcs_work_dir/$module/SITE/$1/CONFIG/}xms;
+ $result =~ s{ \A CONFIG [:] }{$vcs_work_dir/$module/CONFIG/}xms;
$result =~ s{ \A SITE_([^:]+) [:] }{$vcs_work_dir/$module/SITE/$1/}xms;
$result =~ s{ \A SITE [:] }{$vcs_work_dir/$module/SITE/}xms;
$result
=~ s{ \A HOSTSITE_([^:]+) [:] }{$vcs_work_dir/$module/SITE/$1/%HOSTTYPE%/}xms;
$result =~ s{ \A HOST [:] }{$vcs_work_dir/$module/%HOSTTYPE%/}xms;
$result =~ s{ \A COMMON [:] }{$vcs_work_dir/$module/COMMON/}xms;
- $result =~ s{ \A CONFIG [:] }{$vcs_work_dir/$module/}xms;
- $result =~ s{ \A CVS [:] }{$vcs_work_dir/}xms;
- $result =~ s{ \A GLOBAL [:] }{$vcs_work_dir/$module/GLOBAL/}xms;
+ $result =~ s{ \A ROOT [:] }{$vcs_work_dir/$module/}xms;
+
+ #$result =~ s{ \A CVS [:] }{$vcs_work_dir/}xms;
+ #$result =~ s{ \A GLOBAL [:] }{$vcs_work_dir/$module/GLOBAL/}xms;
$result = subst_vars( $result, $hash_subst );
@@ -693,8 +694,8 @@
}
my @sources = (
- "CONFSITE_${site}:/update-${host_value}",
- "CONF:/update-${host_value}",
+ "CONFIGSITE_${site}:/update-${host_value}",
+ "CONFIG:/update-${host_value}",
);
foreach my $source (@sources) {
diff -r 5650873f92c7 -r 5883cb175ea1 t/10.whitespace.t
--- a/t/10.whitespace.t Wed Dec 03 18:21:51 2014 +0100
+++ b/t/10.whitespace.t Fri Dec 05 11:18:02 2014 +0100
@@ -17,18 +17,13 @@
qr{\A ERROR: [ ] Invalid [ ] non-scalar [ ] string [ ] }xms
=> 'Non-scalar argument';
-is trim_surrounding_whitespace(), undef
- => q{Returns undef if no arg};
+is (trim_surrounding_whitespace(), undef, q{Returns undef if no arg});
-is trim_surrounding_whitespace( q{} ), q{}
- => q{Returns empty string if empty string};
+is (trim_surrounding_whitespace( q{} ), q{}, q{Returns empty string if empty string});
-is trim_surrounding_whitespace( qq{ \t } ), q{}
- => q{Returns empty string if only whitespace};
+is (trim_surrounding_whitespace( qq{ \t } ), q{}, q{Returns empty string if only whitespace});
-is trim_surrounding_whitespace( q{ abc } ), q{abc}
- => q{One word};
+is (trim_surrounding_whitespace( q{ abc } ), q{abc}, q{One word});
-is trim_surrounding_whitespace( q{ a b c } ), q{a b c}
- => q{Several words separated by whitespace};
+is (trim_surrounding_whitespace( q{ a b c } ), q{a b c}, q{Several words separated by whitespace});
diff -r 5650873f92c7 -r 5883cb175ea1 t/13.conf.cfg1/config-export/COMMON/private-network
--- a/t/13.conf.cfg1/config-export/COMMON/private-network Wed Dec 03 18:21:51 2014 +0100
+++ b/t/13.conf.cfg1/config-export/COMMON/private-network Fri Dec 05 11:18:02 2014 +0100
@@ -95,11 +95,11 @@
type = service
comment = Administration hosts
site = cbv4-pfds
- @host = CONFSITE_cbv4-pfds:/hostfile-cbv4-spawn
+ @host = CONFIGSITE_cbv4-pfds:/hostfile-cbv4-spawn
[admins-cbv4]
type = service
comment = Administration hosts (CBV4)
site = cbv4
- @host = CONFSITE_cbv4:/hostfile-cbv4-rdeploy
+ @host = CONFIGSITE_cbv4:/hostfile-cbv4-rdeploy
diff -r 5650873f92c7 -r 5883cb175ea1 t/13.conf.cfg1/config-export/SITE/cbv4-pfds/CONFIG/hostfile-cbv4-spawn
--- a/t/13.conf.cfg1/config-export/SITE/cbv4-pfds/CONFIG/hostfile-cbv4-spawn Wed Dec 03 18:21:51 2014 +0100
+++ b/t/13.conf.cfg1/config-export/SITE/cbv4-pfds/CONFIG/hostfile-cbv4-spawn Fri Dec 05 11:18:02 2014 +0100
@@ -37,7 +37,7 @@
ipv4 = 167.0
[hostgroup]
- model = MODSITE_cbv4-pfds:/model-cbv4-pfds
+ model = MODELSITE_cbv4-pfds:/model-cbv4-pfds
number = 2
comment = Spawning server
order = 1
diff -r 5650873f92c7 -r 5883cb175ea1 t/13.conf.cfg1/config-export/SITE/cbv4-pfds/CONFIG/update-cbv4-spawn
--- a/t/13.conf.cfg1/config-export/SITE/cbv4-pfds/CONFIG/update-cbv4-spawn Wed Dec 03 18:21:51 2014 +0100
+++ b/t/13.conf.cfg1/config-export/SITE/cbv4-pfds/CONFIG/update-cbv4-spawn Fri Dec 05 11:18:02 2014 +0100
@@ -2,10 +2,10 @@
# Sample update-cbv4-spawn
#
-[CONFSITE_cbv4-pfds:/include-spawn-common]
+[CONFIGSITE_cbv4-pfds:/include-spawn-common]
action = include
-[CONFSITE_cbv4-pfds:/include-distrib-custom]
+[CONFIGSITE_cbv4-pfds:/include-distrib-custom]
action = include
[/distrib]
@@ -69,8 +69,8 @@
[dhcp]
action = actiongroup
- on_noaction = umask 022; mk_pxelinuxcfg GLOBAL:private-network /distrib/tftpboot/pxelinux.cfg/template
- after_change = umask 022; mk_pxelinuxcfg GLOBAL:private-network /distrib/tftpboot/pxelinux.cfg/template && /etc/init.d/dhcp3-server restart
+ on_noaction = umask 022; mk_pxelinuxcfg COMMON:private-network /distrib/tftpboot/pxelinux.cfg/template
+ after_change = umask 022; mk_pxelinuxcfg COMMON:private-network /distrib/tftpboot/pxelinux.cfg/template && /etc/init.d/dhcp3-server restart
[/var/www/testfile]
action = removefile
diff -r 5650873f92c7 -r 5883cb175ea1 t/13.conf.cfg1/config-export/SITE/cbv4/CONFIG/hostfile-cbv4-rdeploy
--- a/t/13.conf.cfg1/config-export/SITE/cbv4/CONFIG/hostfile-cbv4-rdeploy Wed Dec 03 18:21:51 2014 +0100
+++ b/t/13.conf.cfg1/config-export/SITE/cbv4/CONFIG/hostfile-cbv4-rdeploy Fri Dec 05 11:18:02 2014 +0100
@@ -11,7 +11,7 @@
mac.1 = 00:1e:c9:ff:42:0b
[hostgroup]
- model = MOD:model-rdeploy
+ model = MODEL:model-rdeploy
number = 2
comment = Rdeploy server
order = 1
diff -r 5650873f92c7 -r 5883cb175ea1 t/13.conf.t
--- a/t/13.conf.t Wed Dec 03 18:21:51 2014 +0100
+++ b/t/13.conf.t Fri Dec 05 11:18:02 2014 +0100
@@ -272,21 +272,21 @@
qr{ \A ERROR: [ ] Undefined [ ] configuration [ ] parameter: [ ] vcs.module}xms
=> q{Dies on invalid $pf_config (no vcs.module)};
-is get_source(q{MODSITE_FOOBAR:/my/path/to/file}),
+is get_source(q{MODELSITE_FOOBAR:/my/path/to/file}),
q{/var/lib/cvsguest/config/SITE/FOOBAR/MODEL/my/path/to/file}
- => q{Good result for MODSITE_*:};
+ => q{Good result for MODELSITE_*:};
-is get_source(q{MOD:/my/path/to/file}),
+is get_source(q{MODEL:/my/path/to/file}),
q{/var/lib/cvsguest/config/MODEL/my/path/to/file}
- => q{Good result for MOD:};
+ => q{Good result for MODEL:};
-is get_source(q{CONFSITE_FOOBAR:/my/path/to/file}),
+is get_source(q{CONFIGSITE_FOOBAR:/my/path/to/file}),
q{/var/lib/cvsguest/config/SITE/FOOBAR/CONFIG/my/path/to/file}
- => q{Good result for CONFSITE_*:};
+ => q{Good result for CONFIGSITE_*:};
-is get_source(q{CONF:/my/path/to/file}),
+is get_source(q{CONFIG:/my/path/to/file}),
q{/var/lib/cvsguest/config/CONFIG/my/path/to/file}
- => q{Good result for CONF:};
+ => q{Good result for CONFIG:};
is get_source(q{SITE_FOOBAR:/my/path/to/file}),
q{/var/lib/cvsguest/config/SITE/FOOBAR/my/path/to/file}
@@ -312,21 +312,9 @@
q{/var/lib/cvsguest/config/COMMON/my/path/to/file}
=> q{Good result for COMMON:};
-is get_source(q{CONFIG:/my/path/to/file}),
+is get_source(q{ROOT:/my/path/to/file}),
q{/var/lib/cvsguest/config/my/path/to/file}
- => q{Good result for CONFIG:/};
-
-is get_source(q{CONFIG:my/path/to/file}),
- q{/var/lib/cvsguest/config/my/path/to/file}
- => q{Good result for CONFIG:};
-
-is get_source(q{CVS:config/my/path/to/file}),
- q{/var/lib/cvsguest/config/my/path/to/file}
- => q{Good result for CVS:};
-
-is get_source(q{GLOBAL:/my/path/to/file}),
- q{/var/lib/cvsguest/config/GLOBAL/my/path/to/file}
- => q{Good result for CONFIG:};
+ => q{Good result for ROOT:/};
########################################################################
note('Testing PFTools::Conf::__get_config_path');
@@ -487,7 +475,7 @@
],
'admins-cbv4' => {
'@host' => [
- 'CONFSITE_cbv4:/hostfile-cbv4-rdeploy',
+ 'CONFIGSITE_cbv4:/hostfile-cbv4-rdeploy',
],
'comment' => 'Administration hosts (CBV4)',
'site' => 'cbv4',
@@ -495,7 +483,7 @@
},
'admins' => {
'@host' => [
- 'CONFSITE_cbv4-pfds:/hostfile-cbv4-spawn',
+ 'CONFIGSITE_cbv4-pfds:/hostfile-cbv4-spawn',
],
'comment' => 'Administration hosts',
'site' => 'cbv4-pfds',
@@ -630,7 +618,7 @@
$parsed_configuration = load_conf(
- q{CONFSITE_cbv4-pfds:/hostfile-cbv4-spawn}, $test_hash_subst,
+ q{CONFIGSITE_cbv4-pfds:/hostfile-cbv4-spawn}, $test_hash_subst,
q{host}, $test_pf_config
);
@@ -666,7 +654,7 @@
'hostgroup' => {
'comment' => 'Spawning server',
'hostname' => 'cbv4-spawn%%',
- 'model' => 'MODSITE_cbv4-pfds:/model-cbv4-pfds',
+ 'model' => 'MODELSITE_cbv4-pfds:/model-cbv4-pfds',
'number' => '2',
'order' => '1',
'site' => 'cbv4-pfds',
@@ -710,7 +698,7 @@
or note explain $parsed_configuration;
$parsed_configuration = load_conf(
- q{MODSITE_cbv4-pfds:/model-cbv4-pfds}, $test_hash_subst,
+ q{MODELSITE_cbv4-pfds:/model-cbv4-pfds}, $test_hash_subst,
q{model}, $test_pf_config
);
@@ -1054,7 +1042,7 @@
'SERVICE' => {
'BY_NAME' => {
'admins' => [
- 'CONFSITE_cbv4-pfds:/hostfile-cbv4-spawn'
+ 'CONFIGSITE_cbv4-pfds:/hostfile-cbv4-spawn'
]
}
},
@@ -1257,7 +1245,7 @@
'SERVICE' => {
'BY_NAME' => {
'admins-cbv4' => [
- 'CONFSITE_cbv4:/hostfile-cbv4-rdeploy'
+ 'CONFIGSITE_cbv4:/hostfile-cbv4-rdeploy'
],
},
},
@@ -1783,10 +1771,10 @@
},
'dhcp' => {
'on_noaction' =>
- 'umask 022; mk_pxelinuxcfg GLOBAL:private-network /distrib/tftpboot/pxelinux.cfg/template',
+ 'umask 022; mk_pxelinuxcfg COMMON:private-network /distrib/tftpboot/pxelinux.cfg/template',
'action' => 'actiongroup',
'after_change' =>
- 'umask 022; mk_pxelinuxcfg GLOBAL:private-network /distrib/tftpboot/pxelinux.cfg/template && /etc/init.d/dhcp3-server restart',
+ 'umask 022; mk_pxelinuxcfg COMMON:private-network /distrib/tftpboot/pxelinux.cfg/template && /etc/init.d/dhcp3-server restart',
},
'/var/www/debian-security' => {
'source' => '/distrib/official-mirrors/debian-security',
@@ -2093,7 +2081,7 @@
'SERVICE' => {
'BY_NAME' => {
'admins-cbv4' => [
- 'CONFSITE_cbv4:/hostfile-cbv4-rdeploy'
+ 'CONFIGSITE_cbv4:/hostfile-cbv4-rdeploy'
]
}
},
diff -r 5650873f92c7 -r 5883cb175ea1 t/20.files.t
--- a/t/20.files.t Wed Dec 03 18:21:51 2014 +0100
+++ b/t/20.files.t Fri Dec 05 11:18:02 2014 +0100
@@ -1369,8 +1369,8 @@
SKIP: {
skip( q{Need root to give away ownership}, 16 ) unless ( $UID == 0 );
- note('Testing PFTools::Update::Common::Do_chownmod');
- can_ok( 'PFTools::Update::Common', qw( Do_chownmod ) );
+ note('Testing PFTools::Update::Common::do_chownmod');
+ can_ok( 'PFTools::Update::Common', qw( do_chownmod ) );
my $ref_section = {
owner => 'daemon',
@@ -1384,10 +1384,10 @@
my $newuid = getpwnam $ref_section->{owner};
my $newgid = getgrnam $ref_section->{group};
- ok PFTools::Update::Common::Do_chownmod(
+ ok PFTools::Update::Common::do_chownmod(
$ref_section, $dest, $global_config
),
- q{execution of Do_chownmod};
+ q{execution of do_chownmod};
my @stat = stat($dest);
ok $stat[4] == $newuid, q{result owner};
ok $stat[5] == $newgid, q{result group};
@@ -1401,8 +1401,8 @@
$newuid = getpwnam q{root};
$newgid = getgrnam q{root};
- ok PFTools::Update::Common::Do_chownmod( {}, $dest, $global_config ),
- q{execution of Do_chownmod default};
+ ok PFTools::Update::Common::do_chownmod( {}, $dest, $global_config ),
+ q{execution of do_chownmod default};
@stat = stat($dest);
ok $stat[4] == $newuid, q{result owner defaut};
ok $stat[5] == $newgid, q{result group défaut};
@@ -1411,8 +1411,8 @@
my $testdir = q{testownergroupmode.dir};
mkdir $testdir;
- ok PFTools::Update::Common::Do_chownmod( {}, $testdir, $global_config ),
- q{execution of Do_chownmod default (directory)};
+ ok PFTools::Update::Common::do_chownmod( {}, $testdir, $global_config ),
+ q{execution of do_chownmod default (directory)};
@stat = stat($testdir);
ok $stat[4] == $newuid, q{result owner default (directory)};
ok $stat[5] == $newgid, q{result group default (directory)};
diff -r 5650873f92c7 -r 5883cb175ea1 tools/Translate_old_config
--- a/tools/Translate_old_config Wed Dec 03 18:21:51 2014 +0100
+++ b/tools/Translate_old_config Fri Dec 05 11:18:02 2014 +0100
@@ -131,7 +131,7 @@
}
else {
$current_section
- = qq{CONFSITE_$options->{'site'}:/include-$1};
+ = qq{CONFIGSITE_$options->{'site'}:/include-$1};
}
}
push @included_list, qq{include-$1};
@@ -177,7 +177,7 @@
$current_section = qq{COMMON:/$1};
}
else {
- $current_section = qq{CONFSITE_$options->{'site'}:/$1};
+ $current_section = qq{CONFIGSITE_$options->{'site'}:/$1};
}
$trans->{$current_section} = { 'type' => 'include' };
@@ -385,7 +385,7 @@
);
$output_fh->print("\tsite\t= $site\n");
$output_fh->print(
- "\t\@host\t= CONFSITE_$site:/hostfile-$cleanhostname\n");
+ "\t\@host\t= CONFIGSITE_$site:/hostfile-$cleanhostname\n");
$output_fh->print("\n");
}
}
More information about the pf-tools-commits
mailing list