Bug 1316167

Summary: hammer repository-set enable returns "Error: 409 Conflict" instead of "The repository is already enabled"
Product: Red Hat Satellite Reporter: Tom McKay <tomckay>
Component: RepositoriesAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED WONTFIX QA Contact: Tasos Papaioannou <tpapaioa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.8.0CC: apatel, kgaikwad, mshira, ofedoren, rabajaj, tasander, ymakias
Target Milestone: UnspecifiedKeywords: Reopened, Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/14122
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-04-13 17:39:57 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Tom McKay 2016-03-09 14:53:19 UTC
Attempting to enable an already enabled repository does not display the actual helpful error message.

To reproduce, attempt to enable an already-enabled repo.

Comment 1 Tom McKay 2016-03-09 14:53:21 UTC
Created from redmine issue http://projects.theforeman.org/issues/14122

Comment 3 Bryan Kearney 2016-03-12 03:09:55 UTC
Upstream bug component is API

Comment 4 Bryan Kearney 2016-07-26 15:25:24 UTC
Moving 6.2 bugs out to sat-backlog.

Comment 5 Bryan Kearney 2016-07-26 15:33:09 UTC
Moving 6.2 bugs out to sat-backlog.

Comment 7 Bryan Kearney 2016-08-10 19:14:39 UTC
Upstream bug component is API - Content

Comment 8 Bryan Kearney 2016-08-10 20:15:42 UTC
Upstream bug component is API

Comment 9 Bryan Kearney 2016-08-10 22:15:21 UTC
Upstream bug component is API - Content

Comment 10 John Mitsch 2016-12-19 21:56:14 UTC
[root@sat-snap-rhel7 ~]# curl -X PUT -k -u admin:changeme -H "Content-Type: application/json" -d '{"basearch": "i386", "releasever": "5.10"}' https://192.168.121.113/katello/api/products/101/repository_sets/1524/enable
{"displayMessage":"The repository is already enabled","errors":["The repository is already enabled"]}

I wasn't able to reproduce and I got the proper error on satellite-6.2.6-2.0.el7sat.noarch

I think the same fix as https://bugzilla.redhat.com/show_bug.cgi?id=1335898 fixed this.

*** This bug has been marked as a duplicate of bug 1335898 ***

Comment 11 Taft Sanders 2021-01-15 21:47:15 UTC
Reopening this bugzilla as I am able to reproduce this in Satellite 6.7.5 and Satellite 6.8.2:

# hammer repository-set enable --name "Red Hat Enterprise Linux 7 Server (RPMs)" --organization-label $ORG_LABEL --releasever 7Server --basearch x86_64
Repository enabled.

# hammer repository-set enable --name "Red Hat Enterprise Linux 7 Server (RPMs)" --organization-label $ORG_LABEL --releasever 7Server --basearch x86_64
Could not enable repository:
  Error: 409 Conflict

# hammer -d repository-set enable --name "Red Hat Enterprise Linux 7 Server (RPMs)" --organization-label $ORG_LABEL --releasever 7Server --basearch x86_64 
--snip--
[ INFO 2021-01-15T16:46:07 API] PUT /katello/api/repository_sets/2456/enable
[DEBUG 2021-01-15T16:46:07 API] Params: {
           "basearch" => "x86_64",
         "releasever" => "7Server",
    "organization_id" => 5
}
[DEBUG 2021-01-15T16:46:07 API] Headers: {}
[DEBUG 2021-01-15T16:46:07 API] Using authenticator: HammerCLIForeman::Api::InteractiveBasicAuth
[ERROR 2021-01-15T16:46:08 API] 409 Conflict
[DEBUG 2021-01-15T16:46:08 API] {
    "displayMessage" => "The repository is already enabled",
            "errors" => [
        [0] "The repository is already enabled"
    ]
}
[DEBUG 2021-01-15T16:46:08 Exception] Using exception handler HammerCLIKatello::ExceptionHandler#handle_general_exception
[ERROR 2021-01-15T16:46:08 Exception] Error: 409 Conflict
Could not enable repository:
  Error: 409 Conflict
[ERROR 2021-01-15T16:46:08 Exception] 

RestClient::Conflict (409 Conflict):
    /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:76:in `put'
    /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.5/lib/hammer_cli_foreman/commands.rb:188:in `send_request'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.19.2.1/lib/hammer_cli/apipie/command.rb:34: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>'

Comment 12 Mike McCune 2021-03-11 18:50:55 UTC
Upon review of our valid but aging backlog the Satellite Team has concluded that this Bugzilla does not meet the criteria for a resolution in the near term, and are planning to close in one month's time. If you have any concerns about this, please contact your Red Hat Account team.  Thank you.

Comment 13 Mike McCune 2021-03-16 15:58:30 UTC
Upon review of our valid but aging backlog the Satellite Team has concluded that this Bugzilla does not meet the criteria for a resolution in the near term, and are planning to close in a month. If you have any concerns about this, please contact your Red Hat Account team.  Thank you.

Comment 15 Mike McCune 2021-04-13 17:39:57 UTC
Thank you for your interest in Satellite 6. We have evaluated this request, and while we recognize that it is a valid request, we do not expect this to be implemented in the product in the foreseeable future. This is due to other priorities for the product, and not a reflection on the request itself. We are therefore closing this out as WONTFIX. If you have any concerns about this, please do not reopen. Instead, feel free to contact your Red Hat Account Team. Thank you.