Skip to content
This repository has been archived by the owner on Jun 29, 2022. It is now read-only.

Catch CSV read error gracefully for large field limit #243

Closed
elyezer opened this issue Aug 29, 2017 · 1 comment
Closed

Catch CSV read error gracefully for large field limit #243

elyezer opened this issue Aug 29, 2017 · 1 comment
Assignees
Milestone

Comments

@elyezer
Copy link

elyezer commented Aug 29, 2017

Specify type:

  • Enhancement

Description:

rho fact encrypt will re-encrypt the facts every time its run, would be better to avoid that and print a message stating that those facts are already encrypted?

Eventually it will raise an exception if re-encrypted multiple time:

$ rho fact encrypt --reportfile report.csv  # run this 5 times
Please enter your encryption password: 
Fact connection.host encrypted
Fact connection.port encrypted
Fact uname.hostname encrypted
Fact uname.all encrypted

$ rho fact encrypt --reportfile report.csv
Please enter your encryption password: 
Traceback (most recent call last):
  File "/home/elyezer/.virtualenvs/camayoc/bin/rho", line 6, in <module>
    exec(compile(open(__file__).read(), __file__, 'exec'))
  File "/home/elyezer/code/rho/bin/rho", line 28, in <module>
    CLI().main()
  File "/home/elyezer/code/rho/rho/cli.py", line 139, in main
    cmd.main()
  File "/home/elyezer/code/rho/rho/clicommand.py", line 93, in main
    self._do_command()
  File "/home/elyezer/code/rho/rho/factencryptcommand.py", line 114, in _do_command
    keys, data = self.read_and_encrypt(normalized_path, vault)
  File "/home/elyezer/code/rho/rho/factencryptcommand.py", line 92, in read_and_encrypt
    for row in reader:
  File "/usr/lib64/python3.6/csv.py", line 112, in __next__
    row = next(self.reader)
_csv.Error: field larger than field limit (131072)

Version of rho:

6409363

@chambridge
Copy link

@elyezer I don't think we need to prevent the user from doing this over and over. Its strange use case. Also less likely now that we have an outputfile.

I do think that this could be converted to a low severity bug. We should catch the _csv.Error and fail gracefully instead with something like CSV file input could not be read.

@chambridge chambridge changed the title Would be better to avoid re-encrypting the facts? Catch CSV read error gracefully for large field limit Aug 30, 2017
@chambridge chambridge added this to On Deck in RHO 2.0 Aug 30, 2017
@chambridge chambridge self-assigned this Aug 31, 2017
@chambridge chambridge added this to the Sprint 5 milestone Aug 31, 2017
@chambridge chambridge moved this from On Deck to In Progress in RHO 2.0 Aug 31, 2017
@noahl noahl moved this from In Progress to Done in RHO 2.0 Aug 31, 2017
@chambridge chambridge removed this from Done in RHO 2.0 Sep 5, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants