Adding a new repo fails

Problem:
Hi all. I’m new to Foreman and inherited a system, so please bear with me.

The system has been setup serving the CentOS 7.5 repos (and a couple of others) and has been updated once (before my time) serving the CentOS 7.6 repos. For this somebody added a new repo called simply CentOS 7.6. About a half year ago these has been rolled out through our dev, test and production environments. For this a composite view is being used enclosing all needed repos.

About 2 months ago I’ve added a Kubernetes repo myself and this is active and working on all environments now as well. But now I wanted to add a CentOS 7.7 repo and this is a problem. I’ve created a Product and Contentview named CentOS 7.7 exactly as CentOS 7.6 was created, except for the upstream repo URL of course. I’ve removed CentOS 7.6 from our main composite view and added CentOS 7.7. At the test environment registry key I did the same. And I’ve published new versions for the CentOS 7.7 content view and our main composite view.

On 3 test local test machine I’ve unregistered and re-registered using the test environment registry key. At Content - Activation Keys - test_env - Subscriptions these 3 do show up as ‘Attached’. But elas, doing a yum update will show all repos from the composite view except the new CentOS 7.7. Looking at the /etc/yum.repos.d/redhat.repo it is not added.

I think I’ve looked into all logs at this time, tailing them while adding and removing the repo but can’t find errors. In the foreman web UI all seems green and OK (Backend system status). I can’t find any katello logs though? (and don’t know if this is pertinent?). I’m pretty much lost :frowning:

Expected outcome:
The new CentOS 7.7 repos added to my local /etc/yum.repos.d/redhat.repo and usable for my clients.

Foreman and Proxy versions:
Smart proxies
[foreman.mydomain.com]
Templates, Pulp, TFTP, Puppet, Puppet CA, Logs, Dynflow, Ansible, and SSH
Status OK
Version 1.18.1

Foreman and Proxy plugin versions:
bastion 6.1.10
foreman-tasks 0.13.4
foreman_ansible 2.2.5
foreman_docker 4.1.0
foreman_remote_execution 1.5.5
katello 3.7.0

Distribution and version:
NAME=“CentOS Linux”
VERSION=“7 (Core)”
ID=“centos”
ID_LIKE=“rhel fedora”
VERSION_ID=“7”
PRETTY_NAME=“CentOS Linux 7 (Core)”

Other relevant data:
Sorry for the long story, since I don’t know Foreman, I’m not sure what to add and what not.

Any help greatly appreciated.

Any help still greatly appreciated. Does this maybe give any pointers?

[root@ims-mgt-repo-01 foreman]# foreman-rake katello:reindex
/usr/share/foreman/lib/foreman.rb:8: warning: already initialized constant Foreman::UUID_REGEXP
/usr/share/foreman/lib/foreman.rb:8: warning: previous definition of UUID_REGEXP was here
/usr/share/foreman/lib/core_extensions.rb:182: warning: already initialized constant ActiveSupport::MessageEncryptor::DEFAULT_CIPHER
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.6/lib/active_support/message_encryptor.rb:22: warning: previous definition of DEFAULT_CIPHER was here
rake aborted!
Don't know how to build task 'katello:reindex' (see --tasks)
/opt/rh/rh-ruby24/root/usr/share/gems/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
(See full trace by running task with --trace)

With a --trace as suggested by the error:

