Sha256: 02723834f15c20a2dae6c1e884aaf2d1be66fc36dd48ede441f52b94945c58e6

Contents?: true

Size: 1.17 KB

Versions: 3

Compression:

Stored size: 1.17 KB

Contents

# frozen_string_literal: true

module Foreman
  module Controller
    module Parameters
      # Keys to allow as parameters in the AnsibleVariable controller
      module AnsibleVariable
        extend ActiveSupport::Concern
        include Foreman::Controller::Parameters::LookupKey

        class_methods do
          def ansible_variable_params_filter
            Foreman::ParameterFilter.new(::AnsibleVariable).tap do |filter|
              filter.permit :ansible_roles => [], :ansible_role_ids => [],
                            :ansible_role_names => [],
                            :param_classes => [], :param_classes_ids => [],
                            :param_classes_names => []
              filter.permit_by_context :required, :nested => true
              filter.permit_by_context :id, :ui => false, :api => false,
                                            :nested => true

              add_lookup_key_params_filter(filter)
            end
          end
        end

        def ansible_variable_params
          self.class.ansible_variable_params_filter.filter_params(
            params,
            parameter_filter_context
          )
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
foreman_ansible-2.3.2 app/controllers/concerns/foreman/controller/parameters/ansible_variable.rb
foreman_ansible-2.3.1 app/controllers/concerns/foreman/controller/parameters/ansible_variable.rb
foreman_ansible-2.3.0 app/controllers/concerns/foreman/controller/parameters/ansible_variable.rb