Api smart_class_parameters error -- Validation failed: Lookup values is invalid (Help please!)

Hi!

Help me please. Through the API I can GET a smart_class_parameter, so this
works:

curl -k -u '$user:$password' -H "Accept: version=2,application/json"
https://foreman/api/v2/smart_class_parameters/727 -X GET

Response
ok: {"parameter":"db_host","id":727,"description":"","override":true,"parameter_type":"string","default_value":"127.0.0.1","required":false,"validator_type":"","validator_rule":null,"override_value_order":"fqdn\nhostgroup\nos\ndomain","override_values_count":3,"created_at":"2014-04-17T14:57:20Z","updated_at":"2014-04-17T15:09:48Z","puppetclass":{"id":174,"name":"osnumergy::keystone","module_name":"osnumergy"},"override_values":[{"id":1463,"match":"fqdn=keystone.openstack.admin","value":"mysql.openstack.admin"},{"id":808,"match":"fqdn=split2-keystone.openstack.admin","value":"split2-mysql1.openstack.admin"},{"id":1231,"match":"fqdn=r422-e2-10.openstack.admin","value":"10.197.219.43"}],"environments":[{"id":17,"name":"openstack"}]}

But when I try to update de smart_class_parameter it doesn't.
I try this :

curl -k -u '$user:$password' -H "Accept: version=2,application/json"
https://foreman/api/v2/smart_class_parameters/727 -X PUT -d
'{"smart_class_parameter":{"default_value":"localhost"}}'

And I get:

{
"error": {"message":"Validation failed: Lookup values is invalid"}
}

Through the GUI I can update parameters with this user…

I didn't really find references to this error, and I'm a bit lost here…
Anybody help, please?

Thanks

Can you please send the server logs?
did you try editing this specific parameter in the GUI?
the error looks related to the matchers of this parameter and not the user.

··· On Tue, Nov 4, 2014 at 4:42 PM, Cynthia Lopes wrote:

Hi!

Help me please. Through the API I can GET a smart_class_parameter, so this
works:

curl -k -u ‘$user:$password’ -H "Accept: version=2,application/json"
https://foreman/api/v2/smart_class_parameters/727 -X GET

Response
ok: {“parameter”:“db_host”,“id”:727,“description”:"",“override”:true,“parameter_type”:“string”,“default_value”:“127.0.0.1”,“required”:false,“validator_type”:"",“validator_rule”:null,“override_value_order”:“fqdn\nhostgroup\nos\ndomain”,“override_values_count”:3,“created_at”:“2014-04-17T14:57:20Z”,“updated_at”:“2014-04-17T15:09:48Z”,“puppetclass”:{“id”:174,“name”:“osnumergy::keystone”,“module_name”:“osnumergy”},“override_values”:[{“id”:1463,“match”:“fqdn=keystone.openstack.admin”,“value”:“mysql.openstack.admin”},{“id”:808,“match”:“fqdn=split2-keystone.openstack.admin”,“value”:“split2-mysql1.openstack.admin”},{“id”:1231,“match”:“fqdn=r422-e2-10.openstack.admin”,“value”:“10.197.219.43”}],“environments”:[{“id”:17,“name”:“openstack”}]}

But when I try to update de smart_class_parameter it doesn’t.
I try this :

curl -k -u ‘$user:$password’ -H "Accept: version=2,application/json"
https://foreman/api/v2/smart_class_parameters/727 -X PUT -d
’{“smart_class_parameter”:{“default_value”:“localhost”}}’

And I get:

{
“error”: {“message”:“Validation failed: Lookup values is invalid”}
}

Through the GUI I can update parameters with this user…

I didn’t really find references to this error, and I’m a bit lost here…
Anybody help, please?

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+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.

Yes, I was able to update the specific parameter through the UI.

In the logs I only got internal server error…

I was using an old foreman, version 1.4.3. I did not have the issue after
upgrading to 1.6.

It was probably fixed at some point.

Thank you for your attention. :slight_smile:

