The trouble with EnvironProvider.InstanceId()
William Reade
william.reade at canonical.com
Fri Mar 15 16:06:48 UTC 2013
On Fri, 2013-03-15 at 15:48 +0000, roger peppe wrote:
> Perhaps rather than providing Environ.CurrentInstanceId and
> comparing that, it might be cleaner to provide
> a environs.Instance.IsCurrent method to determine if the given
> instance is the one we're running on. In most implementations
> it would probably do the same thing under the hood.
>
> Thoughts?
If machine 0 has no instance id, it hasn't yet started provisioning;
therefore, there must be only one instance in the environment. So, the
provisioner can just check for machine 0 having no instance id; if so,
it can get the *only* instance in the environment with AllInstances,
(barf if count != 1; who knows what's going on, if it's transient it'll
probably be ok when the task is restarted), and set machine 0's instance
id to that one's id. That way we get to use Instance.InstanceId() in all
cases, and don't need to worry about new methods or implementation
differences at all. Sane?
Cheers
William
More information about the Juju-dev
mailing list