Bug 2274152

Summary: Cannot perform an incremental syncable export after doing a full importable Library export - RHEL9 Satellite 6.16
Product: Red Hat Satellite Reporter: Giovanni Formisano <gformisa>
Component: Inter Satellite SyncAssignee: Chris Roberts <chrobert>
Status: CLOSED MIGRATED QA Contact: Satellite QE Team <sat-qe-bz-list>
Severity: high Docs Contact:
Priority: high    
Version: 6.16.0CC: ahumbe, chrobert, dalley, jlenz, ofedoren, rlavi
Target Milestone: streamKeywords: MigratedToJIRA, Regression, Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: https://projects.theforeman.org/issues/37381
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-06-06 17:28:02 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 Giovanni Formisano 2024-04-09 12:35:51 UTC
Description of problem:
----------------------

Incremental export of Library in regular format is not possible after a syncable full


Version-Release number of selected component (if applicable):
------------------------------------------------------------

Red Hat Satellite 6.16 on RHEL-9



How reproducible:
----------------


Steps to Reproduce:
------------------

1. Ensure that you set the download policy to Immediate for the repository within the Library lifecycle environment you export. .

2. Synchronize the repository.

3. Execute this command

  ~~~
   # hammer content-export complete repository --name="Red Hat Enterprise Linux 7 Server RPMs x86_64 7Server" --organization-id=1 --product="Red Hat Enterprise Linux Server" --format=syncable
  ~~~


Actual results:
--------------

Could not export the repository:
  500 Internal Server Error



Expected results:
----------------

Generated /var/lib/pulp/exports/<ORG>/Export-SYNCABLE-Red_Hat_Enterprise_Linux_7_Server_RPMs_x86_64_7Server-176/1.0/2024-04-09T17-07-52-02-00/metadata.json


Additional info:
---------------

Log message from /var/log/foreman/production.log

=========================
2024-04-09T14:21:59 [I|app|f2ed5aee] Started POST "/katello/api/content_exports/repository" for 10.37.195.22 at 2024-04-09 14:21:59 +0200
2024-04-09T14:21:59 [I|app|f2ed5aee] Processing by Katello::Api::V2::ContentExportsController#repository as */*
2024-04-09T14:21:59 [I|app|f2ed5aee]   Parameters: {"id"=>6, "api_version"=>"v2", "content_export"=>{"format"=>"syncable", "id"=>6}}
2024-04-09T14:21:59 [I|app|f2ed5aee] Authorized user admin(Admin User)
2024-04-09T14:22:00 [I|bac|f2ed5aee] Task {label: , execution_plan_id: 5cba365c-30db-4a51-8b90-e3aac884841e} state changed: pending 
2024-04-09T14:22:00 [I|bac|f2ed5aee] Task {label: Actions::Pulp3::Orchestration::ContentViewVersion::ExportRepository, id: 95fba8f1-1465-4431-a13e-c5c5cbf93c72, execution_plan_id: 5cba365c-30db-4a51-8b90-e3aac884841e} state changed: planning 
2024-04-09T14:22:00 [E|bac|f2ed5aee] wrong number of arguments (given 2, expected 1) (ArgumentError)
 f2ed5aee | /usr/share/gems/gems/katello-4.13.0.pre.master/app/lib/actions/pulp3/orchestration/content_view_version/export_repository.rb:6:in `plan'
 f2ed5aee | /usr/share/gems/gems/dynflow-1.8.3/lib/dynflow/action.rb:534:in `block (3 levels) in execute_plan'
 f2ed5aee | /usr/share/gems/gems/dynflow-1.8.3/lib/dynflow/middleware/stack.rb:28:in `pass'
 f2ed5aee | /usr/share/gems/gems/dynflow-1.8.3/lib/dynflow/middleware.rb:20:in `pass'
=========================

From the documentation this is the command to execute: 

 ~~~
 # hammer content-export complete repository \
   --organization="My_Organization" \
   --product="My_Product" \
   --name="My_Repository" \
   --format=syncable
 ~~~

Comment 1 Giovanni Formisano 2024-04-10 14:05:32 UTC
Hello Team, 

I am not expert about Katello but doing troubleshooting I would like to share my finding, maybe can help.

Reading the production.log I have seen this call:

============================
2024-04-09T14:22:00 [I|bac|f2ed5aee] Task {label: , execution_plan_id: 5cba365c-30db-4a51-8b90-e3aac884841e} state changed: pending 
2024-04-09T14:22:00 [I|bac|f2ed5aee] Task {label: Actions::Pulp3::Orchestration::ContentViewVersion::ExportRepository, id: 95fba8f1-1465-4431-a13e-c5c5cbf93c72, execution_plan_id: 5cba365c-30db-4a51-8b90-e3aac884841e} state changed: planning 
2024-04-09T14:22:00 [E|bac|f2ed5aee] wrong number of arguments (given 2, expected 1) (ArgumentError)
 f2ed5aee | /usr/share/gems/gems/katello-4.13.0.pre.master/app/lib/actions/pulp3/orchestration/content_view_version/export_repository.rb:6:in `plan'
============================

Checking inside call I though that there is something in this rb file /usr/share/gems/gems/katello-4.13.0.pre.master/app/controllers/katello/api/v2/exports_controller.rb

And here my assumption, I guess is called this function:

====================================
    def find_exportable_repository
      @repository = Repository.find_by_id(params[:id])
      if @repository.blank?
        throw_resource_not_found(name: 'repository', id: params[:id])
      end

      unless @repository.organization.can_export_content?
        throw_resource_not_found(name: 'organization', id: @repository.organization.id)
      end
    end
====================================

But the Repository.find needs 1 parameter. Looks like satellite try to pass <id> and <execution_plan_id>

If I am right seems is not correct since that in the function is specify only the <:id>

This is why I receive 

====================
 wrong number of arguments (given 2, expected 1) (ArgumentError)
===================

I hope this comment can be helpful.

Comment 2 Oleh Fedorenko 2024-04-11 14:06:55 UTC
For the maintainer: this looks like an overlook of https://github.com/Katello/katello/pull/10885. The actual issue seems to be in https://github.com/Katello/katello/blob/master/app/lib/actions/pulp3/orchestration/content_view_version/export_repository.rb#L6-L9, which should be fixed by extracting of keyword arguments into a hash similarly to https://github.com/Katello/katello/pull/10885/files#diff-b15de70362926747b6c8b3158a9c435bf00bb65745ee9a256552cac5a4d6175f.

Comment 3 Partha Aji 2024-04-30 16:57:26 UTC
Connecting redmine issue https://projects.theforeman.org/issues/37381 from this bug

Comment 4 Eric Helms 2024-06-06 17:28:02 UTC
This BZ has been automatically migrated to the issues.redhat.com Red Hat Issue Tracker. All future work related to this report will be managed there.

Due to differences in account names between systems, some fields were not replicated.  Be sure to add yourself to Jira issue's "Watchers" field to continue receiving updates and add others to the "Need Info From" field to continue requesting information.

To find the migrated issue, look in the "Links" section for a direct link to the new issue location. The issue key will have an icon of 2 footprints next to it, and begin with "SAT-" followed by an integer.  You can also find this issue by visiting https://issues.redhat.com/issues/?jql= and searching the "Bugzilla Bug" field for this BZ's number, e.g. a search like:

"Bugzilla Bug" = 1234567

In the event you have trouble locating or viewing this issue, you can file an issue by sending mail to rh-issues. You can also visit https://access.redhat.com/articles/7032570 for general account information.