Bug 1674463

Summary: Changing download policy fails with error Validation failed: Upstream username and password may only be set on custom repositories
Product: Red Hat Satellite Reporter: Nagoor Shaik <nshaik>
Component: RepositoriesAssignee: Justin Sherrill <jsherril>
Status: CLOSED ERRATA QA Contact: vijsingh
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.5.0CC: egolov, jsherril, ktordeur, nshaik, rankumar, roarora, sokeeffe, spetrosi, swadeley
Target Milestone: 6.6.0Keywords: Regression, Triaged
Target Release: Unused   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: tfm-rubygem-katello-3.12.0.9-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1726811 (view as bug list) Environment:
Last Closed: 2019-10-22 19:50:09 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:

Description Nagoor Shaik 2019-02-11 12:11:04 UTC
Description of problem:
Changing download policy on Red Hat Repositories fails with error "Validation failed: Upstream username and password may only be set on custom repositories"

Version-Release number of selected component (if applicable):
foreman-installer-1.20.0-2.el7sat.noarch
foreman-1.20.1.10-1.el7sat.noarch
katello-3.10.0-0.6.rc1.el7sat.noarch
pulp-server-2.18.0-0.1.rc.el7sat.noarch

How reproducible:
100% 

Steps to Reproduce:
1. Install fresh Satellite 6.5
2. Enable RHEL 7Server RPMs
3. Try to change the download policy from On Demand to Immediate from UI which fails with following traceback

