mirror of
https://github.com/thegeeklab/ansible-later.git
synced 2024-11-22 04:40:42 +00:00
fix file classification error if file is a binary
This commit is contained in:
parent
6206dd968c
commit
86ffffd8e1
@ -82,17 +82,17 @@ 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
|
with codecs.open(filename, mode='rb', encoding='utf-8') as f:
|
||||||
|
if f.readline().startswith("$ANSIBLE_VAULT"):
|
||||||
|
self.vault = True
|
||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
self.binary = True
|
self.binary = True
|
||||||
|
|
||||||
self.vault = False
|
|
||||||
with codecs.open(filename, mode='rb', encoding='utf-8') as f:
|
|
||||||
if f.readline().startswith("$ANSIBLE_VAULT"):
|
|
||||||
self.vault = 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