OSC / ood_core

Open OnDemand core library

Home Page:https://osc.github.io/ood_core/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

don't raise error on cluster config not found

johrstrom opened this issue · comments

I'm not really sure why we raise an error here - but we really shouldn't. Instead it should just be graceful degradation instead of a fatal error. Maybe we warn to stderr that it's empty, but raising an error here seems a bit strong. So you didn't find a configuration? Let the upper layer deal with the fact that there are no clusters.

raise ConfigurationNotFound, "configuration file '#{config}' does not exist"

This is the error I get running rake tasks.

== Preparing database ==
rails aborted!
OodCore::ConfigurationNotFound: configuration file '/etc/ood/config/clusters.d' does not exist
/users/PZS0714/johrstrom/ondemand/dev/osc-reporting/vendor/bundle/ruby/2.7.0/gems/ood_core-0.19.0/lib/ood_core/clusters.rb:52:in `load_file'
/users/PZS0714/johrstrom/ondemand/dev/osc-reporting/app/models/active_jobs.rb:25:in `block in clusters'
/users/PZS0714/johrstrom/ondemand/dev/osc-reporting/vendor/bundle/ruby/2.7.0/gems/activesupport-7.0.3/lib/active_support/cache.rb:804:in `block in save_block_result_to_cache'
/users/PZS0714/johrstrom/ondemand/dev/osc-reporting/vendor/bundle/ruby/2.7.0/gems/activesupport-7.0.3/lib/active_support/cache.rb:778:in `block in instrument'
/users/PZS0714/johrstrom/ondemand/dev/osc-reporting/vendor/bundle/ruby/2.7.0/gems/activesupport-7.0.3/lib/active_support/notifications.rb:208:in `instrument'
/users/PZS0714/johrstrom/ondemand/dev/osc-reporting/vendor/bundle/ruby/2.7.0/gems/activesupport-7.0.3/lib/active_support/cache.rb:778:in `instrument'
/users/PZS0714/johrstrom/ondemand/dev/osc-reporting/vendor/bundle/ruby/2.7.0/gems/activesupport-7.0.3/lib/active_support/cache.rb:803:in `save_block_result_to_cache'
/users/PZS0714/johrstrom/ondemand/dev/osc-reporting/vendor/bundle/ruby/2.7.0/gems/activesupport-7.0.3/lib/active_support/cache.rb:369:in `fetch'
/users/PZS0714/johrstrom/ondemand/dev/osc-reporting/app/models/active_jobs.rb:23:in `clusters'

┆Issue is synchronized with this Asana task by Unito