2019-02-11T17:29:18 [I|app|b15d127f] Processing by Katello::Api::V2::RepositoriesController#update as JSON
2019-02-11T17:29:18 [I|app|b15d127f]   Parameters: {"ostree_branches"=>[], "relative_path"=>"RedHat/Library/content/dist/rhel/server/7/7Server/x86_64/os", "promoted"=>false, "content_view_version_id"=>1, "library_instance_id"=>nil, "organization"=>{"name"=>"RedHat", "label"=>"RedHat", "id"=>1}, "created_at"=>"2019-02-11 17:23:29 +0530", "updated_at"=>"2019-02-11 17:28:56 +0530", "backend_identifier"=>"80ca12fb-54a5-4b6e-8376-af5824f60fe7", "container_repository_name"=>nil, "full_path"=>"https://dhcp130-178.gsslab.pnq2.redhat.com/pulp/repos/RedHat/Library/content/dist/rhel/server/7/7Server/x86_64/os/", "id"=>"1", "name"=>"Red Hat Enterprise Linux 7 Server RPMs x86_64 7Server", "label"=>"Red_Hat_Enterprise_Linux_7_Server_RPMs_x86_64_7Server", "description"=>nil, "last_sync"=>nil, "content_view"=>{"id"=>1, "name"=>"Default Organization View"}, "content_type"=>"yum", "url"=>"https://cdn.redhat.com/content/dist/rhel/server/7/7Server/x86_64/os", "arch"=>"x86_64", "content_id"=>"2456", "major"=>7, "minor"=>"7Server", "product"=>{"id"=>118, "cp_id"=>"69", "name"=>"Red Hat Enterprise Linux Server", "orphaned"=>false, "redhat"=>true, "sync_plan"=>["name", "description", "sync_date", "interval", "next_sync"]}, "content_label"=>"rhel-7-server-rpms", "content_counts"=>{"ostree_branch"=>0, "docker_manifest"=>0, "docker_manifest_list"=>0, "docker_tag"=>0, "rpm"=>0, "srpm"=>0, "package"=>0, "package_group"=>0, "erratum"=>0, "puppet_module"=>0, "file"=>0, "deb"=>0, "module_stream"=>0}, "last_sync_words"=>nil, "environment"=>{"id"=>1, "registry_unauthenticated_pull"=>false}, "docker_upstream_name"=>nil, "docker_tags_whitelist"=>[], "mirror_on_sync"=>true, "verify_ssl_on_sync"=>true, "unprotected"=>false, "checksum_type"=>nil, "download_policy"=>"immediate", "gpg_key_id"=>nil, "ssl_ca_cert_id"=>nil, "ssl_client_cert_id"=>nil, "ssl_client_key_id"=>nil, "upstream_username"=>"", "ostree_upstream_sync_policy"=>nil, "ostree_upstream_sync_depth"=>nil, "computed_ostree_upstream_sync_depth"=>0, "deb_releases"=>nil, "deb_components"=>nil, "deb_architectures"=>nil, "ignore_global_proxy"=>false, "ignorable_content"=>nil, "gpg_key"=>nil, "ssl_ca_cert"=>{"id"=>nil, "name"=>nil}, "ssl_client_cert"=>{"id"=>nil, "name"=>nil}, "ssl_client_key"=>{"id"=>nil, "name"=>nil}, "permissions"=>{"deletable"=>true}, "upstream_password_exists"=>"[FILTERED]", "upstream_auth_exists"=>false, "commaTagsWhitelist"=>"", "upstream_password"=>"[FILTERED]", "organization_id"=>"1", "api_version"=>"v2", "repository"=>{"id"=>"1", "name"=>"Red Hat Enterprise Linux 7 Server RPMs x86_64 7Server", "created_at"=>"2019-02-11 17:23:29 +0530", "updated_at"=>"2019-02-11 17:28:56 +0530", "major"=>7, "minor"=>"7Server", "gpg_key_id"=>nil, "content_id"=>"2456", "arch"=>"x86_64", "label"=>"Red_Hat_Enterprise_Linux_7_Server_RPMs_x86_64_7Server", "url"=>"https://cdn.redhat.com/content/dist/rhel/server/7/7Server/x86_64/os", "unprotected"=>false, "content_type"=>"yum", "checksum_type"=>nil, "docker_upstream_name"=>nil, "mirror_on_sync"=>true, "download_policy"=>"immediate", "verify_ssl_on_sync"=>true, "upstream_username"=>"", "upstream_password"=>"[FILTERED]", "ostree_upstream_sync_policy"=>nil, "ostree_upstream_sync_depth"=>nil, "deb_releases"=>nil, "deb_components"=>nil, "deb_architectures"=>nil, "ignore_global_proxy"=>false, "ssl_ca_cert_id"=>nil, "ssl_client_cert_id"=>nil, "ssl_client_key_id"=>nil, "ignorable_content"=>nil, "docker_tags_whitelist"=>[], "description"=>nil}}
2019-02-11T17:29:18 [I|app|b15d127f] Current user set to admin (admin)
2019-02-11T17:29:18 [E|bac|b15d127f] Validation failed: Upstream username and password may only be set on custom repositories. (ActiveRecord::RecordInvalid)
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/validations.rb:80:in `raise_validation_error'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/validations.rb:52:in `save!'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/transactions.rb:315:in `block in save!'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/transactions.rb:387:in `block in with_transaction_returning_status'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:252:in `transaction'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/transactions.rb:212:in `transaction'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/transactions.rb:385:in `with_transaction_returning_status'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/transactions.rb:315:in `save!'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/suppressor.rb:48:in `save!'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/persistence.rb:441:in `block in update!'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/transactions.rb:387:in `block in with_transaction_returning_status'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:252:in `transaction'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/transactions.rb:212:in `transaction'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/transactions.rb:385:in `with_transaction_returning_status'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/persistence.rb:439:in `update!'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.10.0.19/app/lib/actions/katello/repository/update.rb:10:in `plan'
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.1.6/lib/dynflow/action.rb:493:in `block (3 levels) in execute_plan'
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.1.6/lib/dynflow/middleware/stack.rb:26:in `pass'
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.1.6/lib/dynflow/middleware.rb:18:in `pass'
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.1.6/lib/dynflow/middleware.rb:35:in `plan'
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.1.6/lib/dynflow/middleware/stack.rb:22:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.1.6/lib/dynflow/middleware/stack.rb:26:in `pass'
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.1.6/lib/dynflow/middleware.rb:18:in `pass'
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.1.6/lib/dynflow/middleware.rb:35:in `plan'
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.1.6/lib/dynflow/middleware/stack.rb:22:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.1.6/lib/dynflow/middleware/stack.rb:26:in `pass'
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.1.6/lib/dynflow/middleware.rb:18:in `pass'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.14.4.3/app/lib/actions/middleware/keep_current_timezone.rb:10:in `block in plan'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.14.4.3/app/lib/actions/middleware/keep_current_timezone.rb:31:in `with_current_timezone'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.14.4.3/app/lib/actions/middleware/keep_current_timezone.rb:9:in `plan'
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.1.6/lib/dynflow/middleware/stack.rb:22:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.1.6/lib/dynflow/middleware/stack.rb:26:in `pass'
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.1.6/lib/dynflow/middleware.rb:18:in `pass'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.14.4.3/app/lib/actions/middleware/keep_current_user.rb:10:in `block in plan'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.14.4.3/app/lib/actions/middleware/keep_current_user.rb:31:in `with_current_user'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.14.4.3/app/lib/actions/middleware/keep_current_user.rb:9:in `plan'
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.1.6/lib/dynflow/middleware/stack.rb:22:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.1.6/lib/dynflow/middleware/stack.rb:26:in `pass'
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.1.6/lib/dynflow/middleware.rb:18:in `pass'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.14.4.3/app/lib/actions/middleware/keep_current_taxonomies.rb:10:in `block in plan'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.14.4.3/app/lib/actions/middleware/keep_current_taxonomies.rb:30:in `with_current_taxonomies'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.14.4.3/app/lib/actions/middleware/keep_current_taxonomies.rb:9:in `plan'
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.1.6/lib/dynflow/middleware/stack.rb:22:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.1.6/lib/dynflow/middleware/stack.rb:26:in `pass'
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.1.6/lib/dynflow/middleware.rb:18:in `pass'
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.1.6/lib/dynflow/middleware.rb:35:in `plan'
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.1.6/lib/dynflow/middleware/stack.rb:22:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.1.6/lib/dynflow/middleware/world.rb:30:in `execute'
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.1.6/lib/dynflow/action.rb:492:in `block (2 levels) in execute_plan'
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.1.6/lib/dynflow/execution_plan.rb:384:in `switch_flow'


