mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-27 15:54:29 +02:00
Fixed problems with creating modules with CLI. Ticket: #4140
(cherry picked from commit c358f1195d4b14d80dc78a044bf965bc8fd98d8e)
This commit is contained in:
parent
78b1dd24f0
commit
d32b81ae1b
@ -1190,7 +1190,7 @@ sub cli_create_data_module($) {
|
|||||||
my $module_exists = get_agent_module_id($dbh, $module_name, $agent_id);
|
my $module_exists = get_agent_module_id($dbh, $module_name, $agent_id);
|
||||||
non_exist_check($module_exists, 'module name', $module_name);
|
non_exist_check($module_exists, 'module name', $module_name);
|
||||||
|
|
||||||
print_log "[INFO] Adding module '$module_name' to agent '$agent_name'\n\n";
|
#~ print_log "[INFO] Adding module '$module_name' to agent '$agent_name'\n\n";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$policy_id = enterprise_hook('get_policy_id',[$dbh, safe_input($policy_name)]);
|
$policy_id = enterprise_hook('get_policy_id',[$dbh, safe_input($policy_name)]);
|
||||||
@ -1199,7 +1199,7 @@ sub cli_create_data_module($) {
|
|||||||
my $policy_module_exist = enterprise_hook('get_policy_module_id',[$dbh, $policy_id, $module_name]);
|
my $policy_module_exist = enterprise_hook('get_policy_module_id',[$dbh, $policy_id, $module_name]);
|
||||||
non_exist_check($policy_module_exist,'policy module',$module_name);
|
non_exist_check($policy_module_exist,'policy module',$module_name);
|
||||||
|
|
||||||
print_log "[INFO] Adding module '$module_name' to policy '$policy_name'\n\n";
|
#~ print_log "[INFO] Adding module '$module_name' to policy '$policy_name'\n\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
$module_name_def = $module_name;
|
$module_name_def = $module_name;
|
||||||
@ -1238,6 +1238,15 @@ sub cli_create_data_module($) {
|
|||||||
enterprise_hook('pandora_update_md5_file', [$conf, $agent_name]);
|
enterprise_hook('pandora_update_md5_file', [$conf, $agent_name]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($in_policy == 0) {
|
||||||
|
non_exist_check($module_exists, 'module name', $module_name_def);
|
||||||
|
print_log "[INFO] Adding module '$module_name' to agent '$agent_name'\n\n";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
non_exist_check($policy_module_exist,'policy module',$module_name_def);
|
||||||
|
print_log "[INFO] Adding module '$module_name' to policy '$policy_name'\n\n";
|
||||||
|
}
|
||||||
|
|
||||||
if (defined($definition_file) && $module_type ne $module_type_def) {
|
if (defined($definition_file) && $module_type ne $module_type_def) {
|
||||||
$module_type = $module_type_def;
|
$module_type = $module_type_def;
|
||||||
print_log "[INFO] The module type has been forced to '$module_type' by the definition file\n\n";
|
print_log "[INFO] The module type has been forced to '$module_type' by the definition file\n\n";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user