Skip to content
Snippets Groups Projects
Verified Commit 1fad0c77 authored by Nicolas KAROLAK's avatar Nicolas KAROLAK
Browse files

do install packages in tests

parent 234ea151
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import utils
packages = [
"bmon",
"curl",
"git",
"host",
"htop",
"iotop",
"ipython3",
"lm-sensors",
"make",
"net-tools",
"netcat",
"nfs-client",
"pciutils",
"pwgen",
"python3-openssl",
"python3-requests",
"python3-spf",
"smartmontools",
"vim",
]
def setup(interactive=True):
dir_path = utils.get_dir(__file__)
cmds = [
'apt-get clean',
'apt-get update',
'apt-get install --yes make ipython3 vim netcat git htop iotop bmon net-tools host lm-sensors pciutils nfs-client smartmontools pwgen curl python3-requests',
"apt-get clean",
"apt-get update",
"apt-get install --yes {}".format(" ".join(packages)),
# Locale
'locale-gen en_GB.UTF-8',
'update-locale LANG=en_GB.UTF-8 LANGUAGE=en_GB.UTF-8 LC_ALL=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8',
"locale-gen en_GB.UTF-8",
"update-locale LANG=en_GB.UTF-8 LANGUAGE=en_GB.UTF-8 LC_ALL=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8",
# Copy vimrc file
'cp "%s/vimrc" "/root/.vimrc"' % dir_path,
"cp '{}/vimrc' /root/.vimrc".format(dir_path),
# Copy bashrc file
'cp "%s/bashrc" "/root/.bashrc"' % dir_path,
"cp '{}/bashrc' /root/.bashrc".format(dir_path),
# Generate SSH key if not already done
'[ -f /root/.ssh/id_rsa ] || ssh-keygen -b 4096 -t rsa -f /root/.ssh/id_rsa -P ""',
"[ -f /root/.ssh/id_rsa ] || ssh-keygen -b 4096 -t rsa -f /root/.ssh/id_rsa -P ''",
]
utils.run_commands(cmds)
......@@ -5,23 +5,14 @@ Criticality: High
Checks that emails can be sent.
"""
from pathlib import Path
import os
from pathlib import Path
import random
import subprocess
import sys
import random
import time
# install spf lib if not present
try:
import spf
except ImportError:
subprocess.check_call(["apt-get", "-qq", "-y", "install", "python3-spf"])
import spf
# install netstat if not present
if subprocess.call(["which", "netstat"], stdout=subprocess.DEVNULL) != 0:
subprocess.check_call(["apt-get", "-qq", "-y", "install", "net-tools"])
import spf
sys.path.append(str(Path(__file__).parents[1].resolve()))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment