After updating features from 7.x-1.0-beta6 to 7.x-1.0-rc1 my feature has "Rules configuration" marked as 'Overridden'.
Choosing "Review overrides" (diff) the first time says "No changes have been made to this feature.".
Choosing "Review overrides" a second time it shows "features[rules_config][] = ..." being removed from INFO and an array being changed to FALSE in RULES_CONFIG.

It is also no longer possible to add any rules to a new feature, the component is simply not there anymore.
Updating to the latest rules package (7.x-2.1) did not help. Reverting Features from rc1 to beta6 did.

I could not find any reason for the removal of rules in the release notes or the issue queue.

Comments

hlykos’s picture

Exactly same issue. Rules (and rules_link) are not selectable to be exported in 7.x-1.0-rc1 anymore. Unsure if this an issue with Features or the Entity API that I think Rules utilise to export its entities.

hefox’s picture

Sounds like the rule options are not getting calculated correctly in features export options hook; if add new, non code only options, do they show up as options? (If they can, then indicates existing rules aren't being picked up, which could be a problem with adding the file the rules are in).

(Feel free to pop into #drupal-features channel assuming I can connect to irc eventually... I'm not curious enough to install rules to poke around to see what is wrong, but can help suggest debug methods).

fago’s picture

Priority: Normal » Critical

ouch, it looks like features rc1 changed the API somehow.

This is how rules defines the features api:

class RulesFeaturesController extends EntityDefaultFeaturesController {

  /**
   * Defines the result for hook_features_api().
   */
  public function api() {
    $info = parent::api();
    $info['rules_config']['default_file'] = FEATURES_DEFAULTS_CUSTOM;
    $info['rules_config']['default_filename'] = 'rules_defaults';
    return $info;
  }

So until now the .inc got automatically appended to the filename. But since rc1 it doesn't, so the export files are missing the appended .inc and are not found any more.

Quick-fix: Rename the export file to MODULE.rules_defaults.inc and clear your caches.

hefox’s picture

Looking at features_include_default, as far as I can tell, it doesn't really have custom file support; it has ctools and module.features..inc and only that. That's good to know... Based on that, assuming rules is integrating with entity which is integrating with ctools, which features integrates with? What a huge chance for something going wrong XD

However, from what you said it's the file being created not the including of that file, yea?

      $files = features_export_render($export, $module_name, TRUE);
      foreach ($files as $extension => $file_contents) {
        if (!in_array($extension, array('module', 'info'))) {
          $extension .= '.inc';
        }

This is what logic features does to determine extension and it's doing it both in admin.inc and drush.inc;

Curious, what is $extension resolving to there?

agentrickard’s picture

This might bite me, too, since I'm exporting to a custom file as well.

function domain_features_api() {
  $components = array(
    'domain' => array(
      'name' => t('Domains'),
      'default_hook' => 'domain_default_domains',
      'default_file' => FEATURES_DEFAULTS_CUSTOM,
      'default_filename' => 'domains',
      'features_source' => TRUE,
      'file' => drupal_get_path('module', 'domain') .'/domain.features.inc',
    ),
  );
  return $components;
}
agentrickard’s picture

No. My files are exporting as expected. I do, however, also use custom code to load my default features.

function domain_features_load($module, $hook, $return = TRUE) {
  // Features does not handle module loading of custom files.
  module_load_include('inc', $module, $module . '.domains');
  $function = $module . '_' . $hook;
  if ($return && function_exists($function)) {
    return $function();
  }
}

But perhaps I am misreading the issue here and just adding noise.

agentrickard’s picture

No. My files are exporting as expected. I do, however, also use custom code to load my default features.

function domain_features_load($module, $hook, $return = TRUE) {
  // Features does not handle module loading of custom files.
  module_load_include('inc', $module, $module . '.domains');
  $function = $module . '_' . $hook;
  if ($return && function_exists($function)) {
    return $function();
  }
}

But perhaps I am misreading the issue here and just adding noise.

hlykos’s picture

@2
Newly created rules (in database) do not show up either. Rules do not show up on the Edit components selectbox at all.

@3
There is no export file since rules cannot be selected to be created.

With an already created feature from the previous version of Features it show the Rules configuration on the features-column on the right flagged as overriden and by reverting it the rules disappear. The Edit components selectbox still does not offer Rules as an option though.

hefox’s picture

Hlykos error at least sounds like hook_features_export_options is returning nothing which would result in overriden/removing current views (not a valid option anymore). sooo, if can, it'd be nice to debug in whoever is implementing hook_features_export_options, which if ctools is in ctools.features.inc in the includes directory of features.

hlykos’s picture

By reverting features_get_default_hooks in features.export.inc to previous version solves the problem. This is the commit implementing the change. I 'll try to work on it more.

mpotter’s picture

I actually think this was related to the ctools export issue. Try the latest 1.x-dev version and re-export your features and let us know if that helps.

hlykos’s picture

Tried latest 1.x-dev and it did not fix it. Rules configs are not exportable (both from code and new ones in database) as they do not appear on the dropdown select list.

hnln’s picture

same problem here after updating to rc1 (and same problem with dev). I have no rules options anymore in the feature ui.

Also a bug report in the rules issue queue (http://drupal.org/node/1491306), I posted a link to this issue.

mpotter’s picture

The Rules module is built upon Entity and uses the "base" option in the API to specify a base component type. Looks like Features is trying to call the hooks using "rules_config" for the component, rather than using the "entity" base component. Haven't gone far enough for a patch yet, but maybe this info will help others. Will keep looking at this issue.

Odd that this wasn't discovered earlier since the patch mentioned in #10 was committed several weeks ago to the dev version.

rogical’s picture

The latest dev version let the 'Rules config' shows again, but original rules features are not able to available in features UI anymore!

It's sadly to create those those features manually and export again.
#1490734: Rules features is missing in the Features UI after upgrade to the latest Features

hefox’s picture

entity.features.inc is never included and nothing says to include it.

seeing if there's an entity issue for this.

hefox’s picture

hefox’s picture

Status: Postponed » Closed (fixed)

This actually should be fixed on dev version of entity; they were missing the 'file' key but added it in dev version.

(entity.features.api is included automatically due to hook_hook_info automatically including all [module].features.api. when features api wasn't cached, this worked fine. As soon as we cached features_api, that file wasn't included as often. I didn't know about hook_hook_info and auto inclusion so thought it was an entity bug).

Andrey Zakharov’s picture

Ok, after disappeared Rules in Create Feature, and updated modules
Have

 Entity API (entity)                    7.x-1.0-rc1+46-dev    7.x-1.0-rc1       Up to date
 Features (features)                    7.x-1.0-rc1           7.x-1.0-rc1       Up to date
 Rules (rules)                          7.x-2.1               7.x-2.1           Up to date

Ok, there is "rules_config" in "Edit components", but it is empty....

What's next?

carn1x’s picture

Currently unable to test this theory due to the Entity API issue: #1518062: Latest DEV cause segmentation fault in drush

carn1x’s picture

As fago mentioned in another queue, I had to update entity AND i18n to new dev, which brought rules_config feature option back for me.

See: #1447946: Recent entity API dev version requires a recent i18n dev version

pauleb’s picture

I think I have the same issue. I waited with the rules update until i18n 7.x-1.5 and entity-7.x-1.0-rc2 were available. Now I can choose the rules in features and the dependencie is exported to the .info file of the feature. Also the rules.inc is created.

Rules UI shows that the rule is in default state. Features, instead, tells me that the feature is overridden and the rules are not shown as part of the feature. The feature diff gives me the information that started the issue. On one side I got the definition of the rule, on the other side "FALSE".

Neither a revert with drush or the UI did help.