Module: Facter::Util::Pulp

Defined in:
lib/facter/util/pulp.rb

Class Method Summary collapse

Class Method Details

.consumer_status_matchdataObject



2
3
4
5
6
7
8
9
# File 'lib/facter/util/pulp.rb', line 2

def self.consumer_status_matchdata
  status = Facter::Util::Resolution.exec('pulp-consumer status')
  return nil if status.nil?
  # Strip color from command output
  status.gsub!(/\e\[([;\d]+)?m/, '')
  /^This consumer is registered to the server\s\[(.*)\]\swith\sthe\sID\s\[(.*)\]\.$/.match(status)
  result = {:server_id => $1, :consumer_id => $2}
end

.pulp_consumer_idObject



11
12
13
14
# File 'lib/facter/util/pulp.rb', line 11

def self.pulp_consumer_id
  matchdata = consumer_status_matchdata
  matchdata[:consumer_id] unless matchdata.nil?
end

.pulp_consumer_serverObject



16
17
18
19
# File 'lib/facter/util/pulp.rb', line 16

def self.pulp_consumer_server
  matchdata = consumer_status_matchdata
  matchdata[:server_id] unless matchdata.nil?
end