Bug 1654944 - No validation on download policy for non-yum repositories
Summary: No validation on download policy for non-yum repositories
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite 6
Classification: Red Hat
Component: Repositories
Version: 6.5.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium vote
Target Milestone: 6.5.0
Assignee: Samir Jha
QA Contact: vijsingh
URL:
Whiteboard:
: 1645748 1658527 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-11-30 06:38 UTC by Nikhil Kathole
Modified: 2019-05-14 12:39 UTC (History)
6 users (show)

Fixed In Version: tfm-rubygem-katello-3.10.0.6-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-05-14 12:39:19 UTC


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2019:1222 None None None 2019-05-14 12:39:27 UTC
Foreman Issue Tracker 25793 None None None 2019-01-07 18:58:29 UTC

Description Nikhil Kathole 2018-11-30 06:38:09 UTC
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>'

Comment 7 Nikhil Kathole 2019-01-07 15:58:23 UTC
*** Bug 1658527 has been marked as a duplicate of this bug. ***

Comment 8 Samir Jha 2019-01-07 18:58:28 UTC
Created redmine issue http://projects.theforeman.org/issues/25793 from this bug

Comment 10 Bryan Kearney 2019-01-08 15:29:49 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/25793 has been resolved.

Comment 12 vijsingh 2019-01-14 06:21:30 UTC
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

Comment 13 Brad Buckingham 2019-01-14 16:23:22 UTC
*** Bug 1645748 has been marked as a duplicate of this bug. ***

Comment 16 errata-xmlrpc 2019-05-14 12:39:19 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, 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


Note You need to log in before you can comment on or make changes to this bug.