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/remove_hidden_distribution.rb, line 12 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `PulpPythonClient::PythonPythonDistribution` initialize method" end # 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::PythonPythonDistribution`. 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?(:'base_path') self.base_path = attributes[:'base_path'] end if attributes.key?(:'content_guard') self.content_guard = attributes[:'content_guard'] end if attributes.key?(:'hidden') self.hidden = attributes[:'hidden'] # Monkey-patch here. The rest of the initializer is copied from the library code. #else # self.hidden = false end if attributes.key?(:'pulp_labels') if (value = attributes[:'pulp_labels']).is_a?(Hash) self.pulp_labels = value end end if attributes.key?(:'name') self.name = attributes[:'name'] end if attributes.key?(:'repository') self.repository = attributes[:'repository'] end if attributes.key?(:'publication') self.publication = attributes[:'publication'] end if attributes.key?(:'allow_uploads') self.allow_uploads = attributes[:'allow_uploads'] else self.allow_uploads = true end if attributes.key?(:'remote') self.remote = attributes[:'remote'] end end
Public Instance Methods
find_katello_assets(args = {})
click to toggle source
# File lib/katello/plugin.rb, line 791 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
hashify_parameters(parameters)
click to toggle source
# File lib/katello/plugin.rb, line 375 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 379 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