Drupal 10, the latest version of the open-source digital experience platform with even more features, is here.According to Anarcat:
In general, I think it's bad practice to run provision-* commands in hook_post_hosting_task(). The purpose of this task is to collect stuff that was generated in the backend so that it propagates to the frontend.
What you really want to do is post_provision_verify() or post_provision_install() tasks. They make it much clearer when you're running and why. That way, you don't have to go through hoops to detect if the role is already there - if you run on install, then of course the role isn't there and you just add it. This would simplify the code significantly, at the cost of splitting it in frontend/backend modules.
And so, we should be using post_provision_verify() or post_provision_install(), which I believe will mean using d() to pull in the context. Thankfully, darthsteven has provided some good guidance here: http://community.aegirproject.org/node/322










Comments
Comment #1
ergonlogicBTW, this means creating a separate project for the backend stuff: provision_profile_roles, I guess.
See #1214254: Interesting IRC discussion for discussion on the topic.
Comment #2
ergonlogicSince "Hosting Profile Roles" has largely been merged into Hosting SaaS, which has, in turn, been merged into Aegir Services, this issue should belong here now.
One of the original blockers for this refactoring was the requirement to create a new backend project. With Aegir 3+ this in no longer the case. The relevant code currently resides here: http://cgit.drupalcode.org/hosting_services/tree/submodules/hosting_saas...
Comment #3
colanI thought this would get easier with Storing data in Aegir (assuming it's still relevant), but it's non-trivial.
The data we'd need for each site is:
saas_create_subscriber_name(string)saas_create_subscriber_email(string)saas_set_subscriber_role(string)sass_send_subscriber_email(boolean)Looks like we would need to:
$argumentsin AegirSaasCreateSiteTaskGenerator->prepareClientUserInfo().drupal_alter()in hosting_services_save_site() to provide$dataas context (containing the above).