Creating an action with a loosely defined parameter

Cory Johns cory.johns at canonical.com
Fri Feb 5 15:34:18 UTC 2016


You can do this, with full validation, using patternProperties.  An example
using this can be found at: http://json-schema.org/example2.html

On Thu, Feb 4, 2016 at 11:10 PM, Marco Ceppi <marco.ceppi at canonical.com>
wrote:

> I haven't tried, but I suppose if you set it to just a `type: object`
> without params it might accept any arbitrary key. There are downsides to
> this, as you won't get validation. It also might just flat out not work.
> I'll see if I can test this a bit more
>
> On Thu, Feb 4, 2016 at 5:05 PM Tom Barber <tom at analytical-labs.com> wrote:
>
>> Yeah that wont work, because I don't know what the parameters would be
>> called, they are basically runtime variables for ETL designers.
>>
>> On the command line I need to build a string that looks something like:
>>
>> ./kitchen -file=charmerroundup.kjb
>> -param:marco=thinksallquestionareawesome -param:kevin=likestodrinklachoufe
>> -param:notetoself=nevereatbluecheeseandicecream
>>
>> so, I can have a user pass in all those params as one long string, but it
>> would nice to be able to model is as a KV object and just iterate over them.
>>
>> Tom
>>
>> --------------
>>
>> Director Meteorite.bi - Saiku Analytics Founder
>> Tel: +44(0)5603641316
>>
>> (Thanks to the Saiku community we reached our Kickstart
>> <http://kickstarter.com/projects/2117053714/saiku-reporting-interactive-report-designer/>
>> goal, but you can always help by sponsoring the project
>> <http://www.meteorite.bi/products/saiku/sponsorship>)
>>
>> On 4 February 2016 at 21:59, Marco Ceppi <marco.ceppi at canonical.com>
>> wrote:
>>
>>> I'm inclined to say "yes" but I'd need a bit more of an example to
>>> confirm. Since actions are defined as jsonschema you can define nested
>>> parameters and such so I believe your usecase will work. However, the
>>> parameters you pass must be in the schema. Juju uses it to validate that
>>> the data passed is correct.
>>>
>>> EG:
>>>
>>> http://paste.ubuntu.com/14882820/
>>>
>>> I could do
>>>
>>> juju action do network-qos device=eth1 delay.time=2000
>>>
>>> but not
>>>
>>> juju action do network-qos delay.non-existant-option=True
>>>
>>> Marco
>>>
>>> On Thu, Feb 4, 2016 at 3:34 PM Tom Barber <tom at analytical-labs.com>
>>> wrote:
>>>
>>>> Alright then chaps.
>>>>
>>>> I want to create an action with a parameter that may or may not exist
>>>> plus you might define it more than once.
>>>>
>>>> I see in the actions doc some stuff about aditional properties which
>>>> may or maynot be relevant. Can i pass in an array of objects of the same
>>>> type so my bash script can iterate over them and build my required string?
>>>>
>>>> Thanks
>>>>
>>>> Tom
>>>> --------------
>>>>
>>>> Director Meteorite.bi - Saiku Analytics Founder
>>>> Tel: +44(0)5603641316
>>>>
>>>> (Thanks to the Saiku community we reached our Kickstart
>>>> <http://kickstarter.com/projects/2117053714/saiku-reporting-interactive-report-designer/>
>>>> goal, but you can always help by sponsoring the project
>>>> <http://www.meteorite.bi/products/saiku/sponsorship>)
>>>> --
>>>> Juju mailing list
>>>> Juju at lists.ubuntu.com
>>>> Modify settings or unsubscribe at:
>>>> https://lists.ubuntu.com/mailman/listinfo/juju
>>>>
>>>
>>
> --
> Juju mailing list
> Juju at lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/juju
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/juju/attachments/20160205/ad88e8ef/attachment.html>


More information about the Juju mailing list