Bug 2225148 - Can set download policy to background from command line.
Summary: Can set download policy to background from command line.
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Repositories
Version: 6.14.0
Hardware: Unspecified
OS: Unspecified
low
medium
Target Milestone: Unspecified
Assignee: satellite6-bugs
QA Contact: Satellite QE Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-07-24 12:13 UTC by Mohit Kushwah
Modified: 2023-08-03 17:09 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-07-31 16:03:47 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Download policy shows blank option from Web UI. (135.98 KB, image/png)
2023-07-24 12:13 UTC, Mohit Kushwah
no flags Details

Description Mohit Kushwah 2023-07-24 12:13:56 UTC
Created attachment 1977286 [details]
Download policy shows blank option from Web UI.

Description of problem:

While setting the download policy for any repository from the command line, the command should show some error.

Still, Can set the deprecated 'background' download policy for repositories from the command line and it shows a blank option on Web UI.



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

Red Hat Satellite 6.14


How reproducible:

Always


Steps to Reproduce:


1. Install a new Red Hat Satellite 6.14

2. Enable and Sync repositories before making any changes.

3. Change the download policy from the command line as below:

~~~
# echo "update katello_root_repositories set download_policy = 'background' where download_policy = 'on_demand'" |su - postgres -c 'psql foreman'
~~~

4. From Web UI, we can see (Refer to attachment) the download policy is showing a blank option.

5. And while syncing the repository we can see the below error:

~~~
Error message: the server returns an error
HTTP status code: 400
Response headers: {"Date"=>"Mon, 24 Jul 2023 11:42:40 GMT", "Server"=>"gunicorn", "Content-Type"=>"application/json", "Vary"=>"Accept,Cookie", "Allow"=>"GET, PUT, PATCH, DELETE, HEAD, OPTIONS", "X-Frame-Options"=>"DENY", "Content-Length"=>"52", "X-Content-Type-Options"=>"nosniff", "Referrer-Policy"=>"same-origin", "Correlation-ID"=>"1021c2af-483c-4f6e-8a9d-bdefdcdba79c", "Access-Control-Expose-Headers"=>"Correlation-ID", "Via"=>"1.1 satellite.example.com", "Connection"=>"close"}
Response body: {"policy":["\"background\" is not a valid choice."]}
~~~




Actual results:

- Can set the download policy for any repository to 'background' from the command line.


Expected results:

While setting the download policy to 'background' from the command it should show some errors as the option is deprecated.







Additional info:


- If again we try to set the download policy to the blank option from the same page in the attachment, can observe the below error, which seems correct error message:

~~~
An error occurred saving the Repository: Validation failed: Download policy must be one of the following: immediate, on_demand
~~~

Comment 4 Ian Ballou 2023-07-31 16:03:47 UTC
# echo "update katello_root_repositories set download_policy = 'background' where download_policy = 'on_demand'" |su - postgres -c 'psql foreman'

This command circumvents all validations that we have in Rails. If you tried in the API, which is the "lowest level" sort of interfacing that we support, background shouldn't be allowed.

Since we cannot offer validations for users doing direct database edits, I'm closing this as NOTABUG.


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