Project

General

Profile

Bug #26895

Changing download policy fails with error Validation failed: Upstream username and password may only be set on custom repositories

Added by Justin Sherrill 5 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Normal
Category:
Repositories
Target version:
Difficulty:
Triaged:
Yes
Bugzilla link:
Fixed in Releases:
Found in Releases:

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1674463

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.


Related issues

Related to Katello - Bug #27279: Saving Custom repos can cause "Upstream password requires upstream username be set"Closed

Associated revisions

Revision 0fb56644 (diff)
Added by Justin Sherrill 5 months ago

Fixes #26895 - avoid auto complete on repo update

the repo upstream username and password can
trigger autocomplete if a user or password is saved.
In firefox we can easily avoid this, but in chrome we cannot,
so instead of hiding these fields, we can just not render them

History

#1 Updated by The Foreman Bot 5 months ago

  • Assignee set to Justin Sherrill
  • Status changed from New to Ready For Testing
  • Pull request https://github.com/Katello/katello/pull/8132 added

#2 Updated by Justin Sherrill 5 months ago

  • Status changed from Ready For Testing to Closed

#3 Updated by Andrew Kofink 5 months ago

  • Triaged changed from No to Yes
  • Target version set to Katello 3.13.0

#4 Updated by Justin Sherrill 3 months ago

  • Related to Bug #27279: Saving Custom repos can cause "Upstream password requires upstream username be set" added

Also available in: Atom PDF