Module: Facter::Util::RhsmEnabledRepos
- Defined in:
- lib/facter/rhsm_enabled_repos.rb
Overview
Enabled RHSM repos for this client
Constant Summary collapse
- CACHE_TTL =
24 * 60 * 60 seconds
86_400
- CACHE_FILE =
'/var/cache/rhsm/enabled_repos.yaml'
Class Method Summary collapse
Class Method Details
.rhsm_enabled_repos ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/facter/rhsm_enabled_repos.rb', line 30 def rhsm_enabled_repos value = [] begin reponame = '' output = Facter::Core::Execution.execute( '/usr/sbin/subscription-manager repos', on_fail: :raise, ) unless output.nil? || !output.is_a?(String) output.split("\n").each do |line| if line =~ %r{Repo ID:\s+(\S+)} reponame = Regexp.last_match(1).chomp elsif line.match?(%r{.*Enabled:\s+1}) if reponame != '' value.push(reponame) reponame = '' end end end end 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 |