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/fix_deb_optimized_sync.rb, line 5
def initialize(attributes = {})
  unless attributes.is_a?(Hash)
    fail ArgumentError, "The input argument (attributes) must be a hash in `PulpDebClient::AptRepositorySyncURL` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) do |(k, v), h|
    unless self.class.attribute_map.key?(k.to_sym)
      fail ArgumentError, "`#{k}` is not a valid attribute in `PulpDebClient::AptRepositorySyncURL`. 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
  end

  if attributes.key?(:remote)
    self.remote = attributes[:remote]
  end

  if attributes.key?(:mirror)
    self.mirror = attributes[:mirror]
  else
    self.mirror = false
  end

  if attributes.key?(:optimize)
    self.optimize = attributes[:optimize]
    # Monkey-patch here. Rest of the initializer is copied from the gem code.
    #else
    #  self.optimize = true
  end
end

Public Instance Methods

find_katello_assets(args = {}) click to toggle source
# File lib/katello/plugin.rb, line 764
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 350
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 354
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