feat: add incus module

- add a basic incus module
This commit is contained in:
2025-03-30 01:03:25 +11:00
parent 6a04701891
commit 0a978e651d
4 changed files with 130 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
# frozen_string_literal: true
require 'yaml'
Facter.add(:incus) do
setcode do
# Check if the 'incus' executable exists
incus_path = Facter::Util::Resolution.which('incus')
next {} unless incus_path # Return an empty fact if incus isn't found
# Run the `incus info` command using the found path
incus_output = Facter::Core::Execution.execute("#{incus_path} info")
next {} if incus_output.empty? # Return an empty fact if there's no output
# Parse the output as YAML and return it
YAML.safe_load(incus_output)
end
end