class Object
Public Class Methods
new(attributes = {})
click to toggle source
Initializes the object @param [Hash] attributes Model attributes in the form of hash
# File lib/monkeys/python_remote_provenance.rb, line 19 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `PulpPythonClient::PythonPythonRemote` initialize method" end # Remove provenance field for backwards compatibility with Pulp < 3.90 # This field was added in pulp_python 3.20+ but is not recognized by older Pulp versions attributes = attributes.except(:provenance, 'provenance') # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `PulpPythonClient::PythonPythonRemote`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'name') self.name = attributes[:'name'] end if attributes.key?(:'url') self.url = attributes[:'url'] end if attributes.key?(:'ca_cert') self.ca_cert = attributes[:'ca_cert'] end if attributes.key?(:'client_cert') self.client_cert = attributes[:'client_cert'] end if attributes.key?(:'client_key') self.client_key = attributes[:'client_key'] end if attributes.key?(:'tls_validation') self.tls_validation = attributes[:'tls_validation'] end if attributes.key?(:'proxy_url') self.proxy_url = attributes[:'proxy_url'] end if attributes.key?(:'proxy_username') self.proxy_username = attributes[:'proxy_username'] end if attributes.key?(:'proxy_password') self.proxy_password = attributes[:'proxy_password'] end if attributes.key?(:'username') self.username = attributes[:'username'] end if attributes.key?(:'password') self.password = attributes[:'password'] end if attributes.key?(:'pulp_labels') if (value = attributes[:'pulp_labels']).is_a?(Hash) self.pulp_labels = value end end if attributes.key?(:'download_concurrency') self.download_concurrency = attributes[:'download_concurrency'] end if attributes.key?(:'max_retries') self.max_retries = attributes[:'max_retries'] end if attributes.key?(:'policy') self.policy = attributes[:'policy'] end if attributes.key?(:'total_timeout') self.total_timeout = attributes[:'total_timeout'] end if attributes.key?(:'connect_timeout') self.connect_timeout = attributes[:'connect_timeout'] end if attributes.key?(:'sock_connect_timeout') self.sock_connect_timeout = attributes[:'sock_connect_timeout'] end if attributes.key?(:'sock_read_timeout') self.sock_read_timeout = attributes[:'sock_read_timeout'] end if attributes.key?(:'headers') if (value = attributes[:'headers']).is_a?(Array) self.headers = value end end if attributes.key?(:'rate_limit') self.rate_limit = attributes[:'rate_limit'] end if attributes.key?(:'includes') if (value = attributes[:'includes']).is_a?(Array) self.includes = value end end if attributes.key?(:'excludes') if (value = attributes[:'excludes']).is_a?(Array) self.excludes = value end end if attributes.key?(:'prereleases') self.prereleases = attributes[:'prereleases'] end if attributes.key?(:'package_types') if (value = attributes[:'package_types']).is_a?(Array) self.package_types = value end end if attributes.key?(:'keep_latest_packages') self.keep_latest_packages = attributes[:'keep_latest_packages'] else self.keep_latest_packages = 0 end if attributes.key?(:'exclude_platforms') if (value = attributes[:'exclude_platforms']).is_a?(Array) self.exclude_platforms = value end end # Note: provenance field is intentionally skipped for backwards compatibility end
Public Instance Methods
find_katello_assets(args = {})
click to toggle source
# File lib/katello/plugin.rb, line 792 def find_katello_assets(args = {}) type = args.fetch(:type, nil) vendor = args.fetch(:vendor, false) if vendor asset_dir = "#{Katello::Engine.root}/vendor/assets/#{type}/" else asset_dir = "#{Katello::Engine.root}/app/assets/#{type}/" end asset_paths = Dir[File.join(asset_dir, '**', '*')].reject { |file| File.directory?(file) } asset_paths.each { |file| file.slice!(asset_dir) } asset_paths end
gpgcheck=(gpgcheck)
click to toggle source
Custom attribute writer method with validation @param [Object] gpgcheck Value to be assigned
# File lib/monkeys/fix_rpm_repository_gpgcheck.rb, line 10 def gpgcheck=(gpgcheck) # Allow nil for deprecated field - monkey patch here if !gpgcheck.nil? && gpgcheck > 1 fail ArgumentError, 'invalid value for "gpgcheck", must be smaller than or equal to 1.' end if !gpgcheck.nil? && gpgcheck < 0 fail ArgumentError, 'invalid value for "gpgcheck", must be greater than or equal to 0.' end @gpgcheck = gpgcheck end
hashify_parameters(parameters)
click to toggle source
# File lib/katello/plugin.rb, line 384 def hashify_parameters(parameters) Hash[parameters.map { |p| [p, p] }] end
katello_template_setting_values(name)
click to toggle source
# File lib/katello/plugin.rb, line 388 def katello_template_setting_values(name) templates = ProvisioningTemplate.where(:template_kind => TemplateKind.where(:name => name)) templates.each_with_object({}) { |tmpl, hash| hash[tmpl.name] = tmpl.name } end
remove_orphan_facets()
click to toggle source
# File lib/katello/tasks/clean_orphaned_facets.rb, line 8 def remove_orphan_facets ::Katello::Host::ContentFacet.select { |c| c.host.nil? }&.each do |content_facet| Rails.logger.info "Deleting content facet with id: #{content_facet.id}\n" content_facet.destroy end Katello::Host::SubscriptionFacet.select { |s| s.host.nil? }&.each do |subscription_facet| Rails.logger.info "Deleting subscription facet with id: #{subscription_facet.id}\n" subscription_facet.destroy end rescue RuntimeError => e Rails.logger.error "Task failed: #{e}" end
repo_gpgcheck=(repo_gpgcheck)
click to toggle source
Custom attribute writer method with validation @param [Object] repo_gpgcheck Value to be assigned
# File lib/monkeys/fix_rpm_repository_gpgcheck.rb, line 25 def repo_gpgcheck=(repo_gpgcheck) # Allow nil for deprecated field - monkey patch here if !repo_gpgcheck.nil? && repo_gpgcheck > 1 fail ArgumentError, 'invalid value for "repo_gpgcheck", must be smaller than or equal to 1.' end if !repo_gpgcheck.nil? && repo_gpgcheck < 0 fail ArgumentError, 'invalid value for "repo_gpgcheck", must be greater than or equal to 0.' end @repo_gpgcheck = repo_gpgcheck end