API change: juju CLI support for adding/removing multiple service units at once

Jim Baker jim.baker at canonical.com
Thu Nov 17 04:55:05 UTC 2011

On 11/16/2011 04:51 PM, Marco Ceppi wrote:
> On Wed, 2011-11-16 at 15:25 -0800, Clint Byrum wrote:
>> Excerpts from Mark Shuttleworth's message of Wed Nov 16 14:31:06 -0800 2011:
>>> On 16/11/11 22:26, Clint Byrum wrote:
>>>> Excerpts from Gustavo Niemeyer's message of Wed Nov 16 12:49:13 -0800 2011:
>>>>> Can we please have just the -n option, though?  The long form isn't
>>>>> necessary in this case IMO.
>>>> Agreed, if it stands then -n would be a welcome addition.
>>>> Crazy idea..Is there any reason this isn't just an optional positional
>>>> argument?  With the restrictions on service names and charm names,
>>>> we can just say any positive integer given to add-unit or deploy is a
>>>> number of units.
>>>> juju add-unit 5 wordpress juju deploy hadoop-slave 20
>>> What about:
>>>  juju deploy wordpress 5
>>>  juju add-unit <name of service> n
>> Oops, fmt ate my original intended formatting
>> juju add-unit 5 wordpress
>> juju deploy hadoop-slave 20
>> To Gustavo's point, is there a reason to avoid this way?
>> It seems fudamental to the object of the command. I want 5 more units
>> in wordpress, I want to deploy 20 hadoop-slaves.
> You have two routes to go with this. Since Juju already uses "no flags"
> for the majority of high traffic commands (juju <action> [...]) then
> having an option like this without flags makes sense, given that charm
> naming schemes have restrictions, you could easily do juju <action>
> <number> <service> or juju <action> <service> <number> where the numeric
> option will be regarded as number of instances where applicable. That's
> probably the more "human" readable way (though that's a pretty
> subjective opinion on my part).
> I do have to voice concern, if you're going to go ahead with a flag,
> using a long flag would be preferred. Now that autocomplete is so well
> tuned having English instead of one character is far more human
> friendly! I frequently find myself using "tabtab" to find available
> options for Juju and other software alike. An option that says
> --num-units or something even more English-like.
> Marco Ceppi
> http://ondina.co
One technical reason not to do this:

The underlying argument parsing library (argparse) doesn't support this
style of arguments, where the type of the argument (positive integer or
a valid service/charm name) is used to disambiguate a parse. It is
certainly possible to work around this, but it's messy in part because
argparse also uses its setup to generate formatted help, so that
requires further workaround. Not necessarily a great argument, of course.

Also, I would assume that we would either pick one ordering, or allow
the number to be specified anywhere. But not have it be one way with one
command and one way with another.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 554 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ubuntu.com/archives/juju/attachments/20111116/d70cc044/attachment.pgp>

More information about the Juju mailing list