So we took a look at our database and compared it to a fresh 1.2.0 database. The images table was missing the columns imageMagnetUri and imageFormat. After adding the columns (but not populating them), creating the image worked.
Thanks for the help!
So we took a look at our database and compared it to a fresh 1.2.0 database. The images table was missing the columns imageMagnetUri and imageFormat. After adding the columns (but not populating them), creating the image worked.
Thanks for the help!
Running:
SELECT imageID,imageName FROM images WHERE imageID=0;
returns:
Empty set (0.00 sec)
I actually just remembered that we have been having this problem after we updated the code from 1.1.2. After we updated, I had tried to edit an existing image and I was not able to. Looking at the php code, it seems that the same code is used for creating a new entry as updating an old one. So it seems to be an issue with our database.
Two things I noticed looking at our image entries in our database:
Would these cause an issue?
@Sebastian-Roth
The manual insert of ‘tst2’ worked (confirmed in the web interface). The ID returned by the second query was 70.
For the other parts of the database log, they appeared to be repeating entries (master-node related?)
342 Query SELECT * FROM `plugins` WHERE `pName` = 'location' AND `pInstalled` = '1' ORDER BY `pName` ASC
342 Query SELECT * FROM `plugins` WHERE `pName` = '' AND `pState` = '1' AND `pInstalled` = '1' ORDER BY `pName` ASC
342 Query SELECT * FROM `plugins` WHERE `pName` = '' AND `pState` = '1' AND `pInstalled` = '1' ORDER BY `pName` ASC
342 Query SELECT * FROM `plugins` WHERE `pName` = '' AND `pState` = '1' AND `pInstalled` = '1' ORDER BY `pName` ASC
342 Query SELECT * FROM `plugins` WHERE `pName` = 'accesscontrol' AND `pState` = '1' AND `pInstalled` = '1' ORDER BY `pName` ASC
342 Query SELECT * FROM `plugins` WHERE `pName` = 'accesscontrol' AND `pState` = '1' AND `pInstalled` = '1' ORDER BY `pName` ASC
342 Query SELECT * FROM `plugins` WHERE `pName` = 'accesscontrol' AND `pState` = '1' AND `pInstalled` = '1' ORDER BY `pName` ASC
342 Query SELECT * FROM `plugins` WHERE `pName` = 'capone' AND `pState` = '1' AND `pInstalled` = '1' ORDER BY `pName` ASC
342 Query SELECT * FROM `plugins` WHERE `pName` = 'capone' AND `pState` = '1' AND `pInstalled` = '1' ORDER BY `pName` ASC
342 Query SELECT * FROM `plugins` WHERE `pName` = 'example' AND `pState` = '1' AND `pInstalled` = '1' ORDER BY `pName` ASC
342 Query SELECT * FROM `plugins` WHERE `pName` = 'example' AND `pState` = '1' AND `pInstalled` = '1' ORDER BY `pName` ASC
342 Query SELECT * FROM `plugins` WHERE `pName` = 'location' AND `pState` = '1' AND `pInstalled` = '1' ORDER BY `pName` ASC
342 Query SELECT * FROM `plugins` WHERE `pName` = 'location' AND `pState` = '1' AND `pInstalled` = '1' ORDER BY `pName` ASC
342 Query SELECT * FROM `plugins` WHERE `pName` = 'location' AND `pState` = '1' AND `pInstalled` = '1' ORDER BY `pName` ASC
342 Query SELECT COUNT(imageID) AS total FROM `images` WHERE `imageName` = 'tst1' AND `imageID` <> '0'
342 Query INSERT INTO `images` (`imageName`, `imagePath`, `imageCreateBy`, `imageTypeID`, `imageNFSGroupID`, `imageOSID`) VALUES ('tst1', 'tst1', 'fog', '1', '1', '50') ON DUPLICATE KEY UPDATE `imageID` = '', `imageName` = 'tst1', `imageDesc` = '', `imagePath` = 'tst1', `imageBuilding` = '', `imageSize` = '', `imageTypeID` = '1', `imageNFSGroupID` = '1', `imageOSID` = '50', `imageLastDeploy` = '', `imageFormat` = '', `imageMagnetUri` = '', `imageID` = LAST_INSERT_ID(imageID)
342 Query INSERT INTO `history` (`hText`, `hUser`, `hTime`, `hIP`) VALUES ('Image created: ID: 0, Name: tst1', 'fog', '2016-03-24 19:54:05', 'myIP') ON DUPLICATE KEY UPDATE `hID` = '', `hText` = 'Image created: ID: 0, Name: tst1', `hIP` = 'myIP', `hID` = LAST_INSERT_ID(hID)
342 Quit
343 Connect root@localhost on
343 Init DB fog
343 Query SELECT vValue FROM schemaVersion LIMIT 1
343 Query SELECT * FROM `plugins` WHERE `pName` = '' AND `pInstalled` = '1' ORDER BY `pName` ASC
343 Query SELECT * FROM `plugins` WHERE `pName` = '' AND `pInstalled` = '1' ORDER BY `pName` ASC
343 Query SELECT * FROM `plugins` WHERE `pName` = '' AND `pInstalled` = '1' ORDER BY `pName` ASC
343 Query SELECT * FROM `plugins` WHERE `pName` = '' AND `pInstalled` = '1' ORDER BY `pName` ASC
343 Query SELECT * FROM `plugins` WHERE `pName` = '' AND `pInstalled` = '1' ORDER BY `pName` ASC
343 Query SELECT * FROM `plugins` WHERE `pName` = '' AND `pInstalled` = '1' ORDER BY `pName` ASC
343 Query SELECT * FROM `plugins` WHERE `pName` = '' AND `pInstalled` = '1' ORDER BY `pName` ASC
343 Query SELECT * FROM `plugins` WHERE `pName` = '' AND `pInstalled` = '1' ORDER BY `pName` ASC
343 Query SELECT * FROM `plugins` WHERE `pName` = '' AND `pInstalled` = '1' ORDER BY `pName` ASC
343 Query SELECT * FROM `plugins` WHERE `pName` = '' AND `pInstalled` = '1' ORDER BY `pName` ASC
343 Query SELECT * FROM `plugins` WHERE `pName` = '' AND `pInstalled` = '1' ORDER BY `pName` ASC
Here’s the results of the logging. I tried creating image “tst1”.
342 Query SELECT COUNT(imageID) AS total FROM `images` WHERE `imageName` = 'tst1' AND `imageID` <> '0'
342 Query INSERT INTO `images` (`imageName`, `imagePath`, `imageCreateBy`, `imageTypeID`, `imageNFSGroupID`, `imageOSID`) VALUES ('tst1', 'tst1', 'fog', '1', '1', '50') ON DUPLICATE KEY UPDATE `imageID` = '', `imageName` = 'tst1', `imageDesc` = '', `imagePath` = 'tst1', `imageBuilding` = '', `imageSize` = '', `imageTypeID` = '1', `imageNFSGroupID` = '1', `imageOSID` = '50', `imageLastDeploy` = '', `imageFormat` = '', `imageMagnetUri` = '', `imageID` = LAST_INSERT_ID(imageID)
342 Query INSERT INTO `history` (`hText`, `hUser`, `hTime`, `hIP`) VALUES ('Image created: ID: 0, Name: tst1', 'fog', '2016-03-24 19:54:05', 'myIP') ON DUPLICATE KEY UPDATE `hID` = '', `hText` = 'Image created: ID: 0, Name: tst1', `hIP` = 'myIP', `hID` = LAST_INSERT_ID(hID)
Hi,
When I try to create a new image in the web interface, I get the “new image successfully created” message but the image does not appear in the list of images. I also checked the database, and the image does not appear there either, just the image that was last created (id 64).
However, an entry under the history table appears:
Image created: ID: 0, Name: Windows 10 Internal
So what is stopping fog from creating the new image with an ID of 65? (I do not have 65 images, but after 5 years of using fog our database has gotten that high!). This server is running FOG 1.2.0, Ubuntu 14.04.
Thanks!