Revision 984a8793
Added by Shimon Shtein over 8 years ago
app/helpers/hosts_and_hostgroups_helper.rb | ||
---|---|---|
{ :include_blank => blank_or_inherit_f(f, :puppet_ca_proxy),
|
||
:disable_button => can_override ? _(INHERIT_TEXT) : nil,
|
||
:disable_button_enabled => override && !explicit_value?(:puppet_ca_proxy_id),
|
||
:user_set => params[:host] && params[:host][:puppet_ca_proxy_id]
|
||
:user_set => user_set?(:puppet_ca_proxy_id)
|
||
},
|
||
{ :label => _("Puppet CA"),
|
||
:help_inline => _("Use this puppet server as a CA server") }
|
||
... | ... | |
{ :include_blank => blank_or_inherit_f(f, :puppet_proxy),
|
||
:disable_button => can_override ? _(INHERIT_TEXT) : nil,
|
||
:disable_button_enabled => override && !explicit_value?(:puppet_proxy_id),
|
||
:user_set => params[:host] && params[:host][:puppet_proxy_id]
|
||
:user_set => user_set?(:puppet_proxy_id)
|
||
|
||
},
|
||
{ :label => _("Puppet Master"),
|
||
... | ... | |
{ :include_blank => true,
|
||
:disable_button => can_override ? _(INHERIT_TEXT) : nil,
|
||
:disable_button_enabled => override && !explicit_value?(:realm_id),
|
||
:user_set => params[:host] && params[:host][:realm_id]
|
||
:user_set => user_set?(:realm_id)
|
||
},
|
||
{ :help_inline => :indicator }
|
||
).html_safe
|
||
... | ... | |
return false unless params[:host]
|
||
!!params[:host][field]
|
||
end
|
||
|
||
def user_set?(field)
|
||
# if the host has no hostgroup
|
||
return true unless @host && @host.hostgroup
|
||
# when editing a host, the values are specified explicitly
|
||
return true if params[:action] == 'edit'
|
||
return true if params[:action] == 'clone'
|
||
# check if the user set the field explicitly despite setting a hostgroup.
|
||
params[:host] && params[:host][:hostgroup_id] && params[:host][field]
|
||
end
|
||
end
|
Also available in: Unified diff
Fixes #12794 - Defined logic when properties should be sent to server
If hostgroup is not set - always send the parameters.
On hostgroup change - remove inherited parameters from the request, so the values from the hostgroup will take place.
On save - send the values according to the state of the "inherit" button.
(cherry picked from commit d94f4d361dd9ca35a41cee1e00f72476200c8238)