Bug 1371030

Summary: Unchecking Sync plan enabled errors with start date invalid
Product: Red Hat Satellite Reporter: Peter Vreman <peter.vreman>
Component: Content ManagementAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED CURRENTRELEASE QA Contact: Katello QA List <katello-qa-list>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2.0CC: bbuckingham, jcallaha, peter.vreman
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-08 15:10:23 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 1122832    
Attachments:
Description Flags
Screenshot of the invalid date error and greyed out Save none

Description Peter Vreman 2016-08-29 08:20:45 UTC
Description of problem:


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


How reproducible:


Steps to Reproduce:
1. Create Sync planA, leave default settings
2. Edit Sync PlanA, uncheck "Sync Enabled"
3. 

Actual results:
Error thrown "An error occurred saving the Sync Plan: base Start Date and Time can't be blank"
Even trying to fix it to set a start date again does not work as the Save of a new start date is greyed out

Expected results:
Sync is disabled. No error with start date.

Additional info:

Comment 1 Peter Vreman 2016-08-29 08:22:52 UTC
Created attachment 1195209 [details]
Screenshot of the invalid date error and greyed out Save

Comment 3 Brad Buckingham 2016-08-31 18:06:53 UTC
Hi Peter, 

I attempted to reproduce the behavior on Satellite 6.2.0 GA and latest upstream without success.

What browser and version were you using?  Mine is chrome version 52.0.2743.116 (64-bit).

Also, would it be possible to paste or attach the error from the production log?

On my install, the full resource was included in the PUT request.  E.g.

2016-08-31 18:00:12 [app] [I]   Parameters: {"id"=>"2", "organization_id"=>"1", "name"=>"planA", "description"=>nil, "interval"=>"hourly", "next_sync"=>"2016/08/31 14:00:00 EDT", "created_at"=>"2016-08-31 14:00:02 -0400", "updated_at"=>"2016-08-31 14:00:02 -0400", "enabled"=>false, "products"=>nil, "permissions"=>{"view_sync_plans"=>true, "edit_sync_plans"=>true, "destroy_sync_plans"=>true}, "sync_date"=>"Wed Aug 31 2016 14:00:00 GMT-0400 (EDT)", "syncTime"=>"2016/08/31 14:00:00 EDT", "syncDate"=>"2016/08/31 14:00:00 EDT", "api_version"=>"v2", "sync_plan"=>{"id"=>"2", "name"=>"planA", "description"=>nil, "sync_date"=>"Wed Aug 31 2016 14:00:00 GMT-0400 (EDT)", "interval"=>"hourly", "organization_id"=>"1", "created_at"=>"2016-08-31 14:00:02 -0400", "updated_at"=>"2016-08-31 14:00:02 -0400", "enabled"=>false}}

Comment 4 Peter Vreman 2016-09-28 09:28:05 UTC
HI Brad,

I can reproduce it on a fresh Sat6.2.2 installation. My browser is Firefox 49.0.1

Create PlanA:

2016-09-28 09:24:31 [app] [I] Started POST "/katello/api/v2/organizations/3/sync_plans" for 10.2.2.37 at 2016-09-28 09:24:31 +0000
2016-09-28 09:24:31 [app] [I] Processing by Katello::Api::V2::SyncPlansController#create as JSON
2016-09-28 09:24:31 [app] [I]   Parameters: {"interval"=>"hourly", "startDate"=>"2016-09-28T09:24:22.693Z", "name"=>"PlanA", "sync_date"=>"Wed Sep 28 2016 11:24:00 GMT+0200 (W. Europe Standard Time)", "api_version"=>"v2", "organization_id"=>"3", "sync_plan"=>{"name"=>"PlanA", "sync_date"=>"Wed Sep 28 2016 11:24:00 GMT+0200 (W. Europe Standard Time)", "interval"=>"hourly"}}
2016-09-28 09:24:31 [app] [I]   Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.78/app/views/katello/api/v2/sync_plans/show.json.rabl within katello/api/v2/layouts/resource (28.2ms)
2016-09-28 09:24:31 [app] [I] Completed 200 OK in 91ms (Views: 20.9ms | ActiveRecord: 48.7ms)


Update PlanA to uncheck enebaled:

2016-09-28 09:24:37 [app] [I] Started PUT "/katello/api/v2/organizations/3/sync_plans/1" for 10.2.2.37 at 2016-09-28 09:24:37 +0000
2016-09-28 09:24:37 [app] [I] Processing by Katello::Api::V2::SyncPlansController#update as JSON
2016-09-28 09:24:37 [app] [I]   Parameters: {"id"=>"1", "organization_id"=>"3", "name"=>"PlanA", "description"=>nil, "interval"=>"hourly", "next_sync"=>"2016/09/28 11:24:00 CEST", "created_at"=>"2016-09-28 11:24:31 +0200", "updated_at"=>"2016-09-28 11:24:31 +0200", "enabled"=>false, "products"=>nil, "permissions"=>{"view_sync_plans"=>true, "edit_sync_plans"=>true, "destroy_sync_plans"=>true}, "sync_date"=>"Invalid Date", "syncTime"=>"2016/09/28 11:24:00 CEST", "syncDate"=>"2016/09/28 11:24:00 CEST", "api_version"=>"v2", "sync_plan"=>{"id"=>"1", "name"=>"PlanA", "description"=>nil, "sync_date"=>"Invalid Date", "interval"=>"hourly", "organization_id"=>"3", "created_at"=>"2016-09-28 11:24:31 +0200", "updated_at"=>"2016-09-28 11:24:31 +0200", "enabled"=>false}}
2016-09-28 09:24:37 [foreman-tasks/action] [E] Validation failed: Start Date and Time can't be blank (ActiveRecord::RecordInvalid)
 | /opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/validations.rb:57:in `save!'
 | /opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/attribute_methods/dirty.rb:29:in `save!'
 | /opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/transactions.rb:273:in `block in save!'
 | /opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/transactions.rb:329:in `block in with_transaction_returning_status'
 | /opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/connection_adapters/abstract/database_statements.rb:199:in `transaction'
 | /opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/transactions.rb:208:in `transaction'
 | /opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/transactions.rb:326:in `with_transaction_returning_status'
 | /opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/transactions.rb:273:in `save!'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.78/app/lib/actions/katello/sync_plan/update.rb:8:in `plan'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/action.rb:461:in `block (3 levels) in execute_plan'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware/stack.rb:26:in `call'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware/stack.rb:26:in `pass'
...
2016-09-28 09:24:37 [app] [E] <Class> ActiveRecord::RecordInvalid
2016-09-28 09:24:37 [app] [E] base: ["Start Date and Time can't be blank"]
2016-09-28 09:24:37 [app] [I] Completed 422 Unprocessable Entity in 127ms (Views: 0.3ms | ActiveRecord: 9.8ms)

Comment 5 Peter Vreman 2017-08-08 15:10:23 UTC
Closing. Works for me now also in current 6.2.10 release