Column 'module' cannot be null ) [query_string] => INSERT INTO {role_permission} (rid, permission, module) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2) [args] => Array ( [:db_insert_placeholder_0] => 3 [:db_insert_placeholder_1] => create commerce_customer_profile entities of bundle shipping [:db_insert_placeholder_2] => ) ) 
CommentFileSizeAuthor
#13 i1264716.patch1.11 KBattiks
#10 i1264716.patch8.82 KBattiks
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

attiks’s picture

we ran into the same issue a couple days ago, it's caused by how features handle things, the following fix works for us

function my_feature_enable() {
  if (!variable_get('my_taxonomy_feature_rebuilt', 0)) {
    features_rebuild(array('my_taxonomy_feature' => array('taxonomy')));
    variable_set('my_taxonomy_feature_rebuilt', 1);
  }
  if (!variable_get('my_roles_feature_rebuilt', 0)) {
    features_rebuild(array('my_roles_feature' => array('user_role')));
    variable_set('my_roles_feature_rebuilt', 1);
  }
}

you need to flush the offending feature, mostly it will be something with user roles and/or taxonomy

attiks’s picture

1 more remark, make sure your dependencies between features are setup correctly

recidive’s picture

Assigned: Unassigned » recidive

Thanks @attiks!

Where should we put this code? To all features that adds taxonomy/roles .module file?

I wonder if this is something that needs to be fixed in features module instead. Is there an issue about that in features queue?

I'm gonna fix this tomorrow morning.

1 more remark, make sure your dependencies between features are setup correctly

Mostly features are kit compliant, so they can't have dependencies. We are not strict about that though.

attiks’s picture

You have to put this code in features that try to set/use taxonomy and/or set permissions (especially on taxonomy or new defined roles), the problem is that if both the feature defining the taxonomy/user role and the one using it are enabled at the same time it will fail. In case of taxonomy permissions you get an error, in case of user roles it will go through, but the permissions for the new role aren't set.

PS: Most of the credit has to go to Jelle_S, he debugged/fixed it.

attiks’s picture

recidive’s picture

I tried adding the following to martplug_commece feature with no luck:

function martplug_commerce_enable() {
  if (!variable_get('martplug_base_rebuilt', 0)) {
    features_rebuild(array('martplug_base' => array('user_role')));
    variable_set('martplug_base_rebuilt', 1);
  }
}

martplug_base is the only feature that set user roles.

I think the problem isn't related to user roles nor taxonomy. But something else. The module name isn't available when inserting a permission, the commerce_shipping module is in the list of dependencies for the martplug_commerce. I'll try adding that to the martplug_base too to see what happens.

    [previous:Exception:private] => 
    [errorInfo] => Array
        (
            [0] => 23000
            [1] => 1048
            [2] => Column 'module' cannot be null
        )
 
    [query_string] => INSERT INTO {role_permission} (rid, permission, module) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2)
    [args] => Array
        (
            [:db_insert_placeholder_0] => 3
            [:db_insert_placeholder_1] => create commerce_customer_profile entities of bundle shipping
            [:db_insert_placeholder_2] => 
        )
attiks’s picture

you have to add it to the features that sets the permission for a certain role, not to the one that sets the role it self. Same goes for taxonomy, add the code to the feature that sets the permission. But by looking at the error your problem is related to user roles since the rid=3

Easiest way to debug is to comment out the code inside xxx.features.user_permission.inc if the install works, or you get a different error, you have to right one ;p

recidive’s picture

yes, that's what I'm doing, martplug_commerce set the permission and martplug_base add the role.

I'm sure commenting this permission out will work, but that's not what I want.

Still looking for a good way to workaround this. It's though, since this permission needs fields to be created first, and those fields are created by the module itself not a feature.

  $permissions['create commerce_customer_profile entities of bundle shipping'] = array(
    'name' => 'create commerce_customer_profile entities of bundle shipping',
    'roles' => array(
      0 => 'administrator',
      1 => 'editor',
    ),
    'module' => 'commerce_customer',
  );

Hmm, rid = 3 is odd, since I create just 2 roles.

attiks’s picture

i added the code to all features that include user permissions and the error is gone, but i got

Duplicate entry 'administrator' for key 'name'

INSERT INTO {role} (name, weight) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1) [1] => Array ( [:db_insert_placeholder_0] => administrator [:db_insert_placeholder_1] => 2

Probably because the role is created in the install file as well, re testing now

attiks’s picture

FileSize
8.82 KB

i commented out some other stuff, shipping was given problems as well as feeds, so it might be that it ins't as functional anymore. Anyhow attached the patch, maybe it will help the troubleshooting

BenK’s picture

Subscribing

recidive’s picture

I wonder what causes installer and drush/aegir install to behave different while it should behave the same.

Right now, site installs ok if using the installer, so this makes me think this is a problem with drush si.

I'm not willing to add workarounds all around the code, but rather find the root of the problem.

attiks’s picture

Status: Active » Needs review
FileSize
1.11 KB

I have it working (I think), but at least it installs without errors and everything looks ok, patch attached, based on #1187858-24: Node permissions fail to import

BUT it only works with features 7.x-1.x-beta3, i tried using the latest version but it didn't work

recidive’s picture

Version: » 7.x-1.x-dev
Issue tags: +beta blocker

Tagging.

omega8cc’s picture

Status: Needs review » Needs work

Just to confirm that it still doesn't work with Aegir: https://gist.github.com/1415694

niccolox’s picture

I can confirm Aegir site install problem .. really wanted to get this hosted for some clients but no joy !

niccolox’s picture

could it be as simple as exceeding maximum execution time ?

this issue says max execution works at 1580 !!
http://drupal.org/node/1368880

whereas its much lower in BOA's Aegir implementation ?
https://github.com/omega8cc/nginx-for-drupal/issues/31

attiks’s picture

@niccolo, i wish it was that easy, but the problem only occurs using automated install like aegir and on my dev machine definitely no time-out problem (is set to 600sec)

niccolox’s picture

I had problems with shared hosting too, using Webfaction, ramped-up execution times and it works.

so, subscribing to an Aegir fix, especially a BOA Aegir fix

Martplug is the nicest Commerce app out there so keep on keeping on..

cheers

-N

discipolo’s picture

disabling martplug_sample_content dependency in .info and applying patch from http://drupal.org/node/1265168#comment-5413624 lets me install martplug on aegir

cruzeazy’s picture

I can confirm #20. Installs on Aegir with mentioned patch and removing sample content dependency.

omega8cc’s picture

Thanks for the tips in #20, it is now added in Octopus: http://drupal.org/node/1356550#comment-5776802