Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

infiniband_fw_versions.rb - report on all firmware versions #37

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@

All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org).

## Unreleased

- tskirvin: adding `infiniband_fw_versions.rb` to report multiple firmware
versions on different adapters

## [v4.1.0](https://github.com/treydock/puppet-infiniband/tree/v4.1.0) (2022-08-22)

[Full Changelog](https://github.com/treydock/puppet-infiniband/compare/v4.0.0...v4.1.0)

### Added


- Replace CentOS 8 support with Rocky/AlmaLinux 8 [\#34](https://github.com/treydock/puppet-infiniband/pull/34) ([treydock](https://github.com/treydock))
- Mirror puppet-module-mofed nm\_controlled behavior [\#33](https://github.com/treydock/puppet-infiniband/pull/33) ([pedmon](https://github.com/pedmon))

Expand Down
29 changes: 29 additions & 0 deletions lib/facter/infiniband_fw_versions.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Fact: infiniband_fw_versions
#
# Purpose: Report the version of all InfiniBand hardware
#
# Resolution:
# Returns InfiniBand device FW Versions
#

require 'facter/util/infiniband'

Facter.add(:infiniband_fw_versions) do
confine has_infiniband: true
ports = Facter::Util::Infiniband.ports
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be inside setcode

setcode do
versions = {}
ports.each do |port|
fw_version = Facter::Util::Infiniband.get_port_fw_version(port)
if fw_version
versions[port] = fw_version
end
end

if versions.empty?
nil
else
versions
end
end
end