Red Hat Bugzilla – Bug 1318549
Validation error: Content type must be one of the following: docker, file, puppet, yum on creating ostree repo
Last modified: 2018-08-31 11:19 EDT
Created attachment 1137328 [details] Validation error: Content type must be one of the following: docker, file, puppet, yum on creating ostree repo Description of problem: I was trying to create ostree type repo from webUI with sat6.2 snap4 and found below error: ActiveRecord::RecordInvalid: Validation failed: Content type must be one of the following: docker, file, puppet, yum 2016-03-17 04:26:37 [app] [I] Started POST "/katello/api/v2/repositories?organization_id=1" for 10.65.193.200 at 2016-03-17 04:26:37 -0400 2016-03-17 04:26:37 [app] [I] Processing by Katello::Api::V2::RepositoriesController#create as JSON 2016-03-17 04:26:37 [app] [I] Parameters: {"product_id"=>"7", "unprotected"=>true, "checksum_type"=>nil, "download_policy"=>nil, "mirror_on_sync"=>true, "name"=>"fedoratree22", "label"=>"fedoratree22", "content_type"=>"ostree", "url"=>"https://dl.fedoraproject.org/pub/fedora/linux/atomic/22/", "organization_id"=>"1", "api_version"=>"v2", "repository"=>{"name"=>"fedoratree22", "label"=>"fedoratree22", "url"=>"https://dl.fedoraproject.org/pub/fedora/linux/atomic/22/", "unprotected"=>true, "content_type"=>"ostree", "product_id"=>"7", "checksum_type"=>nil, "mirror_on_sync"=>true, "download_policy"=>nil}} 2016-03-17 04:26:38 [foreman-tasks/action] [E] Validation failed: Content type must be one of the following: docker, file, puppet, yum (ActiveRecord::RecordInvalid) | /opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/validations.rb:57:in `save!' | /opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/attribute_methods/dirty.rb:29:in `save!' | /opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/transactions.rb:273:in `block in save!' | /opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/transactions.rb:329:in `block in with_transaction_returning_status' Please note that I've seelcted ostree type and even on submit the add_repo form, UI raises error. but repo created successfully. Version-Release number of selected component (if applicable): sat 6.2 snap4 How reproducible: always Steps to Reproduce: 1. create a ostree type repo 2. 3. Actual results: ActiveRecord::RecordInvalid: Validation failed: Content type must be one of the following: docker, file, puppet, yum Expected results: there shoudn't be any error on creating ostree repository Additional info:
Created attachment 1137329 [details] ostree repo created but webUI raises valdation error
Raising blocker? flag as it leave the setup in a state where repository::create foreman_tasks remains in pending state and if user tries to perform any other operation gets: [foreman-tasks/action] [E] Required lock is already taken by other running tasks. | Please inspect their state, fix their errors and resume them.
So I reproduced this issue once after installing satellite 6.2 snap 4, then running foreman-installer --katello-enable-ostree=true, and directly logging into sat creating an ostree repo via the UI. But did the following to fix this. 1) "katello-service restart" 2) Monitor -> Tasks -> Select the Paused-> error task and resume. I am going to figure out why the first time the classes were not fully loaded. My guess is foreman-tasks did not get fully restarted the first time and katello-service restart cleanly restarted foreman-tasks. These steps should at least get you off blocker.
Yes.. That's how I fix my setup too. I skipped the paused task and later resume it to fix that. Thanks for the update.
Created redmine issue http://projects.theforeman.org/issues/14324 from this bug
Being tracked by https://github.com/Katello/puppet-katello/pull/11
Basic fix here is that doing a "foreman-installer --katello-enable-ostree" should restart foreman-tasks and httpd.
Upstream bug component is Installer
Moving to POST since upstream bug http://projects.theforeman.org/issues/14324 has been closed
Correction: Being tracked by https://github.com/Katello/puppet-katello/pull/118 not 11
Verified with sa6.2 beta snap6. I don't see the reported issue on creating ostree repo. 2016-03-31 04:06:01 [app] [I] Started POST "/katello/api/v2/repositories?organization_id=1" for 10.65.193.200 at 2016-03-31 04:06:01 -0400 2016-03-31 04:06:01 [app] [I] Processing by Katello::Api::V2::RepositoriesController#create as JSON 2016-03-31 04:06:01 [app] [I] Parameters: {"product_id"=>"7", "unprotected"=>false, "checksum_type"=>nil, "download_policy"=>nil, "mirror_on_sync"=>true, "name"=>"rhel7_ostree", "label"=>"rhel7_ostree", "content_type"=>"ostree", "url"=>"http://download.eng.bos.redhat.com/rel-eng/Atomic-7.2-tree-20160324.1/ostree/repo/", "organization_id"=>"1", "api_version"=>"v2", "repository"=>{"name"=>"rhel7_ostree", "label"=>"rhel7_ostree", "url"=>"http://download.eng.bos.redhat.com/rel-eng/Atomic-7.2-tree-20160324.1/ostree/repo/", "unprotected"=>false, "content_type"=>"ostree", "product_id"=>"7", "checksum_type"=>nil, "mirror_on_sync"=>true, "download_policy"=>nil}} 2016-03-31 04:06:03 [app] [I] Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.12/app/views/katello/api/v2/repositories/show.json.rabl within katello/api/v2/layouts/resource (66.5ms) 2016-03-31 04:06:03 [app] [I] Completed 200 OK in 1724ms (Views: 52.4ms | ActiveRecord: 69.9ms) 20
Created attachment 1142094 [details] ostree repo created successfully from webUI
]# hammer -u admin -p changeme repository create --name f23_ostree --organization-id 1 --product ostree --url https://dl.fedoraproject.org/pub/fedora/linux/atomic/23/ --publish-via-http no --content-type ostree Repository created
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2016:1500