also typecheck tasks

This commit is contained in:
Jörg Thalheim 2023-08-12 14:45:36 +02:00
parent 7defcc7fca
commit d004aea1a8
2 changed files with 22 additions and 6 deletions

View File

@ -17,6 +17,22 @@
programs.terraform.enable = true;
programs.mypy.enable = true;
programs.mypy.directories = {
"tasks" = {
directory = ".";
modules = [ ];
files = [ "**/tasks.py" ];
extraPythonPackages = [
pkgs.python3.pkgs.deploykit
(pkgs.python3.pkgs.buildPythonPackage rec {
pname = "types-invoke";
version = "2.0.0.9";
src = pkgs.python3.pkgs.fetchPypi {
inherit pname version;
hash = "sha256-5l+xnf3ZIztpwhoPK7mnm1FwWggVfc7O2TFnKGQsbds=";
};
})
];
};
"eve/modules/buildbot" = { };
"eva/modules/prometheus" = { };
"openwrt" = { };

View File

@ -75,7 +75,7 @@ def deploy_nixos(hosts: List[DeployHost]) -> None:
@task
def update_sops_files(c):
def update_sops_files(c: Any) -> None:
"""
Update all sops yaml and json files according to .sops.yaml rules
"""
@ -88,7 +88,7 @@ def update_sops_files(c):
@task
def generate_password(c, user="root"):
def generate_password(c: Any, user: str = "root") -> None:
"""
Generate password hashes for users i.e. for root in ./hosts/$HOSTNAME.yml
"""
@ -163,7 +163,7 @@ def generate_password(c, user="root"):
@task
def reboot_and_decrypt(c, hosts: str = "") -> None:
def reboot_and_decrypt(c: Any, hosts: str = "") -> None:
"""
Reboot hosts and decrypt secrets
"""
@ -191,7 +191,7 @@ def reboot_and_decrypt(c, hosts: str = "") -> None:
stdout=subprocess.PIPE,
).stdout.strip()
eve_initrd.run("zpool import -a")
eve_initrd.run(f'echo "{pw}" | zfs load-key -a', input=pw)
eve_initrd.run(f'echo "{pw}" | zfs load-key -a')
eve_initrd.run(f'echo "{pw}" | zfs load-key -a')
eve_initrd.run("touch /root/decrypted")
@ -420,7 +420,7 @@ def update_nixpkgs(c: Any) -> None:
@task
def reboot(c: Any, hosts) -> None:
def reboot(c: Any, hosts: str) -> None:
"""
Reboot hosts. example usage: fab --hosts clara.r,donna.r reboot
"""
@ -439,7 +439,7 @@ def reboot(c: Any, hosts) -> None:
@task
def cleanup_gcroots(c: Any, hosts) -> None:
def cleanup_gcroots(c: Any, hosts: str) -> None:
deploy_hosts = [DeployHost(h) for h in hosts.split(",")]
for h in deploy_hosts:
g = DeployGroup([h])