-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Description

PuppetGUI somehow created a server in database without a role. There is a row in the servers table, but there is not a matching row that references the server in the table roles. Because of that the service is interpreted as a null service resulting in not showing an icon of the role (orange) and you can't seem to be able to delete the service if you press delete.
Solution is to add the needed data to the table roles and reference the server that had no role. After that the server can be deleted by pressing the delete button.
The problem can be solved in file /app/routes/servers.js on delete route.
router.delete('/:hostname', function (req, res, next) {
var hostname = req.params.hostname;
database.query('DELETE servers FROM servers JOIN roles ON servers.id = roles.fk_server WHERE servers.hostname = \'' + hostname + '\'', function (err, rows, field) {
if (err) {
res.send(JSON.stringify({ error: 'could not delete from database' }));
}
res.send(JSON.stringify({ error: 'ok' }));
});
});
DELETE joins two tables, and if the row does not exist in the roles table then the command fails and delete does not happen.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels