changeset 60:a949704defd0

new pyinfra
author drewp@bigasterisk.com
date Sun, 01 May 2022 23:31:20 -0700
parents fa7a71b8a97f
children b46df76991b6
files packages.py requirements.txt system.py tasks.py
diffstat 4 files changed, 22 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/packages.py	Sun May 01 23:30:09 2022 -0700
+++ b/packages.py	Sun May 01 23:31:20 2022 -0700
@@ -73,7 +73,7 @@
     dl = f'/tmp/kitty-{vers}-x86_64.txz'
     files.download(src=f"https://github.com/kovidgoyal/kitty/releases/download/v{vers}/kitty-{vers}-x86_64.txz",
                    dest=dl)
-    files.makedirs(local, exist_ok=True)
+    files.directory(local)
     server.shell([
         f"mkdir -p {local}",  # https://github.com/Fizzadar/pyinfra/issues/777
         f"aunpack --extract-to={local} {dl}",
--- a/requirements.txt	Sun May 01 23:30:09 2022 -0700
+++ b/requirements.txt	Sun May 01 23:31:20 2022 -0700
@@ -1,2 +1,2 @@
-pyinfra==1.7
-yapf==0.31.0
+pyinfra==2.0.2
+yapf==0.32.0
--- a/system.py	Sun May 01 23:30:09 2022 -0700
+++ b/system.py	Sun May 01 23:31:20 2022 -0700
@@ -15,12 +15,12 @@
 #
 
 files.link(path='/etc/localtime', target=f'/usr/share/zoneinfo/{TZ}')
-files.replace(path='/etc/timezone', match='.*', replace=TZ)
+files.replace(path='/etc/timezone', text='.*', replace=TZ)
 apt.packages(update=True,
              cache_time=86400,
              packages=['tzdata'],
              force=True,
-             env={
+             _env={
                  'TZ': TZ,
                  'LANG': 'en_US.UTF-8',
                  'DEBIAN_FRONTEND': 'noninteractive'
--- a/tasks.py	Sun May 01 23:30:09 2022 -0700
+++ b/tasks.py	Sun May 01 23:31:20 2022 -0700
@@ -68,8 +68,24 @@
     ctx.run(cmd + 'inventory.py mail.py ', pty=True)
 
 
-@task(pre=[users, ssh, system, packages, net, dns, wireguard, kube, sync, mail])
+@task
 def all(ctx):
+    configs = [
+        'users.py',
+        'ssh.py',
+        'system.py',
+        'packages.py',
+        'net.py',
+        'dns.py',
+        'wireguard.py',
+        'kube.py',
+        'sync.py',
+        'mail.py',
+    ]
+    # https://github.com/Fizzadar/pyinfra/issues/787
+    #ctx.run(' '.join([cmd, 'inventory.py'] + configs), pty=True)
+    for c in configs:
+        ctx.run(' '.join([cmd, 'inventory.py', c]), pty=True, warn=True)
     ctx.run('touch /my/proj/infra/ran_all.timestamp')