def download_executable(self):
"""
Downloads the executable file
:return: None
"""
# noinspection PyBroadException
try:
self.logger.info("Downloading executable file")
with open(self.executable_file, 'wb') as destination:
data = requests.get(self.define_executable_file_url()).content
destination.write(data)
self.logger.info("Download Complete")
# Set executable permissions
st = os.stat(self.executable_file)
os.chmod(self.executable_file, st.st_mode | stat.S_IEXEC)
except Exception as e:
self.logger.error(
"Could not download executable. Disabling Service.")
self.logger.debug("Cause of download failure: " + str(e))
if os.path.isfile(self.executable_file):
os.remove(self.executable_file)
评论列表
文章目录