Skip to content

Commit

Permalink
Fix couple of logs
Browse files Browse the repository at this point in the history
  • Loading branch information
r0x0d committed Apr 12, 2024
1 parent 3ad3a32 commit 66fe039
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions scripts/c2r_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,13 @@ def delete(self):

def restore(self):
"""Restores file backup (rename). Returns True if restored, otherwise False."""
file_path = os.path.join(self.path, self.backup_suffix)
try:
logger.info("Restoring backed up file %s.", (self.path + self.backup_suffix))
os.rename(self.path + self.backup_suffix, self.path)
print("File restored (%s)." % (self.path))
logger.info("Restoring backed up file %s.", file_path)
os.rename(file_path, self.path)
logger.info("File restored (%s).", self.path)
except OSError as err:
logger.warning("Failed to restore %s (%s)" % (self.path + self.backup_suffix, err))
logger.warning("Failed to restore %s:\n %s", file_path, err)
return False
return True

Expand All @@ -132,7 +133,7 @@ def backup(self):
os.rename(self.path, self.path + self.backup_suffix)
print("Back up created (%s)." % (self.path + self.backup_suffix))
except OSError as err:
logger.warning("Failed to create back up of %s (%s)" % (self.path, err))
logger.warning("Failed to create back up of %s (%s)", self.path, err)
return False
return True

Expand Down Expand Up @@ -616,7 +617,7 @@ def run_convert2rhel():
"""
Run the convert2rhel tool assigning the correct environment variables.
"""
logger.info("Running Convert2RHEL %s" % SCRIPT_TYPE.title())
logger.info("Running Convert2RHEL %s", (SCRIPT_TYPE.title()))
env = os.environ

for key in env:
Expand Down

0 comments on commit 66fe039

Please sign in to comment.