1. Proposed title of this feature request Introduce a valid foreman-rake based solution to counter and fix the error "Katello::Errors::CandlepinError: Environment with id 5a6ac4b9ba58f37e93b155ec4eaa3e07 could not be found" 2. What is the nature and description of the request? Change in code\Inclusion of new code for the product is required to achieve the desired goal. 3. Why does the customer need this? (List the business requirements here) To avoid manual workaround and achieve a clean CV or CV version deletion without having any DB inconsistencies present. 4. How would the customer like to achieve this? (List the functional requirements here) The error "Katello::Errors::CandlepinError: Environment with id 5a6ac4b9ba58f37e93b155ec4eaa3e07 could not be found", usually can be seen when the Customer is trying to delete a CV and CV version and suddenly the task went to Paused state. And at the backend, 5a6ac4b9ba58f37e93b155ec4eaa3e07 environment-id will hopefully be missing from cp_environment and\or cp2_environment_content table of candlepin DB due to which this error message pops up. In 99% of the cases, we provide this solution or go on the remote session to do following : * Open the task * Open Dynflow COnsole * Skip the step with error related to "Environment with id 5a6ac4b9ba58f37e93b155ec4eaa3e07 could not be found" * Resume the task Customers will not always be able to understand the instructions and we will end up connecting on a remote session to perform the same thing again. In my opinion, we should not be doing this kind of manual hack as this leaves inconsistent information in Candlepin DB. So expectation here is to have a rake-based solution present, that can recreate the missing environment and then we can resume the task gracefully without needing to skip any steps from dynflow. 5. For each functional requirement listed, specify how Red Hat and the customer can test to confirm the requirement is successfully implemented. - Create some inconsistency in Candlepin DB - Try to delete a CV or CV version to reproduce the error "Katello::Errors::CandlepinError: Environment with id 5a6ac4b9ba58f37e93b155ec4eaa3e07 could not be found" - At this stage the task will be in paused state. - Execute the foreman-rake command (or the solution prepared by Redhat) to fix the missing environment with id XXX in Candlepin DB - Resume the paused task and wait for it to get completed successfully. 6. Is there already an existing RFE upstream or in Red Hat Bugzilla? No. 7. Does the customer have any specific timeline dependencies and which release would they like to target (i.e. RHEL5, RHEL6)? As soon as possible 8. Is the sales team involved in this request and do they have any additional input? No. 9. List any affected packages or components. - Katello \ Candlepin \ Postgres \ Rake 10. Would the customer be able to assist in testing this functionality if implemented? NA but Support folks can 11. Additional information: Some additional information will be provided in the private comments
Created redmine issue https://projects.theforeman.org/issues/33019 from this bug
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/33019 has been resolved.
Steps to retest: 1. Create a new LCE 2. Create a custom product with custom repo and sync 3. Create a cv and add the repo from step 2 4. Tail candlepin.log 5. Publish cv from 3 and do a promote 6. Confirm that new environment was created in log 7. Delete environment from rails console: Katello::Resources::Candlepin::Environment.destroy('<environment id from candlepin.log>') 8. Publish cv again and promote and see the environment is recreated in candlepin.log 9. Delete the environment again from Rails console (the new lce created from step 1) 10. Delete the LCE that you created in step 1 from UI as well. 11. Ensure that no error appear in candlepin.log Expected result: 6) Should be able to see new environment being created in log 8) Should be able to see environment is created in log 11) Should not see any errors being raised in log Actual: 6) Able to see new environment being created in log 8) Able to see environment being recreated in log org.candlepin.common.filter.LoggingFilter - Request: verb=GET, uri=/candlepin/environments/d5aa01ea4a4f2d907d5d7735233fee5a 11) There was no errors appearing in log after deleting environments on both rake console and the webUI Verified on 6.10 snap 13 with tfm-rubygem-katello-4.1.1.8-1.el7sat.noarch
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 (Moderate: Satellite 6.10 Release), 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-2021:4702