Satellite 6 Duplicate Repositories Prevent Manifest Refresh With Error: "undefined method `[]' for nil:NilClass"
Environment
Red Hat Satellite 6
Issue
When trying to refresh the manifest, the task stops with a result of warning, and throws the following error:
NoMethodError
undefined method `[]' for nil:NilClass
Resolution
- Extract the relative path from the logs
# cat /var/log/messages | grep "conflicts with existing relative URL"
MyOrg/Library/content/dist/rhel/server/7/7Server/x86_64/rhgs-server/3.1/os
- Query the database to confirm the repositories are using the same relative path and extract information:
# su - postgres -c "psql -d foreman -c 'select id,name,pulp_id,created_at,updated_at,content_id,label,relative_path from katello_repositories where relative_path = '\''MyOrg/Library/content/dist/rhel/server/7/7Server/x86_64/rhgs-server/3.1/os'\'';'"
-
Take a snapshot with Satellite services stopped (if you can't do a snapshot, please proceed with a katello-backup):
# foreman-maintain service stop
=> Take the VM snapshot -
Restart the Satellite services:
# foreman-maintain service start -
Ensure that the repository XXXX is not part of any Content View:
# foreman rake console
> User.current = User.first
> Katello::Repository.find(XXXX).clones
- Delete the faulty repository (still from the foreman-rake console)
> User.current = User.anonymous_admin
> ForemanTasks.sync_task(::Actions::Katello::Repository::Destroy, ::Katello::Repository.find(XXXX), :planned_destroy => true)
[Wait few minutes, you should get a similar output]
> #<ForemanTasks::Task::DynflowTask id: "8bc10c43-f0ba-46fe-bd32-04ddd50b6862", type: "ForemanTasks::Task::DynflowTask", label: "Actions::Katello::Repository::Destroy", started_at: "2017-08-16 23:53:09", ended_at: "2017-08-16 23:53:58", state: "stopped", result: "success", external_id: "1df0cc6f-5464-4839-8b2a-b8c1e5f16248", parent_task_id: nil, start_at: "2017-08-16 23:53:08", start_before: nil>
> exit
- Run the following to fix the proper repository
# foreman-rake katello:correct_repositories COMMIT=true
- Try to Refresh the Manifest.
For more KB articles/solutions related to Red Hat Satellite 6.x Manifest Issues, please refer to the Consolidated Troubleshooting Article for Red Hat Satellite 6.x Manifest Issues
Diagnostic Steps
When the manifest refresh fails, the following errors can be found in /var/log/messages:
Nov 12 14:08:02 satserver pulp: pulp.server.controllers.repository:ERROR: (20060-63264) PulpDataException: Relative URL [MyOrg/Library/content/dist/rhel/server/7/7Server/x86_64/rhgs-server/3.1/os] for repository [MyOrg-Red_Hat_Gluster_Storage_Server_for_On-premise-Red_Hat_Gluster_Storage_3_Server_RPMs_x86_64_7Server] conflicts with existing relative URL [MyOrg/Library/content/dist/rhel/server/7/7Server/x86_64/rhgs-server/3.1/os] for repository [MyOrg-Red_Hat_Gluster_Storage_Server_for_On-premise-Red_Hat_Gluster_Storage_3_1_Server_RPMs_x86_64_7Server]
Nov 12 14:08:02 satserver pulp: pulp.server.controllers.repository:ERROR: (20060-63264) Relative URL [MyOrg/Library/content/dist/rhel/server/7/7Server/x86_64/rhgs-server/3.1/os] for repository [MyOrg-Red_Hat_Gluster_Storage_Server_for_On-premise-Red_Hat_Gluster_Storage_3_Server_RPMs_x86_64_7Server] conflicts with existing relative URL [MyOrg/Library/content/dist/rhel/server/7/7Server/x86_64/rhgs-server/3.1/os] for repository [MyOrg-Red_Hat_Gluster_Storage_Server_for_On-premise-Red_Hat_Gluster_Storage_3_1_Server_RPMs_x86_64_7Server]
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.