Description of problem: Trying to create non-yum repositories via hammer did not throw exception if user specified on_demand download policy. Version-Release number of selected component (if applicable): Satellite 6.5 snap 5 How reproducible: always Steps to Reproduce: 1. # hammer -v -u admin -p changeme --output=csv product create --description="aSTvrQbvLPZBmCPYlBce" --label="pdLSDBiObZmxSzcQzYhg" --name="YLqaeUGVtk" --organization-id="1" Message,Id,Name Product created.,71,YLqaeUGVtk 2. # hammer -v -u admin -p changeme --output=csv repository create --content-type="puppet" --download-policy="on_demand" --name="VBOjhSxRofEyePL" --product-id="71" --publish-via-http="true" --url="http://inecas.fedorapeople.org/fakerepos/zoo3/" Message,Id,Name Repository created.,85,VBOjhSxRofEyePL Actual results: No validation error. Expected results: Should throw validation error. Additional info: On 6.4, # hammer -v -u admin -p changeme --output=csv product create --description="aSTvrQbvLPZBmCPYlBce" --label="pdLSDBiObZmxSzcQzYhg" --name="YLqaeUGVtk" --organization-id="1" Message,Id,Name Product created,632,YLqaeUGVtk # hammer -v -u admin -p changeme --output=csv repository create --content-type="puppet" --download-policy="on_demand" --name="VBOjhSxRofEyePL" --product-id="632" --publish-via-http="true" --url="http://inecas.fedorapeople.org/fakerepos/zoo3/" [ERROR 2018-11-30T07:29:21 API] 422 Unprocessable Entity [ERROR 2018-11-30T07:29:21 Exception] Validation failed: Download policy cannot be set for non-yum repositories. Could not create the repository: Validation failed: Download policy cannot be set for non-yum repositories. [ERROR 2018-11-30T07:29:21 Exception] RestClient::UnprocessableEntity (422 Unprocessable Entity): /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.1/lib/restclient/abstract_response.rb:223:in `exception_with_response' /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.1/lib/restclient/abstract_response.rb:103:in `return!' /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.2/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.1/lib/restclient/request.rb:807:in `process_result' /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.1/lib/restclient/request.rb:725:in `block in transmit' /opt/rh/rh-ruby24/root/usr/share/ruby/net/http.rb:877:in `start' /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.1/lib/restclient/request.rb:715:in `transmit' /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.1/lib/restclient/request.rb:145:in `execute' /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.1/lib/restclient/request.rb:52:in `execute' /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.1/lib/restclient/resource.rb:67:in `post' /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.2/lib/apipie_bindings/api.rb:327:in `call_client' /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.2/lib/apipie_bindings/api.rb:240:in `http_call' /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.2/lib/apipie_bindings/api.rb:190:in `call_action' /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.2/lib/apipie_bindings/api.rb:185:in `call' /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.2/lib/apipie_bindings/resource.rb:21:in `call' /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.13.1.1/lib/hammer_cli/apipie/command.rb:51:in `send_request' /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.13.2.2/lib/hammer_cli_foreman/commands.rb:168:in `send_request' /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.13.1.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.13.1.1/lib/hammer_cli/abstract.rb:29: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.13.1.1/lib/hammer_cli/abstract.rb:29: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.13.1.1/lib/hammer_cli/abstract.rb:29: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.13.1.1/bin/hammer:143:in `<top (required)>' /usr/bin/hammer:23:in `load' /usr/bin/hammer:23:in `<main>'
*** Bug 1658527 has been marked as a duplicate of this bug. ***
Created redmine issue http://projects.theforeman.org/issues/25793 from this bug
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/25793 has been resolved.
Verified: @Satellite 6.5.0 Snap 11.0 Steps: >> unable to create repo non-yum repo with download policy: # hammer -v -u admin -p changeme --output=csv repository create --content-type="puppet" --download-policy="on_demand" --name="VBOjhSxRofEyePL" --product-id="131" --publish-via-http="true" --url="http://inecas.fedorapeople.org/fakerepos/zoo3/" Could not create the repository: Validation failed: Download policy Cannot set attribute download_policy for content type puppet # hammer -v -u admin -p changeme --output=csv repository create --content-type="file" --download-policy="on_demand" --name="VBOjhSxRofEyePL" --product-id="131" --publish-via-http="true" --url="http://inecas.fedorapeople.org/fakerepos/zoo3/" Could not create the repository: Validation failed: Download policy Cannot set attribute download_policy for content type file # hammer -v -u admin -p changeme --output=csv repository create --content-type="ostree" --download-policy="on_demand" --name="VBOjhSxRofEyePL" --product-id="131" --publish-via-http="true" --url="http://inecas.fedorapeople.org/fakerepos/zoo3/" Could not create the repository: Validation failed: OSTree Repositories cannot be unprotected., Download policy Cannot set attribute download_policy for content type ostree # hammer -v -u admin -p changeme --output=csv repository create --content-type="docker" --download-policy="on_demand" --name="VBOjhSxRofEyePL" --product-id="131" --publish-via-http="true" --url="http://inecas.fedorapeople.org/fakerepos/zoo3/" Could not create the repository: Validation failed: Docker upstream name cannot be blank when Repository URL is provided., Upstream Name cannot be blank when Repository URL is provided., Download policy Cannot set attribute download_policy for content type docker >> Able to create repo non-yum repo without download policy: # hammer -v -u admin -p changeme --output=csv repository create --content-type="puppet" --name="VBOjhSxRofEyePL" --product-id="131" --publish-via-http="true" --url="http://inecas.fedorapeople.org/fakerepos/zoo3/" Message,Id,Name Repository created.,287,VBOjhSxRofEyePL Observation: - Unable to create repo non-yum repo with download policy and seen validation error: "Download policy Cannot set attribute download_policy for content type" - Able to create repo non-yum repo without download policy
*** Bug 1645748 has been marked as a duplicate of this bug. ***
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, 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-2019:1222