diff options
author | Lars Wirzenius <liw@liw.fi> | 2021-07-27 16:53:19 +0000 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2021-07-27 16:53:19 +0000 |
commit | da983483a853c672fc1238a36eafb66b79dcbe4a (patch) | |
tree | bfa88ff7aba022bf09ce4cae333fa36e7ba5e9ae /puomi.py | |
parent | 56671321dbd662fa3f2babdfdbf59f3287f5533b (diff) | |
parent | 91a5fef528e998939860f5bff93f18d4723bbdfd (diff) | |
download | puomi-da983483a853c672fc1238a36eafb66b79dcbe4a.tar.gz |
Merge branch 'proto' into 'main'
feat: add scripts + infra for setting up nested VMs for routers
See merge request larswirzenius/puomi!3
Diffstat (limited to 'puomi.py')
-rw-r--r-- | puomi.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/puomi.py b/puomi.py new file mode 100644 index 0000000..921ff27 --- /dev/null +++ b/puomi.py @@ -0,0 +1,24 @@ +import logging +import os +import shutil + + +def env_setup(ctx): + logging.info("setting up test directory for router testing") + + srcdir = globals()["srcdir"] + ssh = os.path.join(srcdir, "env", "ssh") + dst = os.path.join(os.getcwd(), ".ssh") + + logging.debug(f"copy {ssh} to {dst}") + shutil.copytree(ssh, dst) + + # The config refers to ssh/ed25519 as the key to use. However, the + # directory is actually .ssh here so that the SSH client finds it + # automatically. Create a symlink so both forms work. + os.symlink(".ssh", "ssh") + + # Set permissions on the key files, so that the SSH client isn't upset if + # they're lax. + os.chmod(".ssh/ed25519", 0o600) + os.chmod(".ssh/ed25519.pub", 0o600) |