chore: confine incus facts to incus (#326)
Reviewed-on: https://git.query.consul/unkinben/puppet-prod/pulls/326
This commit is contained in:
parent
1837506b6c
commit
715e88176b
@ -13,6 +13,7 @@ end
|
||||
|
||||
Facter.add(:incus_container_count) do
|
||||
confine kernel: 'Linux'
|
||||
confine enc_role: 'roles::infra::incus::node'
|
||||
setcode do
|
||||
Facter::Util::Resolution.incus_data.size
|
||||
end
|
||||
@ -20,6 +21,7 @@ end
|
||||
|
||||
Facter.add(:incus_container_count_running) do
|
||||
confine kernel: 'Linux'
|
||||
confine enc_role: 'roles::infra::incus::node'
|
||||
setcode do
|
||||
Facter::Util::Resolution.incus_data.count { |c| c['status'] == 'Running' }
|
||||
end
|
||||
@ -27,6 +29,7 @@ end
|
||||
|
||||
Facter.add(:incus_allocated_mb) do
|
||||
confine kernel: 'Linux'
|
||||
confine enc_role: 'roles::infra::incus::node'
|
||||
setcode do
|
||||
Facter::Util::Resolution.incus_data.sum do |c|
|
||||
mem_str = c.dig('expanded_config', 'limits.memory')
|
||||
@ -43,6 +46,7 @@ end
|
||||
|
||||
Facter.add(:incus_allocated_cpu) do
|
||||
confine kernel: 'Linux'
|
||||
confine enc_role: 'roles::infra::incus::node'
|
||||
setcode do
|
||||
Facter::Util::Resolution.incus_data.sum do |c|
|
||||
cpu_str = c.dig('expanded_config', 'limits.cpu')
|
||||
@ -53,6 +57,7 @@ end
|
||||
|
||||
Facter.add(:incus_profile_names) do
|
||||
confine kernel: 'Linux'
|
||||
confine enc_role: 'roles::infra::incus::node'
|
||||
setcode do
|
||||
Facter::Util::Resolution.incus_data.flat_map { |c| c['profiles'] }.uniq.sort
|
||||
end
|
||||
@ -60,6 +65,7 @@ end
|
||||
|
||||
Facter.add(:incus_profile_usage_count) do
|
||||
confine kernel: 'Linux'
|
||||
confine enc_role: 'roles::infra::incus::node'
|
||||
setcode do
|
||||
usage = Hash.new(0)
|
||||
Facter::Util::Resolution.incus_data.each do |c|
|
||||
|
||||
Loading…
Reference in New Issue
Block a user