Project

General

Profile

Actions

Refactor #7583

open

Parameters method inconsistency

Added by Daniel Lobato Garcia over 9 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Rails
Target version:
-
Difficulty:
medium
Triaged:
Fixed in Releases:
Found in Releases:

Description

.parameters works differently depending on the kind of object we have.
When it's an object with inheritance (Hostgroups, Taxonomies), it means "return this object parameters + parent parameters".
When it's a regular object (Hosts, OSs, Domains), it means "return this object's parameters".
In order to get only the "object" parameters on objects with inheritance you have to run "xxx_parameters", where "xxx" is not even the name of the class in some cases, "group_parameters" instead of "hostgroup_parameters".

It's not obvious at all, and we don't make such an extensive use of parameters in the code that makes this refactor difficult, in fact it should take only a few hours.
I'd suggest we change the code to use "classname_parameters" and "classname_including_ancestors_parameters", it'd make things easier to generalize than with non-standard names (for instance, see parameters_method in api/v2/parameters_controller).

No data to display

Actions

Also available in: Atom PDF