Skip to content

Commit

Permalink
Merge pull request #1903 from bboozzoo/bboozzoo/log-dir-owner-in-snap
Browse files Browse the repository at this point in the history
subiquitycore/log: use 'root' as group for strictly confined snaps
  • Loading branch information
dbungert authored Feb 5, 2024
2 parents 53180bb + 5c266cc commit fa8cc03
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion subiquitycore/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,14 @@ def setup_logger(dir, base="subiquity"):
os.makedirs(dir, exist_ok=True)
# Create the log directory in such a way that users in the group may
# write to this directory in the installation environment.
set_log_perms(dir, mode=0o770, group="adm")
log_dir_group = "adm"
if os.getenv("SNAP_CONFINEMENT", "classic") == "strict":
# strictly confined snaps are peculiar in the way that we will not be
# able to chown the location as any other group than 'root', this if
# fine though as the snap is already run as the root user and
# effectively the logs location will be more closed
log_dir_group = "root"
set_log_perms(dir, mode=0o770, group=log_dir_group)

logger = logging.getLogger("")
logger.setLevel(logging.DEBUG)
Expand Down

0 comments on commit fa8cc03

Please sign in to comment.