Module: Facter::Util::RhsmDisabledPools
- Defined in:
- lib/facter/rhsm_disabled_pools.rb
Overview
Disabled Subscroption Pools for this client.
Constant Summary collapse
- CACHE_TTL =
24 * 60 * 60 seconds
86_400
- CACHE_FILE =
'/var/cache/rhsm/disabled_pools.yaml'
Class Method Summary collapse
Class Method Details
.get_output(input) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/facter/rhsm_disabled_pools.rb', line 30 def get_output(input) lines = [] tmp = nil input.split("\n").each do |line| if line =~ %r{Pool ID:\s*(.+)$} tmp = Regexp.last_match(1).chomp next end if line =~ %r{Active:.+False} && !tmp.nil? tmpcopy = tmp lines.push(tmpcopy) # pointer math ahoy next end if line.match?(%r{Active:.+True}) tmp = nil end end lines end |
.rhsm_disabled_pools ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/facter/rhsm_disabled_pools.rb', line 50 def rhsm_disabled_pools value = [] begin consumed = Facter::Core::Execution.execute( '/usr/sbin/subscription-manager list --consumed', on_fail: :raise, ) value = get_output(consumed) rescue UncaughtThrowError, Facter::Core::Execution::ExecutionFailure => e if $ERROR_INFO !~ %r{This system is not yet registered} Facter.debug("#{e.backtrace[0]}: #{$ERROR_INFO}.") end end value end |