Module: RspecPuppetFactsUnsupported

Included in:
Facts, UnsupportedFilteringOperation
Defined in:
lib/rspec-puppet-facts-unsupported.rb,
lib/rspec-puppet-facts-unsupported/version.rb,
lib/rspec-puppet-facts-unsupported/on_unsupported_os.rb

Overview

A main module of rspec-puppet-facts-unsupported

Defined Under Namespace

Classes: Facts, Integerlike, Randomizer, UnsupportedFilteringOperation

Constant Summary collapse

VERSION =
'0.1.1'.freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.verbose=(verbose) ⇒ Object



30
31
32
# File 'lib/rspec-puppet-facts-unsupported/on_unsupported_os.rb', line 30

def self.verbose=(verbose)
  @@verbose = (verbose == true) # rubocop:disable Style/ClassVars
end

.verbose?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/rspec-puppet-facts-unsupported/on_unsupported_os.rb', line 34

def self.verbose?
  @@verbose
end

Instance Method Details

#on_unsupported_os(opts = {}) ⇒ Object

Fetches an unsupported list of operating system’s facts. List doesn’t contains operating system described in Puppet’s metadata.json file. machine facts or ‘i86pc’ will be used instead of the “operatingsystem_support” section if the metadata file even if the file is missing. narrow the search like :random - to randomly shuffle records (exact shuffle seed will be printed on stderr to be able to reproduce invalid behaivior), ‘:original` - to return original list, an integer seed - to reproduce failiures. By default it is set to `:random`

Parameters:

  • Hash (Symbol => Object)

    opts A configuration hash with options

  • opts (Hash) (defaults to: {})

    a customizable set of options

Options Hash (opts):

  • :hardwaremodels (String, Array<String>)

    The OS architecture names, i.e. ‘x86_64’, /IBM/

  • :supported_os (Array<Hash>)

    If this options is provided the data

  • :filters (Array<Hash>)

    An array of extra filters to be passed to FacterDB to

  • :order (Array<Hash>)

    An order in which records should be returned. You can pass values

  • :limit (Array<Hash>)

    A limit of records to be returned. By default it is set to 2.



22
23
24
25
26
27
28
# File 'lib/rspec-puppet-facts-unsupported/on_unsupported_os.rb', line 22

def on_unsupported_os(opts = {})
  process_opts(opts)
  filters = calculate_filters(opts)
  facts = FacterDB.get_facts(filters)
  op = UnsupportedFilteringOperation.new(facts, opts)
  op.facts
end

#verbose?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/rspec-puppet-facts-unsupported/on_unsupported_os.rb', line 38

def verbose?
  RspecPuppetFactsUnsupported.verbose?
end