··· Le mercredi 5 novembre 2014 15:11:15 UTC+1, Ori Rabin a écrit : > > Can you please send the server logs? > did you try editing this specific parameter in the GUI? > the error looks related to the matchers of this parameter and not the user. > > On Tue, Nov 4, 2014 at 4:42 PM, Cynthia Lopes > wrote: > >> Hi! >> >> Help me please. Through the API I can GET a smart_class_parameter, so >> this works: >> >> curl -k -u '$user:$password' -H "Accept: version=2,application/json" >> https://foreman/api/v2/smart_class_parameters/727 -X GET >> >> Response >> ok: {"parameter":"db_host","id":727,"description":"","override":true,"parameter_type":"string","default_value":"127.0.0.1","required":false,"validator_type":"","validator_rule":null,"override_value_order":"fqdn\nhostgroup\nos\ndomain","override_values_count":3,"created_at":"2014-04-17T14:57:20Z","updated_at":"2014-04-17T15:09:48Z","puppetclass":{"id":174,"name":"osnumergy::keystone","module_name":"osnumergy"},"override_values":[{"id":1463,"match":"fqdn=keystone.openstack.admin","value":"mysql.openstack.admin"},{"id":808,"match":"fqdn=split2-keystone.openstack.admin","value":"split2-mysql1.openstack.admin"},{"id":1231,"match":"fqdn=r422-e2-10.openstack.admin","value":"10.197.219.43"}],"environments":[{"id":17,"name":"openstack"}]} >> >> >> But when I try to update de smart_class_parameter it doesn't. >> I try this : >> >> curl -k -u '$user:$password' -H "Accept: version=2,application/json" >> https://foreman/api/v2/smart_class_parameters/727 -X PUT -d >> '{"smart_class_parameter":{"default_value":"localhost"}}' >> >> And I get: >> >> { >> "error": {"message":"Validation failed: Lookup values is invalid"} >> } >> >> >> Through the GUI I can update parameters with this user... >> >> >> >> I didn't really find references to this error, and I'm a bit lost here... >> Anybody help, please? >> >> 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-user...@googlegroups.com . >> To post to this group, send email to forema...@googlegroups.com >> . >> Visit this group at http://groups.google.com/group/foreman-users. >> For more options, visit https://groups.google.com/d/optout. >> > >

Just one thing that I noticed later… I thought the issue was correct
because I installed a brand new foreman with more recent version, but it is
not a version problem in fact. I realised that I can still get this message
in foreman 1.6. I discovered that this happens when the parameter has
already been used for a deployment and the host gets a fqdn matcher.

For example, a deployed a host with my puppet class and set my param to the
good value for this host.
That was ok, but then I tried to change the general description of my param
via the api and I get the error I reported:
{
"error": {"message":"Validation failed: Lookup values is invalid"}
}
On foreman logs I just get the same message.

On the other hand, if I try to update a parameter class that has no match,
it works just fine.

··· Le vendredi 21 novembre 2014 23:03:13 UTC+1, Cynthia Lopes a écrit : > > Yes, I was able to update the specific parameter through the UI. > > In the logs I only got internal server error... > > I was using an old foreman, version 1.4.3. I did not have the issue after > upgrading to 1.6. > > It was probably fixed at some point. > > Thank you for your attention. :) > > > Le mercredi 5 novembre 2014 15:11:15 UTC+1, Ori Rabin a écrit : >> >> Can you please send the server logs? >> did you try editing this specific parameter in the GUI? >> the error looks related to the matchers of this parameter and not the >> user. >> >> On Tue, Nov 4, 2014 at 4:42 PM, Cynthia Lopes >> wrote: >> >>> Hi! >>> >>> Help me please. Through the API I can GET a smart_class_parameter, so >>> this works: >>> >>> curl -k -u '$user:$password' -H "Accept: version=2,application/json" >>> https://foreman/api/v2/smart_class_parameters/727 -X GET >>> >>> Response >>> ok: {"parameter":"db_host","id":727,"description":"","override":true,"parameter_type":"string","default_value":"127.0.0.1","required":false,"validator_type":"","validator_rule":null,"override_value_order":"fqdn\nhostgroup\nos\ndomain","override_values_count":3,"created_at":"2014-04-17T14:57:20Z","updated_at":"2014-04-17T15:09:48Z","puppetclass":{"id":174,"name":"osnumergy::keystone","module_name":"osnumergy"},"override_values":[{"id":1463,"match":"fqdn=keystone.openstack.admin","value":"mysql.openstack.admin"},{"id":808,"match":"fqdn=split2-keystone.openstack.admin","value":"split2-mysql1.openstack.admin"},{"id":1231,"match":"fqdn=r422-e2-10.openstack.admin","value":"10.197.219.43"}],"environments":[{"id":17,"name":"openstack"}]} >>> >>> >>> But when I try to update de smart_class_parameter it doesn't. >>> I try this : >>> >>> curl -k -u '$user:$password' -H "Accept: version=2,application/json" >>> https://foreman/api/v2/smart_class_parameters/727 -X PUT -d >>> '{"smart_class_parameter":{"default_value":"localhost"}}' >>> >>> And I get: >>> >>> { >>> "error": {"message":"Validation failed: Lookup values is invalid"} >>> } >>> >>> >>> Through the GUI I can update parameters with this user... >>> >>> >>> >>> I didn't really find references to this error, and I'm a bit lost >>> here... Anybody help, please? >>> >>> 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-user...@googlegroups.com. >>> To post to this group, send email to forema...@googlegroups.com. >>> Visit this group at http://groups.google.com/group/foreman-users. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >>

