Bug 2135355 - No way to enable a disabled Recurring Logic
Summary: No way to enable a disabled Recurring Logic
Keywords:
Status: NEW
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Tasks Plugin
Version: 6.11.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: Unspecified
Assignee: satellite6-bugs
QA Contact: Peter Ondrejka
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-10-17 11:07 UTC by Pavel Moravec
Modified: 2023-08-02 14:51 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker SAT-19330 0 None None None 2023-08-02 14:51:01 UTC

Description Pavel Moravec 2022-10-17 11:07:27 UTC
Description of problem:
When I disable a recurring logic (say, "Inventory scheduled sync", id=5), there is no way to successfully re-enable it.

WebUI offers Enable button, but it is a no-op (production.log does not log anything).

hammer does not have the capabilities to even enable or disable a recurring logic.

API does not work for me, since:
- per apidoc, "PUT /foreman_tasks/api/recurring_logics/:id" should work - but neither below command does work:

curl -H "content-type: application/json" -u admin:$PASS -X PUT -d "{\"id\": 5, \"enabled\": 1}" https://$(hostname -f)/foreman_tasks/api/recurring_logics/5

curl -H "content-type: application/json" -u admin:$PASS -X PUT -d "{\"id\": 5, \"enabled\": \"true\"}" https://$(hostname -f)/foreman_tasks/api/recurring_logics/5

Both logs ForemanTasks::Api::RecurringLogicsController#update but with no real change.

Since WebUI disable triggered /foreman_tasks/recurring_logics/5/disable endpoint and ForemanTasks::RecurringLogicsController#disable method, I also tried:

curl -H "content-type: application/json" -u admin:$PASS -X PUT -d "{\"id\": 5, \"enabled\": \"true\"}" https://$(hostname -f)/foreman_tasks/api/recurring_logics/5/enable

which failed with "No route matches" error.


So I see no way in enabling a disabled recurring logic.


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


How reproducible:
100%


Steps to Reproduce:
1. Disable a recurring logic
2. Try to enable it by any mean.


Actual results:
2. No way found.


Expected results:
2. Ideally both API and WebUI does work.


Additional info:

Comment 1 Pavel Moravec 2022-10-17 11:53:57 UTC
This is mostly fixed in 6.12 where WebUI Enable button does work.

Still no way (known to me) to let it enabled via API, where the outcome is the same.

Comment 2 Adam Ruzicka 2022-10-17 11:56:52 UTC
> per apidoc, "PUT /foreman_tasks/api/recurring_logics/:id" should work - but neither below command does work:

The apidoc seems to be wrong, the accepted format should be { "id: $ID, "recurring_logic": { "enabled": $enabled } }


> Since WebUI disable triggered /foreman_tasks/recurring_logics/5/disable endpoint and ForemanTasks::RecurringLogicsController#disable method, I also tried:
> curl -H "content-type: application/json" -u admin:$PASS -X PUT -d "{\"id\": 5, \"enabled\": \"true\"}" https://$(hostname -f)/foreman_tasks/api/recurring_logics/5/enable

Webui hits the non-api controller, the following could work, but as it is a non-api controller, it should not be considered stable interface

curl -u admin:$pass -X PUT -d '{"id": $id}' https://$(hostname -f)/foreman_tasks/recurring_logics/5/enable

Comment 3 Pavel Moravec 2022-10-17 12:14:41 UTC
(In reply to Adam Ruzicka from comment #2)
> > per apidoc, "PUT /foreman_tasks/api/recurring_logics/:id" should work - but neither below command does work:
> 
> The apidoc seems to be wrong, the accepted format should be { "id: $ID,
> "recurring_logic": { "enabled": $enabled } }

That does not work either (on 6.12 beta/testathlon):

# cat enable.json
{ 
	"id": "5",
	"recurring_logic": { 
		"enabled": "true"
	}
}
[root@pmoravec-sat612-rhel8-beta ~]# curl -H "content-type: application/json" -u admin:$pass -X PUT -d @enable.json https://$(hostname -f)/foreman_tasks/recurring_logics/5
<!DOCTYPE html>
<html>
..
<body>
  <!-- This file lives in public/404.html -->
  <div class="dialog">
    <div>
      <h1>The page you were looking for doesn't exist.</h1>
..


> > Since WebUI disable triggered /foreman_tasks/recurring_logics/5/disable endpoint and ForemanTasks::RecurringLogicsController#disable method, I also tried:
> > curl -H "content-type: application/json" -u admin:$PASS -X PUT -d "{\"id\": 5, \"enabled\": \"true\"}" https://$(hostname -f)/foreman_tasks/api/recurring_logics/5/enable
> 
> Webui hits the non-api controller, the following could work, but as it is a
> non-api controller, it should not be considered stable interface
> 
> curl -u admin:$pass -X PUT -d '{"id": $id}' https://$(hostname
> -f)/foreman_tasks/recurring_logics/5/enable

This seems to fail on ActionController::InvalidAuthenticityToken all the time (but I guess prepending the command by getting auth token would make it work).


Anyway, it seems "just" apidoc needs to be updated (to something that really does work). At least WebUI does work in 6.12 \o/ .

Comment 4 Adam Ruzicka 2022-10-17 12:17:15 UTC
> That does not work either (on 6.12 beta/testathlon):

> # cat enable.json
> ...
> [root@pmoravec-sat612-rhel8-beta ~]# curl -H "content-type: application/json" -u admin:$pass -X PUT -d @enable.json https://$(hostname -f)/foreman_tasks/recurring_logics/5

But that's the ui controller again

Comment 5 Adam Ruzicka 2023-08-02 14:49:46 UTC
For reference, this seems to work for me, the apidoc should be updated to match this

curl -u $username:$password \
    -X PUT \
    -H 'Content-Type: application/json' \
    -d '{"recurring_logic": { "enabled": true } }'
    https://$sat_fqdn/foreman_tasks/api/recurring_logics/$recurring_logic_id


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