Bug 2096237

Summary: [RFE] To be able to control the time schedule of InventorySync::Async::InventoryScheduledSync task in Red Hat Satellite 6
Product: Red Hat Satellite Reporter: Sayan Das <saydas>
Component: RH Cloud - InsightsAssignee: Shimon Shtein <sshtein>
Status: NEW --- QA Contact: Satellite QE Team <sat-qe-bz-list>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.9.9CC: aruzicka
Target Milestone: UnspecifiedKeywords: FutureFeature
Target Release: Unused   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Sayan Das 2022-06-13 11:12:00 UTC
1. Proposed title of this feature request

To be able to control the time schedule of InventorySync::Async::InventoryScheduledSync task in Red Hat Satellite 6.


2. What is the nature and description of the request?

A new option or setting is to be introduced to control the cron schedule for InventorySync::Async::InventoryScheduledSync task. 


3. Why does the customer need this? (List the business requirements here)

Under very specific circumstances, It may be required by some end-user to run the InsightsScheduledSync job during the daytime as network disconnection is expected around midnight. 

But as per https://github.com/theforeman/foreman_rh_cloud/blob/foreman_2_3/lib/foreman_rh_cloud/engine.rb#L149-L154 , the cronline is hardcoded for these two jobs 

        if User.unscoped.find_by_login(User::ANONYMOUS_ADMIN).present?
          ::ForemanTasks.dynflow.config.on_init(false) do |world|
            ForemanRhCloud::Engine.register_scheduled_task(InventorySync::Async::InventoryScheduledSync, '0 0 * * *')
            ForemanRhCloud::Engine.register_scheduled_task(InsightsCloud::Async::InsightsClientStatusAging, '0 0 * * *')
          end
        end
        
So there is no easy way to change the scheduling here for InventoryScheduledSync task. 


4. How would the customer like to achieve this? (List the functional requirements here)

There should be an option\settings present via either satellite-installer or via satellite settings (preferably) to be able to choose the scheduling time of InventoryScheduledSync task as per requirement.


5. For each functional requirement listed, specify how Red Hat and the customer can test to confirm the requirement is successfully implemented.

* Install Satellite and observe if the InventoryScheduledSync task is scheduled to run as per its default cron i.e.  0 0 * * *

* Use the newly developed option to tweak the scheduling of InventoryScheduledSync task to 0 10 * * * cronline and then observe if it's getting properly executed as per the new schedule or not.

* Needless to mention, whenever the scheduling will be changed, The existing Recurring logic either should be updated or else recreated with a new cron line.



6. Is there already an existing RFE upstream or in Red Hat Bugzilla?

NA


7. Does the customer have any specific timeline dependencies and which release would they like to target (i.e. RHEL5, RHEL6)?

As soon as possible


8. Is the sales team involved in this request and do they have any additional input?

NA

9. List any affected packages or components.

foreman_rh_cloud

10. Would the customer be able to assist in testing this functionality if implemented?

Yes


11. Additional information:

NA

Comment 3 Shimon Shtein 2023-03-09 09:43:46 UTC
This feature is already available in Satellite starting from 6.12.1.

The system would either randomize the start of all tasks between 00:00 and 03:00 or it is possible to force the delay by setting SATELLITE_RH_CLOUD_REQUESTS_DELAY environment variable to number of seconds to wait from midnight.