I've been updating provision_civicrm recently, and added a service so that we can save data into the site context (alias/entity...) from a new hosting_civicrm module. I was trying to model it on the pull request for 'Aegir HTTP basic authentication' as listed here: http://community.aegirproject.org/contrib-modules. To my knowledge, it's the only contrib extension that both:

  • purports to support Aegir 2.x, and
  • implements a service

I wasn't able to get the extension in the repo from which that pull request originated to work, nor was I successful in implementing a service in 2.x myself. Once I switched back to 1.x, I had something running relatively quickly. While there's documentation in our example.drush.inc, I wasn't able to implement it, despite about a day of banging my head against it.

I'm marking as a critical bug right now, as I think it's crucial that we support our contrib community in porting their modules/extesnions. So, IMO, this is a release blocker.

Comments

ergonlogic’s picture

Category: bug » task
Status: Active » Needs review

Half the problem was #1987026: drushrc.php no longer read from Drupal root in Drush 5 which, in the case of provision_civicrm, meant we weren't ever having our code triggered. With that solved, the changes required to support class auto-loading became clearer. I've documented them here: http://community.aegirproject.org/upgrading/path#Class_auto-loading. This needs a technical review, as it's still pretty new to me. In addition, I'm not sure it's appropriate for that page, which is focused more on providing guidance to administrators upgrading their Aegir install, rather than developers porting their extensions. Perhaps a sub-page is in order, or perhaps a new page in the Developer's Guide (which itself should probably be revised and updated).

ergonlogic’s picture

Half the problem was #1987026: drushrc.php no longer read from Drupal root in Drush 5 which, in the case of provision_civicrm, meant we weren't ever having our code triggered. With that solved, the changes required to support class auto-loading became clearer. I've documented them here: http://community.aegirproject.org/upgrading/path#Class_auto-loading. This needs a technical review, as it's still pretty new to me. In addition, I'm not sure it's appropriate for that page, which is focused more on providing guidance to administrators upgrading their Aegir install, rather than developers porting their extensions. Perhaps a sub-page is in order, or perhaps a new page in the Developer's Guide (which itself should probably be revised and updated).

anarcat’s picture

Well, there are two issues here: providing guidance for services, and whether or not there should be a separate page for porters. :)

I agree it may be time to split into a separate page, but in the meantime, your stuff looks great. Maybe this should be reviewed by darthsteven, and not me however.

ergonlogic’s picture

Status: Needs review » Needs work

I'm continuing to work through this with hosting_/provision_civicrm, and it appears that what I've documented so far isn't sufficient. While it'll write values from the front-end into the site alias, it won't necessarily be available through d(). In particular, I'm seeing this in a drush_hook_post_provision_install(). I've had to add d()->init(); early in the hook implementation, and option_documentation() methods to the classes, like so:

static function option_documentation() {
  return array(
    '--civicrm_version' => 'Project: The codename for this project.',
  );
}

Both appear to be required, but I'm at a bit of a loss to explain it. I haven't implemented an init() method in my classes, so I guess it's using the parent's init(), which in the case of Provision_Service, doesn't appear to do anything: http://api.aegirproject.org/api/Provision/Provision--Service.php/functio....

Is it maybe triggering the __construct() method on the parent? I have to admit I don't really understand what's going on here.

Steven Jones’s picture

Whatever is going on, I think we need to make it easier on other extensions to integrate with Provision, there's too much code here.

helmo’s picture

A child page under http://community.aegirproject.org/contrib explaining this would help :)

#1984098: Aegir 2.x compatibility would also benefit from this.

helmo’s picture

I've moved the bulk of http://community.aegirproject.org/upgrading/path#Class_auto-loading to a new page http://community.aegirproject.org/content/contrib/class-auto-loading

Does the example module in provision need any updates from this?

ergonlogic’s picture

Status: Needs work » Fixed

With #7 and the inclusion of #2103173: Provide an example of saving data to a site context, I think we can close this issue.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.