Class: Puppet_X::Coi::Jboss::Facts
- Inherits:
-
Object
- Object
- Puppet_X::Coi::Jboss::Facts
- Defined in:
- lib/puppet_x/coi/jboss/facts.rb
Overview
A class for JBoss facts
Class Method Summary collapse
-
.add_fact(name, value) ⇒ Object
Add new fact with name and value taken from function parameters.
-
.define_fullconfig_fact ⇒ Object
Add settings of jboss configuration file to facts.
-
.dockerized? ⇒ boolean
deprecated
Deprecated.
TODO: remove after dropping support for Puppet 2.x
Class Method Details
.add_fact(name, value) ⇒ Object
Add new fact with name and value taken from function parameters
42 43 44 |
# File 'lib/puppet_x/coi/jboss/facts.rb', line 42 def add_fact name, value Facter.add(name.to_sym) { setcode { value } } end |
.define_fullconfig_fact ⇒ Object
Add settings of jboss configuration file to facts
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/puppet_x/coi/jboss/facts.rb', line 7 def define_fullconfig_fact config = Puppet_X::Coi::Jboss::Configuration::read unless config.nil? config.each do |key, value| fact_symbol = "jboss_#{key}".to_sym add_fact fact_symbol, value end Facter.add(:jboss_fullconfig) do setcode do if Puppet_X::Coi::Jboss::Configuration.ruby_version < '1.9.0' class << config define_method(:to_s, proc { self.inspect }) end end config end end end end |
.dockerized? ⇒ boolean
Deprecated.
TODO: remove after dropping support for Puppet 2.x
Check if is running inside Docker container Implementation is taken from Facter 2.1.x
31 32 33 34 35 36 37 |
# File 'lib/puppet_x/coi/jboss/facts.rb', line 31 def dockerized? path = Pathname.new('/proc/1/cgroup') return false unless path.readable? in_docker = path.readlines.any? {|l| l.split(":")[2].to_s.start_with? '/docker/' } return true if in_docker return false end |