/[cvs]/nfo/perl/scripts/umltools/UML/Validate.pm
ViewVC logotype

Annotation of /nfo/perl/scripts/umltools/UML/Validate.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (hide annotations) (vendor branch)
Tue Oct 22 02:25:56 2002 UTC (21 years, 6 months ago) by joko
Branch: nfo, MAIN
CVS Tags: v000, HEAD
Changes since 1.1: +0 -0 lines
+ initial import


1 joko 1.1 package UML::Validate;
2    
3     use strict;
4     use warnings;
5    
6     use UML::Clone;
7    
8     # output checks?
9     my $check = 1;
10    
11     # die on error?
12     my $bool_DieOnError;
13    
14     sub evalCheck {
15     my $positive = shift;
16     if ($positive) {
17     print "ok", "\n";
18     return 1;
19     } else {
20     print "failed", "\n";
21     if ($bool_DieOnError) {
22     die("exiting task via die");
23     } else {
24     return 0;
25     }
26     }
27     }
28    
29     sub do {
30    
31     my $vhost_name = shift;
32     my $args_r = shift;
33     my %args = %{$args_r};
34    
35     $check = $args{'check'};
36     $bool_DieOnError = $args{'die'};
37    
38     # check in config
39     print " - checking for \"$vhost_name\" in configuration ...";
40     my $vhost = get_vhost_cfg($vhost_name);
41     my %vhost;
42     my $res = eval { %vhost = %{$vhost}; };
43     if (!evalCheck($res)) {
44     die("no config, no way!");
45     }
46    
47     my $vhost_path = get_vhost_basepath($vhost_name);
48    
49     # check path
50     print " - checking for main-path ...";
51     evalCheck(-d $vhost_path);
52    
53     # check rootfs
54     print " - checking for rootfs ...";
55     my $rootfs = $vhost_path . '/rootfs/' . $vhost{'rootfs'};
56     evalCheck(-f $rootfs);
57    
58     # check for datafs
59     print " - checking for datafs ...";
60     my $datafs = $vhost_path . '/datafs/' . $vhost{'datafs'};
61     evalCheck(-f $datafs);
62    
63     # check for swapfs
64     print " - checking for swapfs ...";
65     my $swapfs = $vhost_path . '/' . $vhost{'swapfs'};
66     evalCheck(-f $swapfs);
67    
68     # check for tap-device
69     my $tapdevice = '/proc/sys/net/ipv4/conf/' . $vhost{'bridge'}{'device'};
70     print " - checking for tap-device \"$tapdevice\" ...";
71     evalCheck(-e $tapdevice);
72    
73     return 1;
74    
75     }
76    
77     1;

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed