Module: Facter::Util::RhsmAvailablePools
- Defined in:
- lib/facter/rhsm_available_pools.rb
Overview
Available Subscription Pools for this client.
Constant Summary collapse
- CACHE_TTL =
24 * 60 * 60 seconds
86_400
- CACHE_FILE =
'/var/cache/rhsm/available_pools.yaml'
Class Method Summary collapse
Class Method Details
.get_output(input) ⇒ Object
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/facter/rhsm_available_pools.rb', line 30 def get_output(input) lines = [] input.split("\n").each do |line| if line =~ %r{Pool ID:\s+(.+)$} lines.push(Regexp.last_match(1).chomp) next end end lines end |
.rhsm_available_pools ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/facter/rhsm_available_pools.rb', line 41 def rhsm_available_pools value = [] begin available = Facter::Core::Execution.execute( '/usr/sbin/subscription-manager list --available', on_fail: :raise, ) value = get_output(available) 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 |