From 9507d838668846666d2c790a0a1e6e51eb8670de Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Fri, 4 Jan 2008 16:50:15 +0000 Subject: more refactoring (not limited to attribute handling) * completed separation of attributes and standard (column) values * improved tests a lot That work is still not finished, so expect things to fail horribly. git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1443 95ad53e4-c205-0410-b2fa-d234c58c8868 --- config-db/t/25-attributes.t | 929 ++++++++++++++++++++++---------------------- 1 file changed, 468 insertions(+), 461 deletions(-) (limited to 'config-db/t/25-attributes.t') diff --git a/config-db/t/25-attributes.t b/config-db/t/25-attributes.t index fe684679..ce83d037 100644 --- a/config-db/t/25-attributes.t +++ b/config-db/t/25-attributes.t @@ -1,5 +1,8 @@ use Test::More qw(no_plan); +use strict; +use warnings; + use lib '/opt/openslx/lib'; # basic init @@ -9,114 +12,114 @@ my $configDB = OpenSLX::ConfigDB->new; $configDB->connect(); my $defaultAttrs = { # mostly copied from DBSchema - 'attr_ramfs_fsmods' => '', - 'attr_ramfs_miscmods' => '', - 'attr_ramfs_nicmods' => 'forcedeth e1000 e100 tg3 via-rhine r8169 pcnet32', - 'attr_ramfs_screen' => '', - - 'attr_automnt_dir' => '', - 'attr_automnt_src' => '', - 'attr_country' => 'de', - 'attr_dm_allow_shutdown' => 'user', - 'attr_hw_graphic' => '', - 'attr_hw_monitor' => '', - 'attr_hw_mouse' => '', - 'attr_late_dm' => 'no', - 'attr_netbios_workgroup' => 'slx-network', - 'attr_nis_domain' => '', - 'attr_nis_servers' => '', - 'attr_sane_scanner' => '', - 'attr_scratch' => '', - 'attr_slxgrp' => '', - 'attr_start_alsasound' => 'yes', - 'attr_start_atd' => 'no', - 'attr_start_cron' => 'no', - 'attr_start_dreshal' => 'yes', - 'attr_start_ntp' => 'initial', - 'attr_start_nfsv4' => 'no', - 'attr_start_printer' => 'no', - 'attr_start_samba' => 'may', - 'attr_start_snmp' => 'no', - 'attr_start_sshd' => 'yes', - 'attr_start_syslog' => 'yes', - 'attr_start_x' => 'yes', - 'attr_start_xdmcp' => 'kdm', - 'attr_tex_enable' => 'no', - 'attr_timezone' => 'Europe/Berlin', - 'attr_tvout' => 'no', - 'attr_vmware' => 'no', + 'ramfs_fsmods' => '', + 'ramfs_miscmods' => '', + 'ramfs_nicmods' => 'forcedeth e1000 e100 tg3 via-rhine r8169 pcnet32', + 'ramfs_screen' => '', + + 'automnt_dir' => '', + 'automnt_src' => '', + 'country' => 'de', + 'dm_allow_shutdown' => 'user', + 'hw_graphic' => '', + 'hw_monitor' => '', + 'hw_mouse' => '', + 'late_dm' => 'no', + 'netbios_workgroup' => 'slx-network', + 'nis_domain' => '', + 'nis_servers' => '', + 'sane_scanner' => '', + 'scratch' => '', + 'slxgrp' => '', + 'start_alsasound' => 'yes', + 'start_atd' => 'no', + 'start_cron' => 'no', + 'start_dreshal' => 'yes', + 'start_ntp' => 'initial', + 'start_nfsv4' => 'no', + 'start_printer' => 'no', + 'start_samba' => 'may', + 'start_snmp' => 'no', + 'start_sshd' => 'yes', + 'start_syslog' => 'yes', + 'start_x' => 'yes', + 'start_xdmcp' => 'kdm', + 'tex_enable' => 'no', + 'timezone' => 'Europe/Berlin', + 'tvout' => 'no', + 'vmware' => 'no', }; ok( - $configDB->changeSystem(0, $defaultAttrs), + $configDB->changeSystem(0, { attrs => $defaultAttrs } ), 'attributes of default system have been set' ); my $defaultSystem = $configDB->fetchSystemByID(0); my $system1 = $configDB->fetchSystemByID(1); my $sys1Attrs = { - 'attr_ramfs_fsmods' => 'squashfs', - 'attr_ramfs_nicmods' => 'forcedeth e1000 r8169', - 'attr_start_x' => 'no', - 'attr_start_xdmcp' => '', + 'ramfs_fsmods' => 'squashfs', + 'ramfs_nicmods' => 'forcedeth e1000 r8169', + 'start_x' => 'no', + 'start_xdmcp' => '', }; ok( - $configDB->changeSystem(1, $sys1Attrs), + $configDB->changeSystem(1, { attrs => $sys1Attrs } ), 'attributes of system 1 have been set' ); my $system3 = $configDB->fetchSystemByID(3); my $sys3Attrs = { - 'attr_ramfs_fsmods' => '-4', - 'attr_ramfs_miscmods' => '-3', - 'attr_ramfs_nicmods' => '-2', - 'attr_ramfs_screen' => '-1', - - 'attr_automnt_dir' => '1', - 'attr_automnt_src' => '2', - 'attr_country' => '3', - 'attr_dm_allow_shutdown' => '4', - 'attr_hw_graphic' => '5', - 'attr_hw_monitor' => '6', - 'attr_hw_mouse' => '7', - 'attr_late_dm' => '8', - 'attr_netbios_workgroup' => '9', - 'attr_nis_domain' => '10', - 'attr_nis_servers' => '11', - 'attr_sane_scanner' => '12', - 'attr_scratch' => '13', - 'attr_slxgrp' => '14', - 'attr_start_alsasound' => '15', - 'attr_start_atd' => '16', - 'attr_start_cron' => '17', - 'attr_start_dreshal' => '18', - 'attr_start_ntp' => '19', - 'attr_start_nfsv4' => '20', - 'attr_start_printer' => '21', - 'attr_start_samba' => '22', - 'attr_start_snmp' => '23', - 'attr_start_sshd' => '24', - 'attr_start_syslog' => '25', - 'attr_start_x' => '26', - 'attr_start_xdmcp' => '27', - 'attr_tex_enable' => '28', - 'attr_timezone' => '29', - 'attr_tvout' => '30', - 'attr_vmware' => '31', + 'ramfs_fsmods' => '-4', + 'ramfs_miscmods' => '-3', + 'ramfs_nicmods' => '-2', + 'ramfs_screen' => '-1', + + 'automnt_dir' => '1', + 'automnt_src' => '2', + 'country' => '3', + 'dm_allow_shutdown' => '4', + 'hw_graphic' => '5', + 'hw_monitor' => '6', + 'hw_mouse' => '7', + 'late_dm' => '8', + 'netbios_workgroup' => '9', + 'nis_domain' => '10', + 'nis_servers' => '11', + 'sane_scanner' => '12', + 'scratch' => '13', + 'slxgrp' => '14', + 'start_alsasound' => '15', + 'start_atd' => '16', + 'start_cron' => '17', + 'start_dreshal' => '18', + 'start_ntp' => '19', + 'start_nfsv4' => '20', + 'start_printer' => '21', + 'start_samba' => '22', + 'start_snmp' => '23', + 'start_sshd' => '24', + 'start_syslog' => '25', + 'start_x' => '26', + 'start_xdmcp' => '27', + 'tex_enable' => '28', + 'timezone' => '29', + 'tvout' => '30', + 'vmware' => '31', }; ok( - $configDB->changeSystem(3, $sys3Attrs), + $configDB->changeSystem(3, { attrs => $sys3Attrs } ), 'attributes of system 3 have been set' ); my $defaultClient = $configDB->fetchClientByID(0); my $defaultClientAttrs = { # pretend the whole computer centre has been warped to London ;-) - 'attr_timezone' => 'Europe/London', + 'timezone' => 'Europe/London', # pretend we wanted to activate snmp globally (e.g. for testing) - 'attr_start_snmp' => 'yes', + 'start_snmp' => 'yes', }; ok( - $configDB->changeClient(0, $defaultClientAttrs), + $configDB->changeClient(0, { attrs => $defaultClientAttrs } ), 'attributes of default client have been set' ); @@ -124,42 +127,42 @@ ok( # default system attributes overruled by system attributes overruled by # default client attributes: my $shouldBeAttrs1 = { - 'attr_ramfs_fsmods' => 'squashfs', - 'attr_ramfs_miscmods' => '', - 'attr_ramfs_nicmods' => 'forcedeth e1000 r8169', - 'attr_ramfs_screen' => '', - - 'attr_automnt_dir' => '', - 'attr_automnt_src' => '', - 'attr_country' => 'de', - 'attr_dm_allow_shutdown' => 'user', - 'attr_hw_graphic' => '', - 'attr_hw_monitor' => '', - 'attr_hw_mouse' => '', - 'attr_late_dm' => 'no', - 'attr_netbios_workgroup' => 'slx-network', - 'attr_nis_domain' => '', - 'attr_nis_servers' => '', - 'attr_sane_scanner' => '', - 'attr_scratch' => '', - 'attr_slxgrp' => '', - 'attr_start_alsasound' => 'yes', - 'attr_start_atd' => 'no', - 'attr_start_cron' => 'no', - 'attr_start_dreshal' => 'yes', - 'attr_start_ntp' => 'initial', - 'attr_start_nfsv4' => 'no', - 'attr_start_printer' => 'no', - 'attr_start_samba' => 'may', - 'attr_start_snmp' => 'yes', - 'attr_start_sshd' => 'yes', - 'attr_start_syslog' => 'yes', - 'attr_start_x' => 'no', - 'attr_start_xdmcp' => '', - 'attr_tex_enable' => 'no', - 'attr_timezone' => 'Europe/London', - 'attr_tvout' => 'no', - 'attr_vmware' => 'no', + 'ramfs_fsmods' => 'squashfs', + 'ramfs_miscmods' => '', + 'ramfs_nicmods' => 'forcedeth e1000 r8169', + 'ramfs_screen' => '', + + 'automnt_dir' => '', + 'automnt_src' => '', + 'country' => 'de', + 'dm_allow_shutdown' => 'user', + 'hw_graphic' => '', + 'hw_monitor' => '', + 'hw_mouse' => '', + 'late_dm' => 'no', + 'netbios_workgroup' => 'slx-network', + 'nis_domain' => '', + 'nis_servers' => '', + 'sane_scanner' => '', + 'scratch' => '', + 'slxgrp' => '', + 'start_alsasound' => 'yes', + 'start_atd' => 'no', + 'start_cron' => 'no', + 'start_dreshal' => 'yes', + 'start_ntp' => 'initial', + 'start_nfsv4' => 'no', + 'start_printer' => 'no', + 'start_samba' => 'may', + 'start_snmp' => 'yes', + 'start_sshd' => 'yes', + 'start_syslog' => 'yes', + 'start_x' => 'no', + 'start_xdmcp' => '', + 'tex_enable' => 'no', + 'timezone' => 'Europe/London', + 'tvout' => 'no', + 'vmware' => 'no', }; my $mergedSystem1 = $configDB->fetchSystemByID(1); ok( @@ -168,49 +171,49 @@ ok( ); foreach my $key (sort keys %$shouldBeAttrs1) { is( - $mergedSystem1->{$key} || '', $shouldBeAttrs1->{$key} || '', + $mergedSystem1->{attrs}->{$key}, $shouldBeAttrs1->{$key}, "checking merged attribute $key for system 1" ); } # check merging code for completeness (using all attributes): my $shouldBeAttrs3 = { - 'attr_ramfs_fsmods' => '-4', - 'attr_ramfs_miscmods' => '-3', - 'attr_ramfs_nicmods' => '-2', - 'attr_ramfs_screen' => '-1', - - 'attr_automnt_dir' => '1', - 'attr_automnt_src' => '2', - 'attr_country' => '3', - 'attr_dm_allow_shutdown' => '4', - 'attr_hw_graphic' => '5', - 'attr_hw_monitor' => '6', - 'attr_hw_mouse' => '7', - 'attr_late_dm' => '8', - 'attr_netbios_workgroup' => '9', - 'attr_nis_domain' => '10', - 'attr_nis_servers' => '11', - 'attr_sane_scanner' => '12', - 'attr_scratch' => '13', - 'attr_slxgrp' => '14', - 'attr_start_alsasound' => '15', - 'attr_start_atd' => '16', - 'attr_start_cron' => '17', - 'attr_start_dreshal' => '18', - 'attr_start_ntp' => '19', - 'attr_start_nfsv4' => '20', - 'attr_start_printer' => '21', - 'attr_start_samba' => '22', - 'attr_start_snmp' => 'yes', - 'attr_start_sshd' => '24', - 'attr_start_syslog' => '25', - 'attr_start_x' => '26', - 'attr_start_xdmcp' => '27', - 'attr_tex_enable' => '28', - 'attr_timezone' => 'Europe/London', - 'attr_tvout' => '30', - 'attr_vmware' => '31', + 'ramfs_fsmods' => '-4', + 'ramfs_miscmods' => '-3', + 'ramfs_nicmods' => '-2', + 'ramfs_screen' => '-1', + + 'automnt_dir' => '1', + 'automnt_src' => '2', + 'country' => '3', + 'dm_allow_shutdown' => '4', + 'hw_graphic' => '5', + 'hw_monitor' => '6', + 'hw_mouse' => '7', + 'late_dm' => '8', + 'netbios_workgroup' => '9', + 'nis_domain' => '10', + 'nis_servers' => '11', + 'sane_scanner' => '12', + 'scratch' => '13', + 'slxgrp' => '14', + 'start_alsasound' => '15', + 'start_atd' => '16', + 'start_cron' => '17', + 'start_dreshal' => '18', + 'start_ntp' => '19', + 'start_nfsv4' => '20', + 'start_printer' => '21', + 'start_samba' => '22', + 'start_snmp' => 'yes', + 'start_sshd' => '24', + 'start_syslog' => '25', + 'start_x' => '26', + 'start_xdmcp' => '27', + 'tex_enable' => '28', + 'timezone' => 'Europe/London', + 'tvout' => '30', + 'vmware' => '31', }; my $mergedSystem3 = $configDB->fetchSystemByID(3); ok( @@ -219,7 +222,7 @@ ok( ); foreach my $key (sort keys %$shouldBeAttrs3) { is( - $mergedSystem3->{$key}, $shouldBeAttrs3->{$key}, + $mergedSystem3->{attrs}->{$key}, $shouldBeAttrs3->{$key}, "checking merged attribute $key for system 3" ); } @@ -229,34 +232,34 @@ my $group1 = $configDB->fetchGroupByID(1); my $group1Attrs = { 'priority' => '50', # this group of clients is connected via underwater cable ... - 'attr_timezone' => 'America/New_York', + 'timezone' => 'America/New_York', # ... and use a local scratch partition - 'attr_scratch' => '/dev/sdd1', + 'scratch' => '/dev/sdd1', # the following should be a noop (as that attribute is system-specific) -# 'attr_ramfs_nicmods' => 'e1000', +# 'ramfs_nicmods' => 'e1000', }; ok( - $configDB->changeGroup(1, $group1Attrs), + $configDB->changeGroup(1, { attrs => $group1Attrs } ), 'attributes of group 1 have been set' ); my $group3 = $configDB->fetchGroupByID(3); my $group3Attrs = { 'priority' => '30', # this specific client group is older and thus has a different scratch - 'attr_scratch' => '/dev/hdd1', - 'attr_vmware' => 'yes', + 'scratch' => '/dev/hdd1', + 'vmware' => 'yes', }; ok( - $configDB->changeGroup(3, $group3Attrs), + $configDB->changeGroup(3, { attrs => $group3Attrs } ), 'attributes of group 3 have been set' ); my $client1 = $configDB->fetchClientByID(1); my $client1Attrs = { # this specific client uses yet another local scratch partition - 'attr_scratch' => '/dev/sdx3', + 'scratch' => '/dev/sdx3', }; ok( - $configDB->changeClient(1, $client1Attrs), + $configDB->changeClient(1, { attrs => $client1Attrs } ), 'attributes of client 1 have been set' ); ok( @@ -272,42 +275,42 @@ ok( # default client attributes overruled by group attributes (ordererd by priority) # overruled by specific client attributes: $shouldBeAttrs1 = { - 'attr_ramfs_fsmods' => '', - 'attr_ramfs_miscmods' => '', - 'attr_ramfs_nicmods' => '', - 'attr_ramfs_screen' => '', - - 'attr_automnt_dir' => '', - 'attr_automnt_src' => '', - 'attr_country' => '', - 'attr_dm_allow_shutdown' => '', - 'attr_hw_graphic' => '', - 'attr_hw_monitor' => '', - 'attr_hw_mouse' => '', - 'attr_late_dm' => '', - 'attr_netbios_workgroup' => '', - 'attr_nis_domain' => '', - 'attr_nis_servers' => '', - 'attr_sane_scanner' => '', - 'attr_scratch' => '/dev/sdx3', - 'attr_slxgrp' => '', - 'attr_start_alsasound' => '', - 'attr_start_atd' => '', - 'attr_start_cron' => '', - 'attr_start_dreshal' => '', - 'attr_start_ntp' => '', - 'attr_start_nfsv4' => '', - 'attr_start_printer' => '', - 'attr_start_samba' => '', - 'attr_start_snmp' => 'yes', - 'attr_start_sshd' => '', - 'attr_start_syslog' => '', - 'attr_start_x' => '', - 'attr_start_xdmcp' => '', - 'attr_tex_enable' => '', - 'attr_timezone' => 'America/New_York', - 'attr_tvout' => '', - 'attr_vmware' => '', + 'ramfs_fsmods' => '', + 'ramfs_miscmods' => '', + 'ramfs_nicmods' => '', + 'ramfs_screen' => '', + + 'automnt_dir' => '', + 'automnt_src' => '', + 'country' => '', + 'dm_allow_shutdown' => '', + 'hw_graphic' => '', + 'hw_monitor' => '', + 'hw_mouse' => '', + 'late_dm' => '', + 'netbios_workgroup' => '', + 'nis_domain' => '', + 'nis_servers' => '', + 'sane_scanner' => '', + 'scratch' => '/dev/sdx3', + 'slxgrp' => '', + 'start_alsasound' => '', + 'start_atd' => '', + 'start_cron' => '', + 'start_dreshal' => '', + 'start_ntp' => '', + 'start_nfsv4' => '', + 'start_printer' => '', + 'start_samba' => '', + 'start_snmp' => 'yes', + 'start_sshd' => '', + 'start_syslog' => '', + 'start_x' => '', + 'start_xdmcp' => '', + 'tex_enable' => '', + 'timezone' => 'America/New_York', + 'tvout' => '', + 'vmware' => '', }; my $mergedClient1 = $configDB->fetchClientByID(1); ok( @@ -316,49 +319,53 @@ ok( ); foreach my $key (sort keys %$shouldBeAttrs1) { is( - $mergedClient1->{$key} || '', $shouldBeAttrs1->{$key} || '', + $mergedClient1->{attrs}->{$key} || '', $shouldBeAttrs1->{$key} || '', "checking merged attribute $key for client 1" ); } $shouldBeAttrs3 = { - 'attr_ramfs_fsmods' => '', - 'attr_ramfs_miscmods' => '', - 'attr_ramfs_nicmods' => '', - 'attr_ramfs_screen' => '', - - 'attr_automnt_dir' => '', - 'attr_automnt_src' => '', - 'attr_country' => '', - 'attr_dm_allow_shutdown' => '', - 'attr_hw_graphic' => '', - 'attr_hw_monitor' => '', - 'attr_hw_mouse' => '', - 'attr_late_dm' => '', - 'attr_netbios_workgroup' => '', - 'attr_nis_domain' => '', - 'attr_nis_servers' => '', - 'attr_sane_scanner' => '', - 'attr_scratch' => '', - 'attr_slxgrp' => '', - 'attr_start_alsasound' => '', - 'attr_start_atd' => '', - 'attr_start_cron' => '', - 'attr_start_dreshal' => '', - 'attr_start_ntp' => '', - 'attr_start_nfsv4' => '', - 'attr_start_printer' => '', - 'attr_start_samba' => '', - 'attr_start_snmp' => 'yes', - 'attr_start_sshd' => '', - 'attr_start_syslog' => '', - 'attr_start_x' => '', - 'attr_start_xdmcp' => '', - 'attr_tex_enable' => '', - 'attr_timezone' => 'Europe/London', - 'attr_tvout' => '', - 'attr_vmware' => '', + 'ramfs_fsmods' => '', + 'ramfs_miscmods' => '', + 'ramfs_nicmods' => '', + 'ramfs_screen' => '', + + 'automnt_dir' => '', + 'automnt_src' => '', + 'country' => '', + 'dm_allow_shutdown' => '', + 'hw_graphic' => '', + 'hw_monitor' => '', + 'hw_mouse' => '', + 'late_dm' => '', + 'netbios_workgroup' => '', + 'nis_domain' => '', + 'nis_servers' => '', + 'sane_scanner' => '', + 'scratch' => '', + 'slxgrp' => '', + 'start_alsasound' => '', + 'start_atd' => '', + 'start_cron' => '', + 'start_dreshal' => '', + 'start_ntp' => '', + 'start_nfsv4' => '', + 'start_printer' => '', + 'start_samba' => '', + 'start_snmp' => 'yes', + 'start_sshd' => '', + 'start_syslog' => '', + 'start_x' => '', + 'start_xdmcp' => '', + 'tex_enable' => '', + 'timezone' => 'Europe/London', + 'tvout' => '', + 'vmware' => '', }; + +# remove all attributes from client 3 +$configDB->changeClient(3, { attrs => {} } ); + my $mergedClient3 = $configDB->fetchClientByID(3); ok( $configDB->mergeDefaultAndGroupAttributesIntoClient($mergedClient3), @@ -366,7 +373,7 @@ ok( ); foreach my $key (sort keys %$shouldBeAttrs1) { is( - $mergedClient3->{$key} || '', $shouldBeAttrs3->{$key} || '', + $mergedClient3->{attrs}->{$key} || '', $shouldBeAttrs3->{$key} || '', "checking merged attribute $key for client 3" ); } @@ -377,42 +384,42 @@ ok( 'group-IDs of default client have been set' ); $shouldBeAttrs1 = { - 'attr_ramfs_fsmods' => '', - 'attr_ramfs_miscmods' => '', - 'attr_ramfs_nicmods' => '', - 'attr_ramfs_screen' => '', - - 'attr_automnt_dir' => '', - 'attr_automnt_src' => '', - 'attr_country' => '', - 'attr_dm_allow_shutdown' => '', - 'attr_hw_graphic' => '', - 'attr_hw_monitor' => '', - 'attr_hw_mouse' => '', - 'attr_late_dm' => '', - 'attr_netbios_workgroup' => '', - 'attr_nis_domain' => '', - 'attr_nis_servers' => '', - 'attr_sane_scanner' => '', - 'attr_scratch' => '/dev/sdx3', - 'attr_slxgrp' => '', - 'attr_start_alsasound' => '', - 'attr_start_atd' => '', - 'attr_start_cron' => '', - 'attr_start_dreshal' => '', - 'attr_start_ntp' => '', - 'attr_start_nfsv4' => '', - 'attr_start_printer' => '', - 'attr_start_samba' => '', - 'attr_start_snmp' => 'yes', - 'attr_start_sshd' => '', - 'attr_start_syslog' => '', - 'attr_start_x' => '', - 'attr_start_xdmcp' => '', - 'attr_tex_enable' => '', - 'attr_timezone' => 'America/New_York', - 'attr_tvout' => '', - 'attr_vmware' => 'yes', + 'ramfs_fsmods' => '', + 'ramfs_miscmods' => '', + 'ramfs_nicmods' => '', + 'ramfs_screen' => '', + + 'automnt_dir' => '', + 'automnt_src' => '', + 'country' => '', + 'dm_allow_shutdown' => '', + 'hw_graphic' => '', + 'hw_monitor' => '', + 'hw_mouse' => '', + 'late_dm' => '', + 'netbios_workgroup' => '', + 'nis_domain' => '', + 'nis_servers' => '', + 'sane_scanner' => '', + 'scratch' => '/dev/sdx3', + 'slxgrp' => '', + 'start_alsasound' => '', + 'start_atd' => '', + 'start_cron' => '', + 'start_dreshal' => '', + 'start_ntp' => '', + 'start_nfsv4' => '', + 'start_printer' => '', + 'start_samba' => '', + 'start_snmp' => 'yes', + 'start_sshd' => '', + 'start_syslog' => '', + 'start_x' => '', + 'start_xdmcp' => '', + 'tex_enable' => '', + 'timezone' => 'America/New_York', + 'tvout' => '', + 'vmware' => 'yes', }; $mergedClient1 = $configDB->fetchClientByID(1); ok( @@ -421,48 +428,48 @@ ok( ); foreach my $key (sort keys %$shouldBeAttrs1) { is( - $mergedClient1->{$key} || '', $shouldBeAttrs1->{$key} || '', + $mergedClient1->{attrs}->{$key} || '', $shouldBeAttrs1->{$key} || '', "checking merged attribute $key for client 1" ); } $shouldBeAttrs3 = { - 'attr_ramfs_fsmods' => '', - 'attr_ramfs_miscmods' => '', - 'attr_ramfs_nicmods' => '', - 'attr_ramfs_screen' => '', - - 'attr_automnt_dir' => '', - 'attr_automnt_src' => '', - 'attr_country' => '', - 'attr_dm_allow_shutdown' => '', - 'attr_hw_graphic' => '', - 'attr_hw_monitor' => '', - 'attr_hw_mouse' => '', - 'attr_late_dm' => '', - 'attr_netbios_workgroup' => '', - 'attr_nis_domain' => '', - 'attr_nis_servers' => '', - 'attr_sane_scanner' => '', - 'attr_scratch' => '/dev/hdd1', - 'attr_slxgrp' => '', - 'attr_start_alsasound' => '', - 'attr_start_atd' => '', - 'attr_start_cron' => '', - 'attr_start_dreshal' => '', - 'attr_start_ntp' => '', - 'attr_start_nfsv4' => '', - 'attr_start_printer' => '', - 'attr_start_samba' => '', - 'attr_start_snmp' => 'yes', - 'attr_start_sshd' => '', - 'attr_start_syslog' => '', - 'attr_start_x' => '', - 'attr_start_xdmcp' => '', - 'attr_tex_enable' => '', - 'attr_timezone' => 'Europe/London', - 'attr_tvout' => '', - 'attr_vmware' => 'yes', + 'ramfs_fsmods' => '', + 'ramfs_miscmods' => '', + 'ramfs_nicmods' => '', + 'ramfs_screen' => '', + + 'automnt_dir' => '', + 'automnt_src' => '', + 'country' => '', + 'dm_allow_shutdown' => '', + 'hw_graphic' => '', + 'hw_monitor' => '', + 'hw_mouse' => '', + 'late_dm' => '', + 'netbios_workgroup' => '', + 'nis_domain' => '', + 'nis_servers' => '', + 'sane_scanner' => '', + 'scratch' => '/dev/hdd1', + 'slxgrp' => '', + 'start_alsasound' => '', + 'start_atd' => '', + 'start_cron' => '', + 'start_dreshal' => '', + 'start_ntp' => '', + 'start_nfsv4' => '', + 'start_printer' => '', + 'start_samba' => '', + 'start_snmp' => 'yes', + 'start_sshd' => '', + 'start_syslog' => '', + 'start_x' => '', + 'start_xdmcp' => '', + 'tex_enable' => '', + 'timezone' => 'Europe/London', + 'tvout' => '', + 'vmware' => 'yes', }; $mergedClient3 = $configDB->fetchClientByID(3); ok( @@ -471,7 +478,7 @@ ok( ); foreach my $key (sort keys %$shouldBeAttrs1) { is( - $mergedClient3->{$key} || '', $shouldBeAttrs3->{$key} || '', + $mergedClient3->{attrs}->{$key} || '', $shouldBeAttrs3->{$key} || '', "checking merged attribute $key for client 3" ); } @@ -483,46 +490,46 @@ ok( 'merging system 1 into client 1' ); my $shouldBeAttrs11 = { - 'attr_ramfs_fsmods' => 'squashfs', - 'attr_ramfs_miscmods' => '', - 'attr_ramfs_nicmods' => 'forcedeth e1000 r8169', - 'attr_ramfs_screen' => '', - - 'attr_automnt_dir' => '', - 'attr_automnt_src' => '', - 'attr_country' => 'de', - 'attr_dm_allow_shutdown' => 'user', - 'attr_hw_graphic' => '', - 'attr_hw_monitor' => '', - 'attr_hw_mouse' => '', - 'attr_late_dm' => 'no', - 'attr_netbios_workgroup' => 'slx-network', - 'attr_nis_domain' => '', - 'attr_nis_servers' => '', - 'attr_sane_scanner' => '', - 'attr_scratch' => '/dev/sdx3', - 'attr_slxgrp' => '', - 'attr_start_alsasound' => 'yes', - 'attr_start_atd' => 'no', - 'attr_start_cron' => 'no', - 'attr_start_dreshal' => 'yes', - 'attr_start_ntp' => 'initial', - 'attr_start_nfsv4' => 'no', - 'attr_start_printer' => 'no', - 'attr_start_samba' => 'may', - 'attr_start_snmp' => 'yes', - 'attr_start_sshd' => 'yes', - 'attr_start_syslog' => 'yes', - 'attr_start_x' => 'no', - 'attr_start_xdmcp' => '', - 'attr_tex_enable' => 'no', - 'attr_timezone' => 'America/New_York', - 'attr_tvout' => 'no', - 'attr_vmware' => 'yes', + 'ramfs_fsmods' => 'squashfs', + 'ramfs_miscmods' => '', + 'ramfs_nicmods' => 'forcedeth e1000 r8169', + 'ramfs_screen' => '', + + 'automnt_dir' => '', + 'automnt_src' => '', + 'country' => 'de', + 'dm_allow_shutdown' => 'user', + 'hw_graphic' => '', + 'hw_monitor' => '', + 'hw_mouse' => '', + 'late_dm' => 'no', + 'netbios_workgroup' => 'slx-network', + 'nis_domain' => '', + 'nis_servers' => '', + 'sane_scanner' => '', + 'scratch' => '/dev/sdx3', + 'slxgrp' => '', + 'start_alsasound' => 'yes', + 'start_atd' => 'no', + 'start_cron' => 'no', + 'start_dreshal' => 'yes', + 'start_ntp' => 'initial', + 'start_nfsv4' => 'no', + 'start_printer' => 'no', + 'start_samba' => 'may', + 'start_snmp' => 'yes', + 'start_sshd' => 'yes', + 'start_syslog' => 'yes', + 'start_x' => 'no', + 'start_xdmcp' => '', + 'tex_enable' => 'no', + 'timezone' => 'America/New_York', + 'tvout' => 'no', + 'vmware' => 'yes', }; foreach my $key (sort keys %$shouldBeAttrs11) { is( - $fullMerge11->{$key} || '', $shouldBeAttrs11->{$key} || '', + $fullMerge11->{attrs}->{$key} || '', $shouldBeAttrs11->{$key} || '', "checking merged attribute $key for client 1 / system 1" ); } @@ -533,46 +540,46 @@ ok( 'merging system 1 into client 3' ); my $shouldBeAttrs31 = { - 'attr_ramfs_fsmods' => 'squashfs', - 'attr_ramfs_miscmods' => '', - 'attr_ramfs_nicmods' => 'forcedeth e1000 r8169', - 'attr_ramfs_screen' => '', - - 'attr_automnt_dir' => '', - 'attr_automnt_src' => '', - 'attr_country' => 'de', - 'attr_dm_allow_shutdown' => 'user', - 'attr_hw_graphic' => '', - 'attr_hw_monitor' => '', - 'attr_hw_mouse' => '', - 'attr_late_dm' => 'no', - 'attr_netbios_workgroup' => 'slx-network', - 'attr_nis_domain' => '', - 'attr_nis_servers' => '', - 'attr_sane_scanner' => '', - 'attr_scratch' => '/dev/hdd1', - 'attr_slxgrp' => '', - 'attr_start_alsasound' => 'yes', - 'attr_start_atd' => 'no', - 'attr_start_cron' => 'no', - 'attr_start_dreshal' => 'yes', - 'attr_start_ntp' => 'initial', - 'attr_start_nfsv4' => 'no', - 'attr_start_printer' => 'no', - 'attr_start_samba' => 'may', - 'attr_start_snmp' => 'yes', - 'attr_start_sshd' => 'yes', - 'attr_start_syslog' => 'yes', - 'attr_start_x' => 'no', - 'attr_start_xdmcp' => '', - 'attr_tex_enable' => 'no', - 'attr_timezone' => 'Europe/London', - 'attr_tvout' => 'no', - 'attr_vmware' => 'yes', + 'ramfs_fsmods' => 'squashfs', + 'ramfs_miscmods' => '', + 'ramfs_nicmods' => 'forcedeth e1000 r8169', + 'ramfs_screen' => '', + + 'automnt_dir' => '', + 'automnt_src' => '', + 'country' => 'de', + 'dm_allow_shutdown' => 'user', + 'hw_graphic' => '', + 'hw_monitor' => '', + 'hw_mouse' => '', + 'late_dm' => 'no', + 'netbios_workgroup' => 'slx-network', + 'nis_domain' => '', + 'nis_servers' => '', + 'sane_scanner' => '', + 'scratch' => '/dev/hdd1', + 'slxgrp' => '', + 'start_alsasound' => 'yes', + 'start_atd' => 'no', + 'start_cron' => 'no', + 'start_dreshal' => 'yes', + 'start_ntp' => 'initial', + 'start_nfsv4' => 'no', + 'start_printer' => 'no', + 'start_samba' => 'may', + 'start_snmp' => 'yes', + 'start_sshd' => 'yes', + 'start_syslog' => 'yes', + 'start_x' => 'no', + 'start_xdmcp' => '', + 'tex_enable' => 'no', + 'timezone' => 'Europe/London', + 'tvout' => 'no', + 'vmware' => 'yes', }; foreach my $key (sort keys %$shouldBeAttrs31) { is( - $fullMerge31->{$key} || '', $shouldBeAttrs31->{$key} || '', + $fullMerge31->{attrs}->{$key} || '', $shouldBeAttrs31->{$key} || '', "checking merged attribute $key for client 3 / system 1" ); } @@ -583,46 +590,46 @@ ok( 'merging system 3 into client 1' ); my $shouldBeAttrs13 = { - 'attr_ramfs_fsmods' => '-4', - 'attr_ramfs_miscmods' => '-3', - 'attr_ramfs_nicmods' => '-2', - 'attr_ramfs_screen' => '-1', - - 'attr_automnt_dir' => '1', - 'attr_automnt_src' => '2', - 'attr_country' => '3', - 'attr_dm_allow_shutdown' => '4', - 'attr_hw_graphic' => '5', - 'attr_hw_monitor' => '6', - 'attr_hw_mouse' => '7', - 'attr_late_dm' => '8', - 'attr_netbios_workgroup' => '9', - 'attr_nis_domain' => '10', - 'attr_nis_servers' => '11', - 'attr_sane_scanner' => '12', - 'attr_scratch' => '/dev/sdx3', - 'attr_slxgrp' => '14', - 'attr_start_alsasound' => '15', - 'attr_start_atd' => '16', - 'attr_start_cron' => '17', - 'attr_start_dreshal' => '18', - 'attr_start_ntp' => '19', - 'attr_start_nfsv4' => '20', - 'attr_start_printer' => '21', - 'attr_start_samba' => '22', - 'attr_start_snmp' => 'yes', - 'attr_start_sshd' => '24', - 'attr_start_syslog' => '25', - 'attr_start_x' => '26', - 'attr_start_xdmcp' => '27', - 'attr_tex_enable' => '28', - 'attr_timezone' => 'America/New_York', - 'attr_tvout' => '30', - 'attr_vmware' => 'yes', + 'ramfs_fsmods' => '-4', + 'ramfs_miscmods' => '-3', + 'ramfs_nicmods' => '-2', + 'ramfs_screen' => '-1', + + 'automnt_dir' => '1', + 'automnt_src' => '2', + 'country' => '3', + 'dm_allow_shutdown' => '4', + 'hw_graphic' => '5', + 'hw_monitor' => '6', + 'hw_mouse' => '7', + 'late_dm' => '8', + 'netbios_workgroup' => '9', + 'nis_domain' => '10', + 'nis_servers' => '11', + 'sane_scanner' => '12', + 'scratch' => '/dev/sdx3', + 'slxgrp' => '14', + 'start_alsasound' => '15', + 'start_atd' => '16', + 'start_cron' => '17', + 'start_dreshal' => '18', + 'start_ntp' => '19', + 'start_nfsv4' => '20', + 'start_printer' => '21', + 'start_samba' => '22', + 'start_snmp' => 'yes', + 'start_sshd' => '24', + 'start_syslog' => '25', + 'start_x' => '26', + 'start_xdmcp' => '27', + 'tex_enable' => '28', + 'timezone' => 'America/New_York', + 'tvout' => '30', + 'vmware' => 'yes', }; foreach my $key (sort keys %$shouldBeAttrs13) { is( - $fullMerge13->{$key} || '', $shouldBeAttrs13->{$key} || '', + $fullMerge13->{attrs}->{$key} || '', $shouldBeAttrs13->{$key} || '', "checking merged attribute $key for client 1 / system 3" ); } @@ -633,46 +640,46 @@ ok( 'merging system 3 into client 3' ); my $shouldBeAttrs33 = { - 'attr_ramfs_fsmods' => '-4', - 'attr_ramfs_miscmods' => '-3', - 'attr_ramfs_nicmods' => '-2', - 'attr_ramfs_screen' => '-1', - - 'attr_automnt_dir' => '1', - 'attr_automnt_src' => '2', - 'attr_country' => '3', - 'attr_dm_allow_shutdown' => '4', - 'attr_hw_graphic' => '5', - 'attr_hw_monitor' => '6', - 'attr_hw_mouse' => '7', - 'attr_late_dm' => '8', - 'attr_netbios_workgroup' => '9', - 'attr_nis_domain' => '10', - 'attr_nis_servers' => '11', - 'attr_sane_scanner' => '12', - 'attr_scratch' => '/dev/hdd1', - 'attr_slxgrp' => '14', - 'attr_start_alsasound' => '15', - 'attr_start_atd' => '16', - 'attr_start_cron' => '17', - 'attr_start_dreshal' => '18', - 'attr_start_ntp' => '19', - 'attr_start_nfsv4' => '20', - 'attr_start_printer' => '21', - 'attr_start_samba' => '22', - 'attr_start_snmp' => 'yes', - 'attr_start_sshd' => '24', - 'attr_start_syslog' => '25', - 'attr_start_x' => '26', - 'attr_start_xdmcp' => '27', - 'attr_tex_enable' => '28', - 'attr_timezone' => 'Europe/London', - 'attr_tvout' => '30', - 'attr_vmware' => 'yes', + 'ramfs_fsmods' => '-4', + 'ramfs_miscmods' => '-3', + 'ramfs_nicmods' => '-2', + 'ramfs_screen' => '-1', + + 'automnt_dir' => '1', + 'automnt_src' => '2', + 'country' => '3', + 'dm_allow_shutdown' => '4', + 'hw_graphic' => '5', + 'hw_monitor' => '6', + 'hw_mouse' => '7', + 'late_dm' => '8', + 'netbios_workgroup' => '9', + 'nis_domain' => '10', + 'nis_servers' => '11', + 'sane_scanner' => '12', + 'scratch' => '/dev/hdd1', + 'slxgrp' => '14', + 'start_alsasound' => '15', + 'start_atd' => '16', + 'start_cron' => '17', + 'start_dreshal' => '18', + 'start_ntp' => '19', + 'start_nfsv4' => '20', + 'start_printer' => '21', + 'start_samba' => '22', + 'start_snmp' => 'yes', + 'start_sshd' => '24', + 'start_syslog' => '25', + 'start_x' => '26', + 'start_xdmcp' => '27', + 'tex_enable' => '28', + 'timezone' => 'Europe/London', + 'tvout' => '30', + 'vmware' => 'yes', }; foreach my $key (sort keys %$shouldBeAttrs33) { is( - $fullMerge33->{$key} || '', $shouldBeAttrs33->{$key} || '', + $fullMerge33->{attrs}->{$key} || '', $shouldBeAttrs33->{$key} || '', "checking merged attribute $key for client 3 / system 3" ); } -- cgit v1.2.3-55-g7522