On running drush hostmaster-install --version=HEAD the installer fails a hostmaster install task after downloading required modules.
Created aegir database [success]
WD php: Incorrect integer value: '' for column 'version_code' at row 1 [error]
query: INSERT INTO hosting_package_instance (
rid, package_id, filename,
schema_version, version, version_code, status)
VALUES (5, 4, '', 6055, 6.19, '', 0) in
/var/aegir/hostmaster-HEAD/profiles/hostmaster/modules/hosting/package/hosting_package.instance.inc
on line 86.
Incorrect integer value: '' for column 'version_code' at row 1 [error]
query: INSERT INTO hosting_package_instance (
rid, package_id, filename,
schema_version, version, version_code, status)
VALUES (5, 4, '', 6055, 6.19, '', 0) in
/var/aegir/hostmaster-HEAD/profiles/hostmaster/modules/hosting/package/hosting_package.instance.inc
on line 86.
An error occurred at function : drush_provision_drupal_provision_install_backend [error]
An error occurred at function : drush_provision_drupal_provision_install [error]
Could not find a Drupal settings.php file at ./sites/default/settings.php. [error]
An error occurred at function : drush_provision_drupal_provision_verify_validate [error]
An error occurred at function : drush_provision_hostmaster_install
The schema specifies that hosting_package_instance.version_code is an integer, but attempts to insert a string, causing this issue. Changing the placeholder in the query from '%s' to %d should fix it.
A patch is available at https://github.com/cafuego/hostmaster/commit/818558fc9ffa1553bb9badc85e8...
Comments
Comment #1
omega8cc commentedThis is interesting. I'm using MariaDB since January 2010 and never experienced any issues.
What is your MariaDB version and on what OS?
Comment #2
cafuego commentedNote that I only mention maria because I haven't tried this on MySQL. I assume that would fail too because the placeholder and column type still won't match.
I'm on Ubuntu 10.04.1 LTS with MariaDB 5.1.49-mariadb82 from the OurDelta repositories, as built by the MariaDB team.
Comment #3
omega8cc commentedI'm using the same version of MariaDB on Debian Lenny, and I don't experience those issues at all. I assume you are using some custom settings in your MariaDB configuration. In my case I had to comment out only one line in the vanilla config:
sql_mode = NO_ENGINE_SUBSTITUTION,TRADITIONALBut the rest just works.
Comment #4
cafuego commentedI have tuned the innodb settings, as the defaults are crap.
However, that's not the issue. The issue is the code saving a character ('') to an integer field.
Comment #5
omega8cc commentedDefault settings always needs to be tuned, but it is interesting that I'm using MariaDB on Lenny and tried it many times on Lucid with Aegir, and never had that problem (or at least, it never caused failed install). Could you share your MariaDB settings?
Comment #6
cafuego commentedActually, to be more precise, the TRADITIONAL keyword disallows saving of a character value into an integer field. Disabling it would resolve the issue, but I still think that if you want to store a character in the database, make the column be a varchar and not an integer or cast the char to an int in the code:
MySQL might accept it in some configurations, but other DBs are unlikely to.
If you re-enable the
sql_modesetting, your setup will likely fail too.Comment #7
cafuego commentedfwiw, my my.conf is attached.
Comment #8
omega8cc commentedAh, the TRADITIONAL keyword turned off may be the reason it works for me. If I remember correctly, I had to disable it not because of Hostmaster, but because of some other Drupal sites previously running on MySQL, so I suspect using this strict behavior can lead to problems not just with Hostmaster. However I agree this is a bug.
Comment #9
Anonymous (not verified) commentedMakes sense, thanks for finding it. Yeah it seems MySQL ignored this, i install several times a day and never saw it.
Comment #10
cafuego commentedLovely, installation now completes :-)
Comment #11
Anonymous (not verified) commentedReopening this as apparently this was by design for some reason I don't understand. Saw it in IRC backlog mentioned by Adrian, maybe he can suggest the approach here.
Comment #12
cafuego commentedHmm, I've successfully used a float cast on 32bit PHP to deal with very large integers (lots of bits in 4 gigagbytes) where someone was still using a 32bit Linux install for hysterical raisins- casting worked fine in that case.
Rather than reverting to '%s' and breaking my install again, should the code have a %f placeholder, a float field in the database (as opposed to an integer field) and a
(float) $instance->version_codecast in PHP?Disclaimer: I've not yet looked at the code that sets up the version_code variable.
Comment #13
Anonymous (not verified) commentedOh, we fixed this (properly) in the end.