Bug 1683096 - hammer sync-plan update does not work with custom cron
Summary: hammer sync-plan update does not work with custom cron
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite 6
Classification: Red Hat
Component: Sync Plans
Version: 6.0.0
Hardware: Unspecified
OS: Unspecified
unspecified
high vote
Target Milestone: Released
Assignee: Samir Jha
QA Contact: Stephen Wadeley
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-02-26 09:19 UTC by Stephen Wadeley
Modified: 2019-10-07 17:18 UTC (History)
2 users (show)

Fixed In Version: tfm-rubygem-katello-3.10.0.30-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-05-14 12:40:17 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:40:25 UTC
Foreman Issue Tracker 26283 None None None 2019-03-08 21:26:19 UTC

Description Stephen Wadeley 2019-02-26 09:19:49 UTC
Description of problem:

When trying to update a sync-plan created with interval set to custom cron, the command always fails with:

Could not update the sync plan:
  Cron expression is not valid!

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

~]# hammer --version
hammer (0.15.1)


How reproducible:

I tried many different commands against sync-plan created in web UI and using hammer.


Steps to Reproduce:
1. ~]# hammer sync-plan create  --name BugTest --sync-date "2019/02/01" --enabled 1  --interval "custom cron" --cron-expression "1 2 3 4 5" --organization-id 1 
2. ~]# hammer sync-plan info --name BugTest --organization-id 1

3. ~]# hammer sync-plan update --name BugTest --organization-id 1 --description Hello
Could not update the sync plan:
  Cron expression is not valid!

4. ~]# hammer sync-plan update --name BugTest --organization-id 1 --description Hello --cron-expression "1 2 3 4 5"
Could not update the sync plan:
  Cron expression is not valid!


Actual results:

Could not update the sync plan

Expected results:

Could update the sync plan

Comment 4 Andrew Kofink 2019-02-26 14:04:27 UTC
This is definitely an issue in Katello. The following works just fine (with --interval _and_ --cron-expression):

hammer -d sync-plan update --id 3 --cron-expression "1 2 3 4 5" --interval "custom cron"

This logic in Katello isn't quite right https://github.com/Katello/katello/blob/master/app/models/katello/sync_plan.rb#L59. It only checks the params and not the currently set value (self.interval rather than params["interval"]). It looks like this is a regression starting in Katello 3.9 https://github.com/Katello/katello/commit/8ac17807def.

Comment 5 jcallaha 2019-03-08 16:58:10 UTC
This also breaks with valid cron

hammer sync-plan create  --name BugTest --sync-date "2019/02/01" --enabled 1  --interval "custom cron" --cron-expression "0 0 12 1 1 ? *" --organization-id 1
Could not create the sync plan:
  Cron expression is not valid!

Comment 6 Samir Jha 2019-03-08 21:26:19 UTC
Created redmine issue http://projects.theforeman.org/issues/26283 from this bug

Comment 7 Bryan Kearney 2019-03-14 18:04:41 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/26283 has been resolved.

Comment 12 errata-xmlrpc 2019-05-14 12:40:17 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.