update logging

This commit is contained in:
Wes Barnett 2021-04-15 20:20:48 -04:00
parent ecd19a6705
commit 5271109cc4
No known key found for this signature in database
GPG key ID: 1070BCC98C18BD66
2 changed files with 5 additions and 31 deletions

View file

@ -1,28 +0,0 @@
# snap-pac
# https://github.com/wesbarnett/snap-pac
# Copyright (C) 2016, 2017, 2018 James W. Barnett
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
[Trigger]
Operation = Install
Type = Package
Target = snap-pac
[Action]
Description = You are installing snap-pac, so no post transaction snapshots will be taken.
Depends = snap-pac
When = PostTransaction
Exec = /usr/bin/true

View file

@ -49,8 +49,9 @@ class SnapperCmd:
if pre_number is not None:
self.cmd.append(f"--pre-number {pre_number}")
else:
logging.warning("snapshot type specified as 'post' but no pre snapshot number passed.")
logging.warning("setting snapshot type to 'single'.")
logging.debug("snapshot type specified as 'post' but no pre snapshot number, "
"so setting snapshot type to 'single'. If installing "
"snap-pac this is normal.")
snapshot_type = "single"
self.cmd.append(f"--type {snapshot_type}")
@ -151,7 +152,8 @@ class Prefile:
pre_number = self.file.read_text()
except FileNotFoundError:
pre_number = None
logging.warning(f"prefile {self.file} not found. Ensure you have run the pre snapshot first.")
logging.debug(f"prefile {self.file} not found. Ensure you have run the pre snapshot first. "
"If installing snap-pac this is normal.")
else:
self.file.unlink()
return pre_number