Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Add get_encoding salt util #47581
What does this PR do?
What issues does this PR fix or reference?
Some files were being incorrectly detected as binary files by the
Detects the encoding of the file and opens the file with the detected encoding so that the read line function works correctly.
Commits signed with GPG?
I suggest a function which returns the file information.
Or salt/utils/files contains a "open" class which manages files open, backups, read, write, eol char, etc. It just takes care of it all.
@twangboy This is causing the following tests to fail:
changed the title from
Add is_encoding salt util [WIP]
Add get_encoding salt util [WIP]
May 16, 2018
Can not see any issue with the new function.
However the reason I suggest a function to return several bits of information. Is so the file examined once. For example to determine EOL the last part of the file is best place to read (e.g. last two characters of the file). If the file is under 2k then last part of the file has already been read.
The following tests are failing:
Basically open_type information on how python open should open the file, or params for python open to use. e.g. open in text or binary mode or some thing else. type would be binary or text or text-bom or something along these lines.
The orginal orginal idea I had was to have a utils.filemgt (manage files) class.