Version checking for features can be dangerous because a commands output or
availability may change in the future and now your charm also needs a
"max-version", or "version-range" etc. A more robust solution could be
something along the lines of a "feature-supported" query which would return
whether that command is indeed supported in the active environment with the
necessary syntax.

In JS this is a common workflow when dealing with cross browser
compatibility issues and this issue is similar. The use could be something
like...

IS_LEADER_SUPPORTED=`juju supported-command is_leader`
if [ "$IS_LEADER_SUPPORTED" == "true" ]; then
  # Do stuff
else
 juju-log "Requires is_leader Juju command"
fi

-Jeff

On Mon, Aug 10, 2015 at 2:32 PM, Matt Bruzek <[email protected]>
wrote:

>
> We wrote a charm that needed election logic, so we used the new Juju
> feature "is_leader".  A user was interested in using a bundle that
> contained this charm and it failed on them.  It was hard to track down the
> cause of the problem.  It appears they were using an earlier version of
> Juju that is available from universe and only the PPA had the more current
> version.
>
> Read more about the problem here:
> https://bugs.launchpad.net/charms/+source/etcd/+bug/1483380
>
> I heard the "min-version" feature discussed at previous Cloud sprints but
> to my knowledge we do not have it implemented yet.  The idea was a charm
> could specify in metadata.yaml what min-version of Juju they support.
>
> There are a lot of new features that juju-core are cranking out (and that
> is *awesome*)!  We have already run into this problem with a real user, and
> will have the problem in the future.
>
> Can we reopen the discussion of min-version?  Or some other method of
> preventing this kind of problem in the future?
>
>    - Matt Bruzek <[email protected]>
>
> --
> Juju-dev mailing list
> [email protected]
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/juju-dev
>
>
-- 
Juju-dev mailing list
[email protected]
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju-dev

Reply via email to