Class: Puppet_X::Coi::Jboss::FactsRefresher

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet_x/coi/jboss/factsrefresher.rb

Class Method Summary collapse

Class Method Details

.delete_resolves(fact_symbol) ⇒ Object

Method used to delete resolves in given fact

Parameters:

  • fact_symbol (String)

    that resolves should be deleted



24
25
26
27
# File 'lib/puppet_x/coi/jboss/factsrefresher.rb', line 24

def delete_resolves fact_symbol
  fct = Facter.fact fact_symbol
  fct.instance_variable_set(:@resolves, [])
end

.delete_value(fact_symbol) ⇒ Object

Method used to delete values in given fact

Parameters:

  • fact_symbol (String)

    that value should be deleted



31
32
33
34
# File 'lib/puppet_x/coi/jboss/factsrefresher.rb', line 31

def delete_value fact_symbol
  fct = Facter.fact fact_symbol
  fct.instance_variable_set(:@value, {})
end

.refresh_facts(value) ⇒ Object

Method to refresh given facts

Parameters:

  • list ([Symbol])

    of fact symbols to be refreshed



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/puppet_x/coi/jboss/factsrefresher.rb', line 8

def refresh_facts value
  facts = Facter.list # get list of symbols of facts in the system
  config = Puppet_X::Coi::Jboss::Configuration::read

  value.each do |val|
    raise Puppet::Error, 'You can only delete fact that are made by jboss_module(start with jboss_)' unless validate_fact_name val
    delete_resolves val
    delete_value val

    fact_value = config[val.to_sym]
    Puppet_X::Coi::Jboss::Facts::add_fact(val.to_sym, fact_value)
  end
end