mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 16:55:05 +02:00
Merge branch '742-CLI-clean-conf-files-open' into 'pandora_6.0'
Fix --cli_clean_conf_file no agent param clean all conf files - #742 See merge request !472
This commit is contained in:
commit
d0d4936878
@ -3909,14 +3909,20 @@ sub cli_clean_conf_file() {
|
|||||||
my $list_command = 'ls '.$conf->{incomingdir}.'/conf/';
|
my $list_command = 'ls '.$conf->{incomingdir}.'/conf/';
|
||||||
my $out = `$list_command`;
|
my $out = `$list_command`;
|
||||||
my @files = split('\n',$out);
|
my @files = split('\n',$out);
|
||||||
|
my $files_count = 0;
|
||||||
# TODO: FINISH OPTION! NOW ONLY SHOW FILES
|
# TODO: FINISH OPTION! NOW ONLY SHOW FILES
|
||||||
foreach my $file (@files) {
|
foreach my $file (@files) {
|
||||||
# Get the md5 hash
|
# Get the md5 hash
|
||||||
my @filesplit = split('.',$file);
|
my @filesplit = split('.',$file);
|
||||||
$result = enterprise_hook('pandora_clean_conf_file',[$conf,$filesplit[0]]);
|
|
||||||
|
my $pos_conf = index($files[$files_count],".conf");
|
||||||
|
my $file_hash = substr($files[$files_count],0,$pos_conf);
|
||||||
|
|
||||||
|
$result = enterprise_hook('pandora_clean_conf_file',[$conf,$file_hash]);
|
||||||
if($result != -1) {
|
if($result != -1) {
|
||||||
print_log "[INFO] Conf file '".$conf->{incomingdir}.'/conf/'.$filesplit[0].".conf has been cleaned'\n\n";
|
print_log "[INFO] Conf file '".$conf->{incomingdir}.'/conf/'.$file_hash.".conf has been cleaned'\n\n";
|
||||||
}
|
}
|
||||||
|
$files_count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user