mclarkson/nagrestconf

Unable to add hosts using bulkupload

Opened this issue · 1 comments

Hi There,

I am getting below error while adding hosts using bulkupload tool. Tried on IE, Chrome and Firefox.
.csv file is successfully getting uploaded to uploads folder, but while applying below fakepath error is throwing.

Could not find file, "C: akepath est.csv".

image

Thanks,
Jubin

I know that this is an old issue, but I just ran into it today.
This is my quick fix to get around this error incase anyone else comes across it.

Apparently PHP is prepending the C:\fakepath\ to the filename and causing an issue with the csv2json.sh shell script.

I had to remove the C:\fakepath\ text and then it would run the shell script correctly.

plugins-lib/smorg_hosts_bulktools_btn_impl.php line 831

$csvfile = str_replace( "C:\\fakepath\\", '', $query_str["filename"] );
$cmd = "scripts/csv2json.sh \"upload/".$csvfile."\"";

a few lines down I fixed the error message not showing up.

$retval["message"] = "Error converting CSV. Exit Status: ".$exit_status." | Command: ".$cmd." | Output: ".$output;

Hopefully this will help someone else having the same issue.