This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_backup_metrics_per_node(node) | |
rest = ::Chef::REST.new(::Chef::Config[:chef_server_url]) | |
begin | |
configured_backups = rest.get_rest("/nodes/#{node}").wf_backups.configured_backups | |
rescue EOFError => e | |
configured_backups = {} | |
end | |
res = {} | |
configured_backups.each_key do |type| | |
configured_backups[type].each_key do |subtype| | |
next unless configured_backups[type][subtype]['metrics'] | |
res[type] = {} unless res[type] | |
res[type][subtype] = {} unless res[type][subtype] | |
res[type][subtype]['metrics'] = configured_backups[type][subtype]['metrics'] | |
end | |
end | |
res | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment