mirror of
https://github.com/thegeeklab/ansible-later.git
synced 2024-11-22 12:50:42 +00:00
fix file classification error if file is a binary
This commit is contained in:
parent
6206dd968c
commit
86ffffd8e1
@ -82,16 +82,16 @@ class Result(object):
|
|||||||
class Candidate(object):
|
class Candidate(object):
|
||||||
def __init__(self, filename):
|
def __init__(self, filename):
|
||||||
self.path = filename
|
self.path = filename
|
||||||
|
self.binary = False
|
||||||
|
self.vault = False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.version = find_version(filename)
|
self.version = find_version(filename)
|
||||||
self.binary = False
|
|
||||||
except UnicodeDecodeError:
|
|
||||||
self.binary = True
|
|
||||||
|
|
||||||
self.vault = False
|
|
||||||
with codecs.open(filename, mode='rb', encoding='utf-8') as f:
|
with codecs.open(filename, mode='rb', encoding='utf-8') as f:
|
||||||
if f.readline().startswith("$ANSIBLE_VAULT"):
|
if f.readline().startswith("$ANSIBLE_VAULT"):
|
||||||
self.vault = True
|
self.vault = True
|
||||||
|
except UnicodeDecodeError:
|
||||||
|
self.binary = True
|
||||||
|
|
||||||
self.filetype = type(self).__name__.lower()
|
self.filetype = type(self).__name__.lower()
|
||||||
self.expected_version = True
|
self.expected_version = True
|
||||||
|
Loading…
Reference in New Issue
Block a user