Make logging consistent
Make sure that apt-ostree logging is consistent. This includes remove log file highlighting. Story: 2010851 Task: 48476 Change-Id: If5687e56df6d5df555921f49ac90c783cb6614ed Signed-off-by: Charles Short <charles.short@windriver.com>
This commit is contained in:

committed by
Chuck Short

parent
96d323d3b4
commit
b876d60805
@@ -49,9 +49,8 @@ class Compose:
|
||||
sys.exit(1)
|
||||
|
||||
# Copy the existing branch from one repository to another.
|
||||
self.console.print(
|
||||
f"Pulling from {self.state.branch} to {export_dir}.",
|
||||
highlight=False)
|
||||
self.logging.info(
|
||||
f"Pulling from {self.state.branch} to {export_dir}.")
|
||||
self.ostree.ostree_pull(export_dir)
|
||||
|
||||
def restore(self, import_dir):
|
||||
@@ -62,9 +61,8 @@ class Compose:
|
||||
sys.exit(1)
|
||||
|
||||
# Copy the existing branch from one repository to another.
|
||||
self.console.print(
|
||||
f"Pulling from {self.state.branch} to {import_dir}.",
|
||||
highlight=False)
|
||||
self.logging.info(
|
||||
f"Pulling from {self.state.branch} to {import_dir}.")
|
||||
self.ostree.ostree_pull(import_dir)
|
||||
|
||||
def enablerepo(self):
|
||||
|
@@ -25,7 +25,7 @@ def setup_log(debug=False):
|
||||
'[%(levelname)s] %(message)s'))
|
||||
rootLogger.addHandler(journald_handler)
|
||||
|
||||
console = Console(highlight=False)
|
||||
console = Console(color_system=None)
|
||||
|
||||
rich_handler = RichHandler(show_path=False,
|
||||
show_time=False,
|
||||
|
@@ -37,7 +37,7 @@ class Ostree:
|
||||
|
||||
try:
|
||||
repo.create(mode)
|
||||
self.console.print("Sucessfully initialized ostree repository.")
|
||||
self.logging.info("Sucessfully initialized ostree repository.")
|
||||
except GLib.GError as e:
|
||||
self.logging.error(f"Failed to create repo: {e}")
|
||||
sys.exit(1)
|
||||
|
@@ -99,7 +99,7 @@ class Packages:
|
||||
cache = self.apt.cache(rootfs)
|
||||
|
||||
# Step 2 - Check for updates.
|
||||
self.console.print(
|
||||
self.logging.info(
|
||||
"Checking for upgradable packages."
|
||||
)
|
||||
# Fake upgrading so we can determine the packages
|
||||
@@ -133,9 +133,8 @@ class Packages:
|
||||
self.deploy.poststaging(rootfs)
|
||||
|
||||
# Step 6 - Commit to the repo
|
||||
self.console.print(
|
||||
f"Commiting to {self.ostree.get_branch()}. Please wait",
|
||||
highlight=False)
|
||||
self.logging.info(
|
||||
f"Commiting to {self.ostree.get_branch()}. Please wait")
|
||||
self.ostree.ostree_commit(
|
||||
root=str(rootfs),
|
||||
branch=self.ostree.get_branch(),
|
||||
@@ -175,9 +174,8 @@ class Packages:
|
||||
self.deploy.poststaging(rootfs)
|
||||
|
||||
# Step 6 - Ostree commit.
|
||||
self.console.print(
|
||||
f"Commiting to {self.ostree.get_branch()}. Please wait",
|
||||
highlight=False)
|
||||
self.logging.info(
|
||||
f"Commiting to {self.ostree.get_branch()}. Please wait")
|
||||
|
||||
self.ostree.ostree_commit(
|
||||
root=str(rootfs),
|
||||
|
@@ -140,8 +140,7 @@ class Repo:
|
||||
self.logging.error("Failed to disable package feed.")
|
||||
sys.exit(1)
|
||||
self.logging.info(
|
||||
f"Successfully disabled \"{self.state.sources}\".",
|
||||
highlight=False)
|
||||
f"Successfully disabled \"{self.state.sources}\".")
|
||||
self.deploy.poststaging(rootfs)
|
||||
|
||||
self.logging.info(f"Committing to {branch} to repo.")
|
||||
@@ -177,7 +176,7 @@ class Repo:
|
||||
self.logging.error("Failed to add package feed.")
|
||||
sys.exit(1)
|
||||
self.logging.info(
|
||||
f"Successfully added \"{self.state.sources}\".", highlight=False)
|
||||
f"Successfully added \"{self.state.sources}\".")
|
||||
self.deploy.poststaging(rootfs)
|
||||
|
||||
self.logging.info(f"Committing to {branch} to repo.")
|
||||
|
@@ -28,18 +28,17 @@ class RunCommand:
|
||||
|
||||
mounts = None
|
||||
if mount_points:
|
||||
self.console.print("Loading configuration.")
|
||||
self.logging.info("Loading configuration.")
|
||||
with open(mount_points, "r") as f:
|
||||
mounts = yaml.safe_load(f)
|
||||
|
||||
if pre_exec:
|
||||
self.console.print(f"Executing pre-command: {pre_exec}",
|
||||
highlight=False)
|
||||
self.logging.info(f"Executing pre-command: {pre_exec}")
|
||||
cmd = ["systemd-nspawn", "-q", "-D", rootfs]
|
||||
cmd += pre_exec.split()
|
||||
r = utils.run_command(cmd)
|
||||
if r.returncode != 0:
|
||||
self.console.print("Sucessfully executed pre-command")
|
||||
self.logging.info("Sucessfully executed pre-command")
|
||||
|
||||
# Run the systemd-nspawn command.
|
||||
cmd = ["systemd-nspawn", "-q"]
|
||||
|
Reference in New Issue
Block a user