refacter: renamed facts to libs

This commit is contained in:
2024-02-17 23:03:54 +11:00
parent e10bed689c
commit 1030ba460e
16 changed files with 0 additions and 0 deletions
@@ -0,0 +1,20 @@
# frozen_string_literal: true
# check that the minio user exists
require 'yaml'
Facter.add('minio_user_exists') do
setcode do
yaml_file_path = '/opt/puppetlabs/facter/facts.d/minio_facts.yaml'
# check if the YAML file exists first
next false unless File.exist?(yaml_file_path)
minio_facts = YAML.load_file(yaml_file_path)
user_name = minio_facts['minio_user']
user_exists = system("id #{user_name} >/dev/null 2>&1")
user_exists
end
end