Sha256: 0612fc7a97d1a3cd1894ec92e71c916332235f7a6c43e9221d3a90356c6166bf

Contents?: true

Size: 1.12 KB

Versions: 7

Compression:

Stored size: 1.12 KB

Contents

require 'foreman_inventory_upload/engine'

module ForemanInventoryUpload
  def self.base_folder
    # in production setup, where selinux is enabled, we only have rights to
    # create folders under /ver/lib/foreman. If the folder does not exist, it's
    # a dev setup, where we can use our current root
    @base_folder ||= File.join(
      Dir.glob('/var/lib/foreman').first || Dir.getwd,
      'red_hat_inventory/'
    )
  end

  def self.uploads_folder(group)
    @uploads_folders ||= {}
    cache = @uploads_folders[group]
    return cache if cache

    @uploads_folders[group] = ensure_folder(
      File.join(
        ForemanInventoryUpload.base_folder,
        'uploads/',
        "#{group}/"
      )
    )
  end

  def self.outputs_folder
    @outputs_folder ||= ensure_folder(File.join(ForemanInventoryUpload.base_folder, 'outputs/'))
  end

  def self.upload_script_file
    'uploader.sh'
  end

  def self.facts_archive_name
    'hosts_report.tar.gz'
  end

  def self.upload_url
    'https://ci.cloud.paas.psi.redhat.com/api/ingress/v1/upload'
  end

  def self.ensure_folder(folder)
    FileUtils.mkdir_p(folder)
    folder
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
foreman_inventory_upload-1.0.0.beta6 lib/foreman_inventory_upload.rb
foreman_inventory_upload-1.0.0.beta5 lib/foreman_inventory_upload.rb
foreman_inventory_upload-1.0.0.beta4 lib/foreman_inventory_upload.rb
foreman_inventory_upload-1.0.0.beta3 lib/foreman_inventory_upload.rb
foreman_inventory_upload-1.0.0.beta2 lib/foreman_inventory_upload.rb
foreman_inventory_upload-1.0.0.beta1 lib/foreman_inventory_upload.rb
foreman_inventory_upload-0.0.1.dev1 lib/foreman_inventory_upload.rb