API returning duplicate smart_class_parameters

Im not sure if this is expected behaviour or not but when calling the v2
API for all smart_class parameters for a host, the response includes
multiple copies of the same parameter. For example…

calling /api/hosts/X/smart_class_parameters

<- SNIP ->
'results': [{'created_at': '2015-01-28T10:34:16Z',
'default_value': 'environment',
'description': None,
'id': 9,
'override': False,
'override_value_order': 'fqdn\nhostgroup\nos\ndomain',
'override_values_count': 0,
'parameter': 'autohostsscope',
'parameter_type': 'string',
'required': False,
'updated_at': '2015-01-28T10:34:16Z',
'validator_rule': None,
'validator_type': None},
{'created_at': '2015-01-28T10:34:17Z',
'default_value': 'environment',
'description': 'mydesc',
'id': 25,
'override': True,
'override_value_order':
'fqdn\nhostgroup\noperatingsystemrelease\nenvironment\nall_environments\ndefault_parameters_environment',
'override_values_count': 2,
'parameter': 'autohostsscope',
'parameter_type': 'string',
'required': False,
'updated_at': '2015-02-03T13:17:48Z',
'validator_rule': None,
'validator_type': None},
<- SNIP ->

You can see there are 2 instances of the parameter named 'autohostsscope',
with different override orders and different timestamps.

If I make this call

/api/environments/production/puppetclasses/MYCLASSID/smart_class_parameters

I get just one version of the override (the one with the later timestamp).
Obviously the foreman GUI shows the same.

Is the /api/hosts/X/smart_class_parameters API deliberately showing old
versions of a smart class parameter or is there a bug somewhere?

Thanks
Jeff

what does the foreman GUI show in the host itself?
is there a chance you have the same name of parameter in different puppet
classes?

··· On Tue, Feb 3, 2015 at 6:04 PM, Jeff wrote:

Im not sure if this is expected behaviour or not but when calling the v2
API for all smart_class parameters for a host, the response includes
multiple copies of the same parameter. For example…

calling /api/hosts/X/smart_class_parameters

<- SNIP ->
‘results’: [{‘created_at’: ‘2015-01-28T10:34:16Z’,
‘default_value’: ‘environment’,
‘description’: None,
‘id’: 9,
‘override’: False,
‘override_value_order’: ‘fqdn\nhostgroup\nos\ndomain’,
‘override_values_count’: 0,
‘parameter’: ‘autohostsscope’,
‘parameter_type’: ‘string’,
‘required’: False,
‘updated_at’: ‘2015-01-28T10:34:16Z’,
‘validator_rule’: None,
‘validator_type’: None},
{‘created_at’: ‘2015-01-28T10:34:17Z’,
‘default_value’: ‘environment’,
‘description’: ‘mydesc’,
‘id’: 25,
‘override’: True,
‘override_value_order’:
‘fqdn\nhostgroup\noperatingsystemrelease\nenvironment\nall_environments\ndefault_parameters_environment’,
‘override_values_count’: 2,
‘parameter’: ‘autohostsscope’,
‘parameter_type’: ‘string’,
‘required’: False,
‘updated_at’: ‘2015-02-03T13:17:48Z’,
‘validator_rule’: None,
‘validator_type’: None},
<- SNIP ->

You can see there are 2 instances of the parameter named ‘autohostsscope’,
with different override orders and different timestamps.

If I make this call

/api/environments/production/puppetclasses/MYCLASSID/smart_class_parameters

I get just one version of the override (the one with the later timestamp).
Obviously the foreman GUI shows the same.

Is the /api/hosts/X/smart_class_parameters API deliberately showing old
versions of a smart class parameter or is there a bug somewhere?

Thanks
Jeff


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.

Sorry to bring this back from the dead but I've just noticed that this is
still ongoing and may have figured out the reason.

In our setup we generally have multiple copies of puppet classes in
different environments. We programatically set most class parameters to be
override-able whenever we copy a class into an environment. This is done
using the API. If we have the same puppet class in multiple environments
and set the sc-parameter to be override-able then we see a duplicate
sc-parameter entry, even though it has the same id's…

hammer sc-param list --puppet-class nsp_mlds

-----|----------------|---------------|----------|-------------

ID PARAMETER DEFAULT VALUE OVERRIDE PUPPET CLASS
1746 autohostsscope environment true
1746 autohostsscope environment true
1746 autohostsscope environment true
1746 autohostsscope environment true
1746 autohostsscope environment true
1746 autohostsscope environment true
1746 autohostsscope environment true
1746 autohostsscope environment true
1746 autohostsscope environment true
1746 autohostsscope environment true
1746 autohostsscope environment true
1746 autohostsscope environment true
1746 autohostsscope environment true

<----SNIP—>

Is this expected behaviour?
Jeff

··· On Thursday, 5 February 2015 12:39:37 UTC, Ori Rabin wrote: > > what does the foreman GUI show in the host itself? > is there a chance you have the same name of parameter in different puppet > classes? > > On Tue, Feb 3, 2015 at 6:04 PM, Jeff <je...@potchin.co.uk > > wrote: > >> Im not sure if this is expected behaviour or not but when calling the v2 >> API for all smart_class parameters for a host, the response includes >> multiple copies of the same parameter. For example.. >> >> >> calling /api/hosts/X/smart_class_parameters >> >> <- SNIP -> >> 'results': [{'created_at': '2015-01-28T10:34:16Z', >> 'default_value': 'environment', >> 'description': None, >> 'id': 9, >> 'override': False, >> 'override_value_order': 'fqdn\nhostgroup\nos\ndomain', >> 'override_values_count': 0, >> 'parameter': 'autohostsscope', >> 'parameter_type': 'string', >> 'required': False, >> 'updated_at': '2015-01-28T10:34:16Z', >> 'validator_rule': None, >> 'validator_type': None}, >> {'created_at': '2015-01-28T10:34:17Z', >> 'default_value': 'environment', >> 'description': 'mydesc', >> 'id': 25, >> 'override': True, >> 'override_value_order': >> 'fqdn\nhostgroup\noperatingsystemrelease\nenvironment\nall_environments\ndefault_parameters_environment', >> 'override_values_count': 2, >> 'parameter': 'autohostsscope', >> 'parameter_type': 'string', >> 'required': False, >> 'updated_at': '2015-02-03T13:17:48Z', >> 'validator_rule': None, >> 'validator_type': None}, >> <- SNIP -> >> >> You can see there are 2 instances of the parameter named >> 'autohostsscope', with different override orders and different timestamps. >> >> If I make this call >> >> >> /api/environments/production/puppetclasses/MYCLASSID/smart_class_parameters >> >> I get just one version of the override (the one with the later >> timestamp). Obviously the foreman GUI shows the same. >> >> Is the /api/hosts/X/smart_class_parameters API deliberately showing old >> versions of a smart class parameter or is there a bug somewhere? >> >> Thanks >> Jeff >> >> -- >> 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. >> > >