Bug 1134526
Summary: | hammer import template-snippet fails with TypeError:can't convert nil into String while processing CSV line | ||
---|---|---|---|
Product: | Red Hat Satellite | Reporter: | Lukas Pramuk <lpramuk> |
Component: | Transitions | Assignee: | Tomas Lestach <tlestach> |
Status: | CLOSED CURRENTRELEASE | QA Contact: | Roman Plevka <rplevka> |
Severity: | medium | Docs Contact: | Roman Plevka <rplevka> |
Priority: | unspecified | ||
Version: | Unspecified | CC: | bkearney, cperry, ggainey, rplevka |
Target Milestone: | Unspecified | Keywords: | Reopened |
Target Release: | Unused | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2015-08-12 13:56:46 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: | |
Embargoed: | |||
Bug Depends On: | |||
Bug Blocks: | 1125243 |
Description
Lukas Pramuk
2014-08-27 16:43:25 UTC
Since this issue was entered in Red Hat Bugzilla, the release flag has been set to ? to ensure that it is properly evaluated for this release. Having empty csv file $ cat data/kss.csv id,org_id,script_name,kickstart_id,kickstart_label,position,script_type,chroot,interpreter,data $ hammer import template-snippet --verbose --csv-file data/kss.csv --verbose Importing from data/kss.csv Summary No action taken. what looks good. Having (note the extra empty line) $ cat data/kss.csv id,org_id,script_name,kickstart_id,kickstart_label,position,script_type,chroot,interpreter,data $ hammer import template-snippet --verbose --csv-file data/kss.csv --verbose fails with the reported exception. But this is *not* a valid csv file. Closing NOTABUG. But we fixed it anyway: hammer_cli_import.github 0d2b0d19dbfe0301ca8cc2b1d93b4f274c674dca prevent nil exception addressing: Caught TypeError:no implicit conversion of nil into String while processing CSV line: ... /usr/share/gems/gems/hammer_cli_import-0.10.6.3/lib/hammer_cli_import/templatesnippet.rb:41:in `+' /usr/share/gems/gems/hammer_cli_import-0.10.6.3/lib/hammer_cli_import/templatesnippet.rb:41:in `mk_snippet_hash' /usr/share/gems/gems/hammer_cli_import-0.10.6.3/lib/hammer_cli_import/templatesnippet.rb:57:in `import_single_row' /usr/share/gems/gems/hammer_cli_import-0.10.6.3/lib/hammer_cli_import/base.rb:511:in `call' /usr/share/gems/gems/hammer_cli_import-0.10.6.3/lib/hammer_cli_import/base.rb:511:in `block (2 levels) in cvs_iterate' /usr/share/gems/gems/hammer_cli_import-0.10.6.3/lib/hammer_cli_import/importtools.rb:302:in `call' /usr/share/gems/gems/hammer_cli_import-0.10.6.3/lib/hammer_cli_import/importtools.rb:302:in `handle_missing_and_supress' /usr/share/gems/gems/hammer_cli_import-0.10.6.3/lib/hammer_cli_import/base.rb:510:in `block in cvs_iterate' ... VERIFIED. reproduced with ver: hammer_cli_import (0.10.6) tested with version: hammer_cli_import (0.10.14) # cat kickstart-scripts2.csv id,org_id,script_name,kickstart_id,kickstart_label,position,script_type,chroot,interpreter,data # # hammer import template-snippet --verbose --csv-file kickstart-scripts2.csv Importing from kickstart-scripts2.csv Creating new template snippet: ---- Summary Created 1 template snippet. The patch has a side effect though. An empty snippet is being created: # hammer template list ---|-------------------------------|---------- ID | NAME | TYPE ---|-------------------------------|---------- 51 | ---- | snippet ---|-------------------------------|---------- I believe a proper csv validation is needed to be implemented for all the import subcommands. I've filed another ticket for this: BZ #1223776 This bug is slated to be released with Satellite 6.1. This bug was fixed in version 6.1.1 of Satellite which was released on 12 August, 2015. |