Bug #18437

Product Create scarcely fails with InvalidFormatException in candlepin

Added by Ivan Necas 9 months ago. Updated 7 months ago.

Status:Closed
Priority:Normal
Assigned To:Ivan Necas
Category:Subscriptions
Target version:Foreman - Team Ivan Iteration 11
Difficulty: Pull request:https://github.com/Katello/katello/pull/6594, https://github.com/Katello/katello/pull/6617
Bugzilla link:1327543
Story points-
Velocity based estimate-
ReleaseKatello 3.3.0Release relationshipAuto

Description

The problem seems to be in using DateTime in json in https://github.com/Katello/katello/blob/aad62cc6dae670565218f7434a4e908550244b41/app/lib/katello/resources/candlepin.rb#L686

It seems ActiveSupport's DateTime has some issues with formating the time.

It's not that hard to get an invalid date with it (with 1000 on milisends)

x = nil; 100000.times { x = (DateTime.now + 10_950.days).to_json; break unless x.size == 31 }; puts x
# => "2047-02-01T23:42:09.1000+01:00" 

Using Time doesn't seem to have the problem

x = nil; 100000.times { x = (Time.now + 10_950.days).to_json; break unless x.size == 31 }; puts x
# = "2047-02-01T23:42:50.906+01:00" 

Associated revisions

Revision 6d0b4130
Added by Ivan Necas 8 months ago

Fixes #18437 - fix formatting of time sent to Candlepin

With DateTime#to_json, we could get invalid date (such as
"2047-02-01T23:42:09.1000+01:00"). When using Time,
no such issue was observed.

History

#1 Updated by Ivan Necas 9 months ago

  • Subject changed from Product Create scarcely fails with InvalidFormatException in candlepin to Product Create scarcely fails with InvalidFormatException in candlepin
  • Description updated (diff)

#2 Updated by The Foreman Bot 9 months ago

  • Status changed from New to Ready For Testing
  • Assigned To set to Ivan Necas
  • Pull request https://github.com/Katello/katello/pull/6594 added

#3 Updated by Ivan Necas 8 months ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#4 Updated by Eric Helms 8 months ago

  • Release set to Katello 3.3.0

#5 Updated by The Foreman Bot 8 months ago

  • Pull request https://github.com/Katello/katello/pull/6617 added

#6 Updated by Ivan Necas 7 months ago

  • Target version set to Team Ivan Iteration 11

Also available in: Atom PDF