I tried to reproduce this (in 1.7) using the matchers from your first mail
and the update worked fine for me.
The only change I made was adding to your curl statement: -H
"Content-Type: application/json".
Can you send me a private message with your db dump? or send more of the
logs (20-30 rows before the error)?
You could try removing the matchers, updating the default_value and then
adding them one by one and updating after each one to check which of them
is invalid

··· On Tue, Dec 16, 2014 at 6:04 PM, Cynthia Lopes wrote: > > Just one thing that I noticed later... I thought the issue was correct > because I installed a brand new foreman with more recent version, but it is > not a version problem in fact. I realised that I can still get this message > in foreman 1.6. I discovered that this happens when the parameter has > already been used for a deployment and the host gets a fqdn matcher. > > For example, a deployed a host with my puppet class and set my param to > the good value for this host. > That was ok, but then I tried to change the general description of my > param via the api and I get the error I reported: > { > "error": {"message":"Validation failed: Lookup values is invalid"} > } > On foreman logs I just get the same message. > > On the other hand, if I try to update a parameter class that has no match, > it works just fine. > > > Le vendredi 21 novembre 2014 23:03:13 UTC+1, Cynthia Lopes a écrit : > >> Yes, I was able to update the specific parameter through the UI. >> >> In the logs I only got internal server error... >> >> I was using an old foreman, version 1.4.3. I did not have the issue after >> upgrading to 1.6. >> >> It was probably fixed at some point. >> >> Thank you for your attention. :) >> >> >> Le mercredi 5 novembre 2014 15:11:15 UTC+1, Ori Rabin a écrit : >>> >>> Can you please send the server logs? >>> did you try editing this specific parameter in the GUI? >>> the error looks related to the matchers of this parameter and not the >>> user. >>> >>> On Tue, Nov 4, 2014 at 4:42 PM, Cynthia Lopes >>> wrote: >>> >>>> Hi! >>>> >>>> Help me please. Through the API I can GET a smart_class_parameter, so >>>> this works: >>>> >>>> curl -k -u '$user:$password' -H "Accept: version=2,application/json" >>>> https://foreman/api/v2/smart_class_parameters/727 -X GET >>>> >>>> Response ok: {"parameter":"db_host","id":727,"description":""," >>>> override":true,"parameter_type":"string","default_value" >>>> :"127.0.0.1","required":false,"validator_type":""," >>>> validator_rule":null,"override_value_order":"fqdn\ >>>> nhostgroup\nos\ndomain","override_values_count":3," >>>> created_at":"2014-04-17T14:57:20Z","updated_at":"2014-04- >>>> 17T15:09:48Z","puppetclass":{"id":174,"name":"osnumergy:: >>>> keystone","module_name":"osnumergy"},"override_values": >>>> [{"id":1463,"match":"fqdn=keystone.openstack.admin"," >>>> value":"mysql.openstack.admin"},{"id":808,"match":"fqdn= >>>> split2-keystone.openstack.admin","value":"split2-mysql1. >>>> openstack.admin"},{"id":1231,"match":"fqdn=r422-e2-10. >>>> openstack.admin","value":"10.197.219.43"}],"environments":[ >>>> {"id":17,"name":"openstack"}]} >>>> >>>> >>>> But when I try to update de smart_class_parameter it doesn't. >>>> I try this : >>>> >>>> curl -k -u '$user:$password' -H "Accept: version=2,application/json" >>>> https://foreman/api/v2/smart_class_parameters/727 -X PUT -d >>>> '{"smart_class_parameter":{"default_value":"localhost"}}' >>>> >>>> And I get: >>>> >>>> { >>>> "error": {"message":"Validation failed: Lookup values is invalid"} >>>> } >>>> >>>> >>>> Through the GUI I can update parameters with this user... >>>> >>>> >>>> >>>> I didn't really find references to this error, and I'm a bit lost >>>> here... Anybody help, please? >>>> >>>> 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-user...@googlegroups.com. >>>> To post to this group, send email to forema...@googlegroups.com. >>>> Visit this group at http://groups.google.com/group/foreman-users. >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>> -- > 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+unsubscribe@googlegroups.com. > To post to this group, send email to foreman-users@googlegroups.com. > Visit this group at http://groups.google.com/group/foreman-users. > For more options, visit https://groups.google.com/d/optout. >