Bug 1318549

Summary: Validation error: Content type must be one of the following: docker, file, puppet, yum on creating ostree repo
Product: Red Hat Satellite Reporter: Sachin Ghai <sghai>
Component: InstallationAssignee: Partha Aji <paji>
Status: CLOSED ERRATA QA Contact: Sachin Ghai <sghai>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.2.0CC: bbuckingham, ehelms
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/14324
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-27 09:07:15 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1321771    
Attachments:
Description Flags
Validation error: Content type must be one of the following: docker, file, puppet, yum on creating ostree repo
none
ostree repo created but webUI raises valdation error
none
ostree repo created successfully from webUI none

Description Sachin Ghai 2016-03-17 08:34:46 UTC
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:

Comment 1 Sachin Ghai 2016-03-17 08:36:49 UTC
Created attachment 1137329 [details]
ostree repo created but webUI raises valdation error

Comment 3 Sachin Ghai 2016-03-17 09:00:11 UTC
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.

Comment 4 Partha Aji 2016-03-18 02:48:44 UTC
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.

Comment 5 Sachin Ghai 2016-03-18 05:04:34 UTC
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.

Comment 6 Partha Aji 2016-03-22 22:39:14 UTC
Created redmine issue http://projects.theforeman.org/issues/14324 from this bug

Comment 7 Partha Aji 2016-03-22 22:46:41 UTC
Being tracked by https://github.com/Katello/puppet-katello/pull/11

Comment 8 Partha Aji 2016-03-22 22:47:37 UTC
Basic fix here is that doing a "foreman-installer  --katello-enable-ostree" should restart foreman-tasks and httpd.

Comment 9 Adam Ruzicka 2016-03-23 10:31:12 UTC
Upstream bug component is Installer

Comment 10 Bryan Kearney 2016-03-23 16:02:34 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/14324 has been closed

Comment 11 Partha Aji 2016-03-23 16:30:57 UTC
Correction:

Being tracked by https://github.com/Katello/puppet-katello/pull/118 not 11

Comment 15 Sachin Ghai 2016-03-31 08:12:09 UTC
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

Comment 16 Sachin Ghai 2016-03-31 08:12:44 UTC
Created attachment 1142094 [details]
ostree repo created successfully from webUI

Comment 17 Sachin Ghai 2016-03-31 08:14:14 UTC
]# 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

Comment 19 errata-xmlrpc 2016-07-27 09:07:15 UTC
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