This site is a static archive of the Aegir community site. Documentation has moved to http://docs.aegirproject.org. Other community resources can be found on the Contacting the community page.
Skip navigation

Provision Context argument clash with provision-save.

Help

Provision Context argument clash with provision-save.

In trying to use the cluster feature, I'm running into weird errors during provision-save. I can get it to recurse infinitely, by adding @server_master to a cluster. Debugging shows it isn't a problem due to the cluster feature specifically, but rather something to do with how arguments are parsed when contexts are created in provision.context.inc.

My provision-save command looks like this (beta 2):

/usr/bin/php /var/aegir/drush/drush.php --php=/usr/bin/php --context_type='server' --master_url='http://aegir.vm/' --remote_host='cluster.dev' --ip_addresses='0.0.0.0' --db_service_type='0' --http_service_type='cluster' --cluster_web_servers='@server_master' provision-save '@server_clusterdev' --backend --debug

When executed, it recurses infinitely across calls to d(). First, d('@self') is invoked. Then, d('@server_master') is called in provisionContext_server() to look up properties from. Both contexts should be loaded correctly, but the second call recurses.

The second context is corrupt, because provision.context.inc is programmed to override settings with arguments from the command line:

  function __get($name) {
    if ($name == 'options') {
      return array_merge(provision_sitealias_get_record($this->name), array_filter(drush_get_context('stdin')), array_filter(drush_get_context('options')));
    }

In this case, the command-line options should apply only to @self/@server_clusterdev, not to @server_master. The code above applies to all. Now, @server_master has become a cluster type webserver with itself as its child, and infinite recursion happens.

If I change the above code so it only weaves in command-line options when $this->name != '@server_master', the problem goes away. I'm not sure if this is correct, as conceptually it seems altering contexts from the command-line should be reserved only for provision-save commands rather than a generic mechanism in contexts themselves.

Need help?

Discussion

The discussion area lets your team communicate by posting updates and discussing issues. It is a great place for sharing progress, discussing challenges, and exploring ideas.