Issue #10238 has been updated by Jason Gill.

I think the only other information that can be reliably retrieved is size (it's 
the value of /sys/block/*/size multiplied by 512 to get bytes). Other details 
like SCSI LUN, if the device is removable, etc, may be harder to detect and are 
more edge cases than it may be worth finding.

That being said, it's easy to get the size = I could just update the fact to 
report:

blockdevice_sda => WDC WD5000AAKS-0,465.76 GB
blockdevice_sdb => DELL PERC H700,4.09 TB
blockdevices => sda,sdb

The memory fact already has a nice util class which can shift numbers from 
bytes to the appropriate scale (ie, GB, TB) which could be stolen and used here.

Thoughts? This should be real easy to add and add tests for
----------------------------------------
Feature #10238: Add support for identifying block devices to Facter
https://projects.puppetlabs.com/issues/10238

Author: Jason Gill
Status: Tests Insufficient
Priority: Low
Assignee: Adrien Thebo
Category: library
Target version: 
Keywords: 
Branch: 
Affected Facter version: 


I've written a simple fact for Facter which parses /sys/block/ on Linux to 
identify block devices attached to the machine. This fact is serving as a good 
base for a hardware RAID querying fact that I'm working on, so I hoped to get 
it added to a future release of Facter. Additionally, users of the Puppet 
Inventory Service could find this quite handy for identifying the disks 
attached to machines (we have hundreds of servers with a large number of 
different disks and we're trying to identify machines that have older or slower 
drives still in use).

You can find my code [over at 
github](https://github.com/jasongill/facter-factpack/blob/master/blockdevice.rb)

Example output from a machine with 2x Dell PowerEdge RAID Controller arrays and 
a CD drive:
    blockdevice_sda => DELL PERC H700
    blockdevice_sdb => DELL PERC H700
    blockdevice_sr0 => TEAC DVD-ROM DV-28SW
    blockdevices => sda,sdb,sr0    

Example output from a machine with two Western Digital SATA disks:
    blockdevice_sda => ATA WDC WD5000AAKS-0
    blockdevice_sdb => ATA WDC WD5000AAKS-0
    blockdevices => sda,sdb
    
I'm open to feedback (or please close this if I'm out of line suggesting a new 
fact that I wrote) - this is my first real Ruby work!


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to