Module: Facter::Util::RhsmIdentity
- Defined in:
- lib/facter/rhsm_identity.rb
Overview
identity of this client
Constant Summary collapse
- CACHE_TTL =
24 * 60 * 60 seconds
86_400
- CACHE_FILE =
'/var/cache/rhsm/identity.yaml'
Class Method Summary collapse
Class Method Details
.rhsm_identity ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/facter/rhsm_identity.rb', line 31 def rhsm_identity value = nil begin output = Facter::Core::Execution.execute( '/usr/sbin/subscription-manager identity', on_fail: Facter::Core::Execution::ExecutionFailure, ) unless output.nil? output.split("\n").each do |line| if line =~ %r{.* identity(?: is)?: (\S{8}\-\S{4}\-\S{4}\-\S{4}\-\S{12}).*} value = Regexp.last_match(1) 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 |