Skip to content

Commit

Permalink
Add missing pylint dependency, fix warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Henri Rosten <henri.rosten@unikie.com>
  • Loading branch information
henrirosten committed Nov 2, 2023
1 parent e568f38 commit d55ed4b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ pkgs.mkShell {
python3.pkgs.deploykit
python3.pkgs.invoke
python3.pkgs.pycodestyle
python3.pkgs.pylint
sops
ssh-to-age
reuse
Expand Down
18 changes: 9 additions & 9 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def opener(path: str, flags: int) -> Union[str, int]:
t.chmod(0o755)
host_key = t / "etc/ssh/ssh_host_ed25519_key"
host_key.parent.mkdir(parents=True, exist_ok=True)
with open(host_key, "w", opener=opener) as fh:
with open(host_key, "w", opener=opener, encoding="utf-8") as fh:
try:
subprocess.run(
[
Expand All @@ -224,12 +224,12 @@ def opener(path: str, flags: int) -> Union[str, int]:
)
except subprocess.CalledProcessError:
LOG.warning("Failed reading secret 'ssh_host_ed25519_key' for '%s'", target)
ask = input(f"Still continue? [y/N] ")
ask = input("Still continue? [y/N] ")
if ask != "y":
sys.exit(1)
else:
pub_key = t / "etc/ssh/ssh_host_ed25519_key.pub"
with open(pub_key, "w") as fh:
with open(pub_key, "w", encoding="utf-8") as fh:
subprocess.run(
["ssh-keygen", "-y", "-f", f"{host_key}"],
stdout=fh,
Expand Down Expand Up @@ -262,7 +262,7 @@ def install(c: Any, target: str, hostname: str) -> None:
LOG.warning(
"sudo on '%s' needs password: installation will likely fail", hostname
)
ask = input(f"Still continue? [y/N] ")
ask = input("Still continue? [y/N] ")
if ask != "y":
sys.exit(1)
# Check static ip
Expand All @@ -278,7 +278,7 @@ def install(c: Any, target: str, hostname: str) -> None:
"If you do, consider making the address temporarily static "
"before continuing."
)
ask = input(f"Still continue? [y/N] ")
ask = input("Still continue? [y/N] ")
if ask != "y":
sys.exit(1)

Expand Down Expand Up @@ -380,7 +380,7 @@ def pre_push(c: Any) -> None:
Example usage:
inv pre-push
"""
cmd = f"find . -type f -name *.py ! -path *result* ! -path *eggs*"
cmd = "find . -type f -name *.py ! -path *result* ! -path *eggs*"
ret = exec_cmd(cmd)
pyfiles = ret.stdout.replace("\n", " ")
LOG.info("Running black")
Expand All @@ -399,17 +399,17 @@ def pre_push(c: Any) -> None:
if not ret:
sys.exit(1)
LOG.info("Running reuse lint")
cmd = f"reuse lint"
cmd = "reuse lint"
ret = exec_cmd(cmd, raise_on_error=False)
if not ret:
sys.exit(1)
LOG.info("Running nix fmt")
cmd = f"nix fmt"
cmd = "nix fmt"
ret = exec_cmd(cmd, raise_on_error=False)
if not ret:
sys.exit(1)
LOG.info("Running nix flake check")
cmd = f"nix flake check"
cmd = "nix flake check"
ret = exec_cmd(cmd, raise_on_error=False)
if not ret:
sys.exit(1)
Expand Down

0 comments on commit d55ed4b

Please sign in to comment.