Module: ForemanPuppet::Extensions::HostgroupsControllerExtensions::Actions
- Defined in:
- app/controllers/concerns/foreman_puppet/extensions/hostgroups_controller_extensions.rb
Instance Method Summary collapse
- #environment_selected ⇒ Object
-
#hostgroup_params(top_level_hash = controller_name.singularize) ⇒ Object
params facets fix:.
- #nest ⇒ Object
- #puppetclass_parameters ⇒ Object
Instance Method Details
#environment_selected ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'app/controllers/concerns/foreman_puppet/extensions/hostgroups_controller_extensions.rb', line 31 def environment_selected env_id = params[:environment_id] || params[:hostgroup][:environment_id] || params.dig(:hostgroup, :puppet_attributes, :environment_id) return not_found if env_id.to_i.positive? && !(@environment = ForemanPuppet::Environment.find(env_id)) refresh_hostgroup puppet = @hostgroup.puppet || @hostgroup.build_puppet puppet.environment = @environment if @environment puppet.puppetclasses = ForemanPuppet::Puppetclass.where(id: params[:hostgroup][:puppetclass_ids]) puppet.config_groups = ForemanPuppet::ConfigGroup.where(id: params[:hostgroup][:config_group_ids]) render partial: 'hosts/form_puppet_enc_tab', locals: { subject: @hostgroup, resource_type: :hostgroup } end |
#hostgroup_params(top_level_hash = controller_name.singularize) ⇒ Object
params facets fix:
52 53 54 55 56 |
# File 'app/controllers/concerns/foreman_puppet/extensions/hostgroups_controller_extensions.rb', line 52 def hostgroup_params(top_level_hash = controller_name.singularize) filter = self.class.hostgroup_params_filter filter.permit(puppet_attributes: {}) filter.filter_params(params, parameter_filter_context, top_level_hash) end |
#nest ⇒ Object
24 25 26 27 28 29 |
# File 'app/controllers/concerns/foreman_puppet/extensions/hostgroups_controller_extensions.rb', line 24 def nest super return unless @parent.puppet puppet = @hostgroup.puppet || @hostgroup.build_puppet puppet.puppetclasses = @parent.puppet.puppetclasses end |
#puppetclass_parameters ⇒ Object
44 45 46 47 48 49 |
# File 'app/controllers/concerns/foreman_puppet/extensions/hostgroups_controller_extensions.rb', line 44 def puppetclass_parameters ::Taxonomy.as_taxonomy @organization, @location do render partial: 'foreman_puppet/puppetclasses/classes_parameters', locals: { obj: refresh_hostgroup } end end |