Module: Facter::Util::Aix::InfoExtractor
- Defined in:
- lib/facter/util/aix/info_extractor.rb
Constant Summary collapse
- MEGABYTES_EXPONENT =
1024**2
- GIGABYTES_EXPONENT =
1024**3
- PROPERTIES =
{ lslv: [ 'LOGICAL VOLUME:', 'VOLUME GROUP:', 'LV IDENTIFIER:', 'PERMISSION:', 'VG STATE:', 'LV STATE:', 'TYPE:', 'WRITE VERIFY:', 'MAX LPs:', 'PP SIZE:', 'COPIES:', 'SCHED POLICY:', 'LPs:', 'PPs:', 'STALE PPs:', 'BB POLICY:', 'INTER-POLICY:', 'RELOCATABLE:', 'INTRA-POLICY:', 'UPPER BOUND:', 'MOUNT POINT:', 'LABEL:', 'MIRROR WRITE CONSISTENCY:', 'EACH LP COPY ON A SEPARATE PV ?:', 'Serialize IO ?:' ], lspv: [ 'PHYSICAL VOLUME:', 'VOLUME GROUP:', 'PV IDENTIFIER:', 'VG IDENTIFIER', 'PV STATE:', 'STALE PARTITIONS:', 'ALLOCATABLE:', 'PP SIZE:', 'LOGICAL VOLUMES:', 'TOTAL PPs:', 'VG DESCRIPTORS:', 'FREE PPs:', 'HOT SPARE:', 'USED PPs:', 'MAX REQUEST:', 'FREE DISTRIBUTION:', 'USED DISTRIBUTION:', 'MIRROR POOL:' ] }.freeze
Class Method Summary collapse
Class Method Details
.extract(content, cmd) ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/facter/util/aix/info_extractor.rb', line 59 def self.extract(content, cmd) property_hash = {} properties = PROPERTIES[cmd] properties.each do |property| str = (properties - [property]).join('|') matcher = content.match(/(?:^|^[^:]+:[^:]+)#{Regexp.escape(property)}([^\n]*?)(#{str}|\n|$)/s) if matcher value = matcher[1].strip property_hash[property.split(':').first] = value end end property_hash end |