[foreman-users] Re: API issues with override_values

2016-10-25 Thread Andrew Schofield
Hi Jack,

Also see: https://bugzilla.redhat.com/show_bug.cgi?id=1192549 
and http://projects.theforeman.org/issues/17087.

We now run the param through to_json (we're using ruby) then post that. 

We are doing a lot of this. Also, as a gotcha, I see you're trying do a 
match, note that values you want to match against must be in 
override_value_order (hostgroup is by default).

Thanks,
Andrew

-- 
You received this message because you are subscribed to the Google Groups 
"Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to foreman-users+unsubscr...@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at https://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.


[foreman-users] Re: API issues with override_values

2016-10-25 Thread Jack Watroba
After some more testing, I found that taking the quotes out of the inside 
hash and placing the quotes around the entire hash works:

"value": "{some: thing}"

That works.

The problem is that that's not how it gets reported from the API, if you 
query for that information, it quotes in inside hash key and value. I'm 
essentially trying to migrate massive amounts of parameter overrides from 
one foreman server to another for a server migration and I can't see an 
easy way to do that if the json the API spits out on one server cannot be 
accepted in that form on the new server.

Does anyone have any experience in importing/exporting parameter overrides 
between servers?

Thanks. 


On Monday, October 24, 2016 at 1:24:11 PM UTC-7, Jack Watroba wrote:
>
> I'm attempting to create smart parameter overrides via the API (version 
> 1.13) and I'm having some issues. 
>
> Posting to: /api/smart_class_parameters/{paramID}/override_values
>
> JSON being posted:
>
> {
>   "override_value": {
> "match": "hostgroup=somehostgroup",
> "value": {"some": "thing"}
>   }
> }
>
>
> I receive this message back from the API: "error": {"message":"Validation 
> failed: Value can't be blank"}
>
> The parameter is set to be a hash and I'm passing it a hash, so I can't 
> figure out why it's reporting the value is blank.
>
> Any ideas?
>
> Thanks. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to foreman-users+unsubscr...@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at https://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.