Module: ForemanSalt::Concerns::HostgroupsControllerExtensions

Extended by:
ActiveSupport::Concern
Defined in:
app/controllers/foreman_salt/concerns/hostgroups_controller_extensions.rb

Instance Method Summary collapse

Instance Method Details

#salt_environment_selectedObject



10
11
12
13
14
15
16
17
18
19
20
# File 'app/controllers/foreman_salt/concerns/hostgroups_controller_extensions.rb', line 10

def salt_environment_selected
  @hostgroup = Hostgroup.authorized(:view_hostgroups, Hostgroup).find_by_id(params[:hostgroup_id]) || Hostgroup.new(params[:hostgroup])

  if params[:hostgroup][:salt_environment_id].present?
    @salt_environment = ::ForemanSalt::SaltEnvironment.friendly.find(params[:hostgroup][:salt_environment_id])
    load_vars_for_ajax
    render :partial => 'foreman_salt/salt_modules/host_tab_pane'
  else
    logger.info 'environment_id is required to render states'
  end
end