Sha256: 4357cc642ed318f37952b62ca273aedd0a9da530fc21ef416369eac2fa95773c

Contents?: true

Size: 1.16 KB

Versions: 26

Compression:

Stored size: 1.16 KB

Contents

module ForemanOpenscap
  module ClientConfig
    class Base
      delegate :server_param, :port_param, :policies_param, :config_item_name,
               :config_item_class_name, :override_method_name, :msg_name,
               :lookup_key_plural_name, :to => :constants

      def type
        raise NotImplementedError
      end

      def inline_help
        {
          :text => '',
          :replace_text => '',
          :route_helper_method => nil
        }
      end

      def managed_overrides?
        true
      end

      def available?
        raise NotImplementedError
      end

      def constants
        raise NotImplementedError
      end

      def collection_method
        constants.config_item_class_name&.pluralize&.underscore
      end

      def all_collection_method
        "all_#{collection_method}".to_sym
      end

      def find_config_item(scope = config_item_class_name.constantize)
        return scope.find_by :name => config_item_name if scope.respond_to?(:find_by)
        # all_puppetclasses, all_ansible_roles methods return Array, not ActiveRecord::Relation
        scope.find { |item| item.name == config_item_name }
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
foreman_openscap-4.1.3 app/services/foreman_openscap/client_config/base.rb
foreman_openscap-4.0.6 app/services/foreman_openscap/client_config/base.rb
foreman_openscap-4.2.0 app/services/foreman_openscap/client_config/base.rb
foreman_openscap-4.0.5 app/services/foreman_openscap/client_config/base.rb
foreman_openscap-4.1.2 app/services/foreman_openscap/client_config/base.rb
foreman_openscap-4.1.1 app/services/foreman_openscap/client_config/base.rb
foreman_openscap-4.1.0 app/services/foreman_openscap/client_config/base.rb
foreman_openscap-4.0.4 app/services/foreman_openscap/client_config/base.rb
foreman_openscap-4.0.3 app/services/foreman_openscap/client_config/base.rb
foreman_openscap-4.0.2 app/services/foreman_openscap/client_config/base.rb
foreman_openscap-4.0.1 app/services/foreman_openscap/client_config/base.rb
foreman_openscap-3.0.1 app/services/foreman_openscap/client_config/base.rb
foreman_openscap-4.0.0 app/services/foreman_openscap/client_config/base.rb
foreman_openscap-3.0.0 app/services/foreman_openscap/client_config/base.rb
foreman_openscap-2.0.2 app/services/foreman_openscap/client_config/base.rb
foreman_openscap-1.0.10 app/services/foreman_openscap/client_config/base.rb
foreman_openscap-2.0.1 app/services/foreman_openscap/client_config/base.rb
foreman_openscap-1.0.9 app/services/foreman_openscap/client_config/base.rb
foreman_openscap-2.0.0 app/services/foreman_openscap/client_config/base.rb
foreman_openscap-1.0.8 app/services/foreman_openscap/client_config/base.rb