Bug #5625
closedundefined method `default_environment' for nil:NilClass when creating a system(content host) where environment other than Library is created and a content view is created
Description
undefined method `default_environment' for nil:NilClass
Steps:
1. new system no CV or Environments
2. create a dev life cycle environment
3. create a content view and publish for just Library
4. activation key created with Library and Default View
5. send a Post to create a System:
Processing by Katello::Api::V2::SystemsController#create as application/json;version=2
Parameters: {"name"=>"foobar", "facts"=>"[FILTERED]", "organization_id"=>"ACME_Corporation", "type"=>"system", "api_version"=>"v2", "system"=>{"name"=>"foobar", "type"=>"system", "facts"=>"[FILTERED]"}}
Result: script/rails:6:in `<main>'
Completed 500 Internal Server Error in 37.7ms (Views: 0.8ms | ActiveRecord: 2.8ms)
With body: {"displayMessage":"undefined method `default_environment' for nil:NilClass","errors":["undefined method `default_environment' for nil:NilClass"]}