Bug 1853504

Summary: [Regression] Hammer export-legacy Fails with Composite Content Views
Product: Red Hat Satellite Reporter: myoder
Component: Content ViewsAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED ERRATA QA Contact: Lai <ltran>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: 6.7.0CC: apatel, egolov, jjeffers, kgaikwad, mshira, ofedoren, pscolier, rabajaj
Target Milestone: 6.8.0Keywords: Regression, Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: tfm-rubygem-katello-3.16.0.8-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1884025 (view as bug list) Environment:
Last Closed: 2020-10-27 13:03:56 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 myoder 2020-07-02 20:29:44 UTC
Description of problem:

Trying to export a composite content view with hammer export-legacy command like so:

   # hammer -d content-view version export-legacy --organization Studio-14 --content-view "ccv-sat-6.7" --version 1

But getting this error when sending a POST to /katello/api/content_view_versions/ endpoint:

        [ INFO 2021-07-02T16:07:27 API] POST /katello/api/content_view_versions/14/export
        [DEBUG 2020-07-02T16:07:27 API] Params: {}
        [DEBUG 2020-07-02T16:07:27 API] Headers: {}
        [DEBUG 2020-07-02T16:07:27 API] Using authenticator: HammerCLIForeman::Api::InteractiveBasicAuth
        [ERROR 2020-07-02T16:07:28 API] 500 Internal Server Error
        [DEBUG 2020-07-02T16:07:28 API] {
            "displayMessage" => "wrong number of arguments (given 2, expected 3..4)",
                    "errors" => [ 
                [0] "wrong number of arguments (given 2, expected 3..4)"
            ]
        }
        [DEBUG 2020-07-02T16:07:28 Exception] Using exception handler HammerCLIKatello::ExceptionHandler#handle_internal_error
        [ERROR 2020-07-02T16:07:28 Exception] wrong number of arguments (given 2, expected 3..4)
        Could not export the content view:
          wrong number of arguments (given 2, expected 3..4)
        [ERROR 2020-07-02T16:07:28 Exception] 

        RestClient::InternalServerError (500 Internal Server Error):
            /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.2/lib/restclient/abstract_response.rb:223:in `exception_with_response'
            /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.2/lib/restclient/abstract_response.rb:103:in `return!'
            /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.3.0/lib/apipie_bindings/api.rb:353:in `block in rest_client_call_block'
            /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.2/lib/restclient/request.rb:807:in `process_result'
            /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.2/lib/restclient/request.rb:725:in `block in transmit'
            /opt/rh/rh-ruby25/root/usr/share/ruby/net/http.rb:910:in `start'
            /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.2/lib/restclient/request.rb:715:in `transmit'
            /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.2/lib/restclient/request.rb:145:in `execute'
            /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.2/lib/restclient/request.rb:52:in `execute'
            /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.2/lib/restclient/resource.rb:67:in `post'
            /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.3.0/lib/apipie_bindings/api.rb:327:in `call_client'
            /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.3.0/lib/apipie_bindings/api.rb:240:in `http_call'
            /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.3.0/lib/apipie_bindings/api.rb:190:in `call_action'
            /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.3.0/lib/apipie_bindings/api.rb:185:in `call'
            /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.3.0/lib/apipie_bindings/resource.rb:21:in `call'
            /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.19.2.1/lib/hammer_cli/apipie/command.rb:53:in `send_request'
            /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.19.6.4/lib/hammer_cli_foreman/commands.rb:188:in `send_request'
            /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman_tasks-0.0.14/lib/hammer_cli_foreman_tasks/async_command.rb:14:in `execute'
            /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:63:in `run'
            /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.19.2.1/lib/hammer_cli/abstract.rb:76:in `run'
            /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/subcommand/execution.rb:11:in `execute'
            /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:63:in `run'
            /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.19.2.1/lib/hammer_cli/abstract.rb:76:in `run'
            /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/subcommand/execution.rb:11:in `execute'
            /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:63:in `run'
            /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.19.2.1/lib/hammer_cli/abstract.rb:76:in `run'
            /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/subcommand/execution.rb:11:in `execute'
            /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:63:in `run'
            /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.19.2.1/lib/hammer_cli/abstract.rb:76:in `run'
            /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:132:in `run'
            /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.19.2.1/bin/hammer:147:in `<top (required)>'
            /usr/bin/hammer:23:in `load'
            /usr/bin/hammer:23:in `<main>'


When I try a regular content view (the only content view that is in the composite content view that failed above), I get a successful response for that same api endpoint:

        # hammer -d content-view version export-legacy --organization Studio-14 --content-view "sat-6.7" --version 1

        [ INFO 2020-07-02T16:08:27 API] POST /katello/api/content_view_versions/13/export
        [DEBUG 2020-07-02T16:08:27 API] Params: {}
        [DEBUG 2020-07-02T16:08:27 API] Headers: {}
        [DEBUG 2020-07-02T16:08:27 API] Using authenticator: HammerCLIForeman::Api::InteractiveBasicAuth
        [DEBUG 2020-07-02T16:08:28 API] Response: {
                           "id" => "738ca4c0-19ab-45b8-a626-fc06d316f6de",
                        "label" => "Actions::Katello::ContentViewVersion::Export",
                      "pending" => true,
                       "action" => "Export content view version 'sat-6.7 1.0'; content view 'sat-6.7'; organization 'Studio-14'",
                     "username" => "admin",
                   "started_at" => "2020-07-02 20:08:27 UTC",
                     "ended_at" => nil,
                        "state" => "planned",
                       "result" => "pending",

        < - - - skipped output - - - >

                    [1] [
                        [0] "content_view",
                        [1] {
                            "text" => "content view 'sat-6.7'",
                            "link" => "/content_views/8/versions"
                        }
                    ],
                    [2] [
                        [0] "organization",
                        [1] {
                            "text" => "organization 'Studio-14'",
                            "link" => "/organizations/1/edit"
                        }
                    ]
                ],
                "output" => "",
                "errors" => []
            },
                  "cli_example" => nil,
            "available_actions" => {
                "cancellable" => false,
                  "resumable" => false
            }
        }

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

How reproducible:
Always

Steps to Reproduce:
1. Set a repository for immediate download policy and sync it
2. Create a content view with this repository and publish it (make sure repo has completely synced)
3. Create a composite content view with only the content view created in step 2 (make sure to wait for first publish to finish)
4. Try and export composite content view with the hammer export-legacy command

Actual results:
Fails with error.

Expected results:
Successfully export composite content view.

Additional info:
I have tested this on Satellite 6.6 and I am able to successfully export composite content views.

Comment 1 Oleh Fedorenko 2020-07-03 00:24:45 UTC
Changing component to Content Views since this seems to be an issue on the server/plugin side (500 error code for response).

Comment 2 piytiwar 2020-07-14 19:22:45 UTC
Connecting redmine issue https://projects.theforeman.org/issues/30405 from this bug

Comment 3 Bryan Kearney 2020-07-16 00:04:34 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/30405 has been resolved.

Comment 6 Lai 2020-09-22 17:53:15 UTC
Steps to retest:
1. Set a repository for immediate download policy and sync it
2. Create a content view with this repository and publish it (make sure repo has completely synced)
3. Create a composite content view with only the content view created in step 2 (make sure to wait for first publish to finish)
4. Try and export composite content view with the hammer export-legacy command

Actual results:
[...............] [100%]

Successfully export composite content view.


Expected results:
[...............] [100%]
Successfully export composite content view.


Verified on 6.8.0_016

Comment 10 errata-xmlrpc 2020-10-27 13:03:56 UTC
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 (Important: Satellite 6.8 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-2020:4366