Skip to content

Commit

Permalink
fix logs permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
VermiIIi0n committed Jul 9, 2024
1 parent 83ec2f8 commit 8e89770
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions nginx_install/installers/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,18 @@ async def install(self, ctx: Context):
rs = await ctx.run_cmd("systemctl enable nginx")
rs.raise_for_returncode()

paths = (self.error_log_path, self.http_log_path)
for p in paths:
await aio.os.makedirs(p.parent, exist_ok=True)
if not p.exists():
ctx.logger.debug("%s: Creating log file %s", self, p)
async with aio.open(p, "w") as f:
await f.write('')
ctx.logger.debug("%s: Chown %s to %s:%s",
self, p, self.user, self.group)
rs = await ctx.run_cmd(f"chown {self.user}:{self.group} {p}")
rs.raise_for_returncode()

ctx.logger.info("Nginx installation completed")
ctx.progress.update(task, advance=1)

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "nginx_install"
version = "0.1.10"
version = "0.1.11"
description = "Auto Nginx Installation"
authors = ["VermiIIi0n <[email protected]>"]
readme = "README.md"
Expand Down

0 comments on commit 8e89770

Please sign in to comment.