Actual results:
Fails to change Download Policy from On Demand to Other such as Immediate or Background

Expected results:
Should be able to change. 

Additional info:

When you change the policy through Hammer CLI it works as expected. This should also work from UI.

Comment 9 Brad Buckingham 2019-05-01 17:51:05 UTC
*** Bug 1702465 has been marked as a duplicate of this bug. ***

Comment 10 Brad Buckingham 2019-05-01 18:02:05 UTC
Hi Nagoor,

I am no longer able to reproduce this error on the latest Satellite 6.5 builds (e.g. tfm-rubygem-katello-3.10.0.46-1.el7sat.noarch).  Would you be able to confirm the same?

Thanks!

Comment 11 Nagoor Shaik 2019-05-14 02:14:02 UTC
Hello Brad,

It is still failing with the same error. In fact, I'm having the same exact version of Katello 

# rpm -qa | grep  tfm-rubygem-katello
tfm-rubygem-katello-3.10.0.46-1.el7sat.noarch

Steps to reproduce would be as follows

1. In a browser save the Username and Password
2. Navigate to Products >> any repository >> try changing the Download policy >> Hit submit fails with the error "An error occurred saving the Repository: Upstream username and password may only be set on custom repositories."

Comment 12 Justin Sherrill 2019-05-28 00:00:11 UTC
Created redmine issue https://projects.theforeman.org/issues/26895 from this bug

Comment 13 Bryan Kearney 2019-05-28 02:06:19 UTC
Upstream bug assigned to jsherril

Comment 14 Bryan Kearney 2019-05-28 02:06:21 UTC
Upstream bug assigned to jsherril

Comment 15 Bryan Kearney 2019-05-29 14:06:18 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/26895 has been resolved.

Comment 16 Stephen Wadeley 2019-06-05 18:05:16 UTC
Hello

seems same issue, is this a duplicate of

Bug 1630535 - admin password is added to yum repo config

Comment 21 Brad Buckingham 2019-07-23 20:00:06 UTC
The fix in upstream issue 27279 has been merged; therefore, moving this one back to POST.

Comment 23 vijsingh 2019-08-19 06:09:50 UTC
ON_QA Verified


@Satellite 6.6.0 snap 16.0


Steps/Observation:


 1)
 - Save credential in Browser
 - Enable RHEL 7Server RPMs or create a Custom repo
 - Able to change the download policy from On Demand to Immediate/Background 

 2) 
 - Save credential in Browser
 - Created a Custom repo with checksum type(sha256) and download policy(Immediate) and saved it.
 - Able to change the download policy from 'Immediate' to 'Background'

Comment 25 Bryan Kearney 2019-10-22 19:50:09 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/RHSA-2019:3172