Skip to content

Commit

Permalink
Error fix in loki-upgrader
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Roth committed Apr 14, 2018
1 parent 6c68ad4 commit a29da1f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/lokilogger.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import socket
from helpers import removeNonAsciiDrop

__version__ = '0.27.5'
__version__ = '0.28.0'

# Logger Class -----------------------------------------------------------------
class LokiLogger():
Expand Down
15 changes: 12 additions & 3 deletions loki-upgrader.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,22 @@ def update_loki(self):

try:
# Create file if not present
os.makedirs(os.path.basename(targetFile))
if not os.path.exists(os.path.dirname(targetFile)):
os.makedirs(os.path.dirname(targetFile))
except Exception as e:
if self.debug:
self.logger.log("DEBUG", "Upgrader", "Cannot create dir name '%s'" % os.path.dirname(targetFile))
traceback.print_exc()

try:
# Create target file
target = file(targetFile, "wb")
with source, target:
shutil.copyfileobj(source, target)
shutil.copyfileobj(source, target)
if self.debug:
self.logger.log("DEBUG", "Upgrader", "Successfully extracted '%s'" % targetFile)
except Exception as e:
self.logger.log("ERROR", "Upgrader", "Cannot extract %s" % targetFile)
self.logger.log("ERROR", "Upgrader", "Cannot extract '%s'" % targetFile)
if self.debug:
traceback.print_exc()

Expand Down

0 comments on commit a29da1f

Please sign in to comment.