[root@ims-mgt-repo-01 ~]# foreman-rake katello:reindex --trace
/usr/share/foreman/lib/foreman.rb:8: warning: already initialized constant Foreman::UUID_REGEXP
/usr/share/foreman/lib/foreman.rb:8: warning: previous definition of UUID_REGEXP was here
/usr/share/foreman/lib/core_extensions.rb:182: warning: already initialized constant ActiveSupport::MessageEncryptor::DEFAULT_CIPHER
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.6/lib/active_support/message_encryptor.rb:22: warning: previous definition of DEFAULT_CIPHER was here
rake aborted!
Don't know how to build task 'katello:reindex' (see --tasks)
/opt/rh/rh-ruby24/root/usr/share/gems/gems/rake-12.0.0/lib/rake/task_manager.rb:58:in `[]'
/opt/rh/rh-ruby24/root/usr/share/gems/gems/rake-12.0.0/lib/rake/application.rb:151:in `invoke_task'
/opt/rh/rh-ruby24/root/usr/share/gems/gems/rake-12.0.0/lib/rake/application.rb:108:in `block (2 levels) in top_level'
/opt/rh/rh-ruby24/root/usr/share/gems/gems/rake-12.0.0/lib/rake/application.rb:108:in `each'
/opt/rh/rh-ruby24/root/usr/share/gems/gems/rake-12.0.0/lib/rake/application.rb:108:in `block in top_level'
/opt/rh/rh-ruby24/root/usr/share/gems/gems/rake-12.0.0/lib/rake/application.rb:117:in `run_with_threads'
/opt/rh/rh-ruby24/root/usr/share/gems/gems/rake-12.0.0/lib/rake/application.rb:102:in `top_level'
/opt/rh/rh-ruby24/root/usr/share/gems/gems/rake-12.0.0/lib/rake/application.rb:80:in `block in run'
/opt/rh/rh-ruby24/root/usr/share/gems/gems/rake-12.0.0/lib/rake/application.rb:178:in `standard_exception_handling'
/opt/rh/rh-ruby24/root/usr/share/gems/gems/rake-12.0.0/lib/rake/application.rb:77:in `run'
/opt/rh/rh-ruby24/root/usr/share/gems/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
/opt/rh/rh-ruby24/root/usr/bin/rake:23:in `load'
/opt/rh/rh-ruby24/root/usr/bin/rake:23:in `<main>'

Sorry, I don’t want to spam the forums, but I’ve searched the forums and learned that I probably need to user reimport instead of reindex. This does work (with some of the same errors though), but does not solved the problem :frowning:

[root@ims-mgt-repo-01 pki]# foreman-rake katello:reimport
/usr/share/foreman/lib/foreman.rb:8: warning: already initialized constant Foreman::UUID_REGEXP
/usr/share/foreman/lib/foreman.rb:8: warning: previous definition of UUID_REGEXP was here
/usr/share/foreman/lib/core_extensions.rb:182: warning: already initialized constant ActiveSupport::MessageEncryptor::DEFAULT_CIPHER
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.6/lib/active_support/message_encryptor.rb:22: warning: previous definition of DEFAULT_CIPHER was here
Importing Katello::Erratum
Importing Katello::PackageGroup
Importing Katello::PuppetModule
Importing Katello::Rpm
Importing Katello::Srpm
Importing Katello::Deb
Importing Katello::FileUnit
Importing Katello::Subscription
Importing Katello::Pool
Importing Katello::DockerManifest
Importing Katello::DockerManifestList
Importing Katello::DockerTag
Importing Katello::ContentViewPuppetEnvironment
Importing Katello::Content
Importing Activation Key Subscriptions
Importing Linked Repositories
[root@ims-mgt-repo-01 pki]#

Stupidly I just had the same problem as in another active thread.

Bug:
https://bugzilla.redhat.com/show_bug.cgi?id=1789654#c4

Perform this on database host:

# sudo -u postgres -H -- psql -d candlepin -c "update cp_pool set enddate = '2049-12-01 00:00:00' where enddate > '2049-12-31 00:00:00';"

This on the katallo/foreman server:

# foreman-rake katello:reimport

And this on the client:

# subscription-manager unregister
# subscription-manager register --activationkey=""MyKey" --org="MyOrg"
# yum update
1 Like

See CentOS host cannot subscribe to repositories for just a bit of additional detail about what’s going on (okay, maybe just a little translation.)

Solution worked for me. Thank you!