Project

Profile

Help

Issue #6442

Updated by ttereshc over 4 years ago

Upload of an advisory raises `invalid literal for int() with base 10: 'sha256'` if checksum type is specified. 

 An example of advisory which triggers the error. 
 ~~~ 
 { 
   "id": "my_advisory_id", 
   "updated_date": "2014-06-10 00:00:00", 
   "description": "description", 
   "issued_date": "2014-06-10 00:00:00", 
   "fromstr": "me", 
   "status": "final", 
   "title": "kexec-tools bug fix update", 
   "summary": "summary", 
   "version": "1", 
   "type": "bugfix", 
   "severity": "", 
   "solution": "solution", 
   "release": "", 
   "rights": "Copyright 2014", 
   "pushcount": "1", 
   "pkglist": [ 
     { 
       "name": "long namet", 
       "shortname": "short name", 
       "packages": [ 
         { 
           "arch": "x86_64", 
           "epoch": "0", 
           "filename": "kexec-tools-2.0.4-32.el7_0.1.x86_64.rpm", 
           "name": "kexec-tools", 
           "reboot_suggested": false, 
           "relogin_suggested": false, 
           "restart_suggested": false, 
           "release": "32.el7_0.1", 
           "src": "kexec-tools-2.0.4-32.el7_0.1.src.rpm", 
           "sum": "8e214681104e4ba73726e0ce11d21b963ec0390fd70458d439ddc72372082034", 
           "sum_type": "sha256", 
           "version": "2.0.4" 
         } 
       ] 
     } 
   ], 
   "references": [ 
     { 
       "href": "https://example.com/", 
       "id": "", 
       "title": "my advisory", 
       "type": "bugzilla" 
     } 
   ], 
   "reboot_suggested": false 
 } 
 ~~~ 

 ### Proposed solution 

 Currently, sum_type is a TextField which stores an id(int) of checksum type as it defined in createrepo_c. 
 The suggestion is: 
  - change a filed type and store an integer value in the PositiveIntegerField with choices, values for which are taken from what is supported in createrpo_c. 
  - write a migration to convert the field to integer 
  - convert a string representing checksum type to a createrepo_c id during upload

Back