Revision 2ef80588
[#1570] Ajout du TCP dans les tests personnalisés, ajouts de tests pour éviter des warnings PHP, prise en charge du futur champ vigilo_template
Change-Id: I8652384cd1116ce54cdc66e48977c5174b1188be
Reviewed-on: https://vigilo-dev.si.c-s.fr/review/2311
Reviewed-by: Francois POIROTTE <francois.poirotte@c-s.fr>
Tested-by: Francois POIROTTE <francois.poirotte@c-s.fr>
Vigilo/VigiloHost.php | ||
---|---|---|
43 | 43 |
if ($template_name && $template_name !== "N/A") { |
44 | 44 |
$this->children[] = new VigiloHostTemplate($this->computer->getField("template_name")); |
45 | 45 |
} |
46 |
$refs = array( |
|
46 |
/*$refs = array(
|
|
47 | 47 |
"glpi_operatingsystems" => "operatingsystems_id", |
48 | 48 |
"glpi_operatingsystemversions" => "operatingsystemversions_id", |
49 | 49 |
"glpi_operatingsystemservicepacks" => "operatingsystemservicepacks_id", |
... | ... | |
66 | 66 |
$model = implode(" - ", $model); |
67 | 67 |
} |
68 | 68 |
|
69 |
$this->children[] = new VigiloHostTemplate($model); |
|
69 |
$this->children[] = new VigiloHostTemplate($model);*/ |
|
70 |
|
|
71 |
|
|
72 |
$template_number = $this->computer->getField("vigilo_template"); |
|
73 |
if ($template_number !== '0') { |
|
74 |
$common_dbtm = new CommonDBTM(); |
|
75 |
$template_name = $this->computer->getVigiloTemplateName($template_number); |
|
76 |
} |
|
77 |
else { |
|
78 |
$template_name = "default"; |
|
79 |
} |
|
80 |
$this->children[] = new VigiloHostTemplate($template_name); |
|
70 | 81 |
} |
71 | 82 |
|
72 | 83 |
protected function selectGroups() |
Vigilo/VigiloTestSoftware.php | ||
---|---|---|
30 | 30 |
} |
31 | 31 |
else |
32 | 32 |
{ |
33 |
if (!array_key_exists($softwareName, $this->softwareBase)) |
|
34 |
{ |
|
35 |
return; |
|
36 |
} |
|
33 | 37 |
$functionArray=$this->softwareBase[$softwareName]; |
34 |
}
|
|
38 |
}
|
|
35 | 39 |
$this->testTable[]=call_user_func_array(array($this,$functionArray[0]), $functionArray[1]); |
36 | 40 |
} |
37 | 41 |
|
... | ... | |
40 | 44 |
$software_name = str_replace('vigilo-test-', '', $softwareName); |
41 | 45 |
$explode_software_name = explode('-', $software_name, 2); |
42 | 46 |
$args=array(); |
43 |
switch($explode_software_name[0])
|
|
47 |
switch(strtolower($explode_software_name[0]))
|
|
44 | 48 |
{ |
45 |
case "process": $args[]=new VigiloArg('processname', $explode_software_name[1]); break; |
|
46 |
case "service": $args[]=new VigiloArg('svcname', $explode_software_name[1]); break; |
|
49 |
case "process": |
|
50 |
$args[]=new VigiloArg('processname', $explode_software_name[1]); |
|
51 |
$explode_software_name[0] = "Process"; |
|
52 |
break; |
|
53 |
case "service": |
|
54 |
$args[]=new VigiloArg('svcname', $explode_software_name[1]); |
|
55 |
$explode_software_name[0] = "Service"; |
|
56 |
break; |
|
57 |
case "tcp": |
|
58 |
$args[]=new VigiloArg('port', $explode_software_name[1]); |
|
59 |
$explode_software_name[0] = "TCP"; |
|
60 |
break; |
|
47 | 61 |
default: return; |
48 | 62 |
} |
49 | 63 |
|
50 |
return new VigiloTest(ucfirst($explode_software_name[0]), $args);
|
|
64 |
return new VigiloTest($explode_software_name[0], $args);
|
|
51 | 65 |
} |
52 | 66 |
|
53 | 67 |
protected function addNTPTest() |
hook.php | ||
---|---|---|
18 | 18 |
$confdir = implode(DIRECTORY_SEPARATOR, $dirs); |
19 | 19 |
$file = $confdir . DIRECTORY_SEPARATOR . "groups.xml"; |
20 | 20 |
|
21 |
mkdir($confdir, 0770, true); |
|
21 |
if (!file_exists($confdir)) { |
|
22 |
mkdir($confdir, 0770, true); |
|
23 |
} |
|
24 |
|
|
22 | 25 |
$acc = ""; |
23 | 26 |
foreach ($dirs as $dir) { |
24 | 27 |
$acc .= DIRECTORY_SEPARATOR . $dir; |
... | ... | |
40 | 43 |
$confdir = implode(DIRECTORY_SEPARATOR, $dirs); |
41 | 44 |
$file = $confdir . DIRECTORY_SEPARATOR . $host->getName() . ".xml"; |
42 | 45 |
|
43 |
mkdir($confdir, 0770, true); |
|
46 |
if (!file_exists($confdir)) { |
|
47 |
mkdir($confdir, 0770, true); |
|
48 |
} |
|
44 | 49 |
$acc = ""; |
45 | 50 |
foreach ($dirs as $dir) { |
46 | 51 |
$acc .= DIRECTORY_SEPARATOR . $dir; |
... | ... | |
126 | 131 |
public function manageNetworks($network) |
127 | 132 |
{ |
128 | 133 |
global $DB; |
129 |
; |
|
130 | 134 |
$id=$network->getField('items_id'); |
131 | 135 |
$comp=new Computer(); |
132 | 136 |
$comp->getFromDB($id); |
setup.php | ||
---|---|---|
36 | 36 |
"Location" => array($hookObj,"updateGroups"), |
37 | 37 |
"Computer_SoftwareVersion" => array($hookObj, "manageComputerSoftwareVersion"), |
38 | 38 |
"Entity" => array($hookObj,"updateGroups"), |
39 |
"Manufacturer" => array($hookObj,"updateGroups")); |
|
39 |
"Manufacturer" => array($hookObj,"updateGroups"));
|
|
40 | 40 |
$hooks['item_purge'][$p] = array("Computer" => array($hookObj, "delete"), |
41 | 41 |
"ComputerDisk" => array($hookObj,"manageDisks"), |
42 | 42 |
"NetworkPort" => array($hookObj,"manageNetworks"), |
Also available in: Unified diff