fix tests

This commit is contained in:
Martin Sehnoutka 2019-07-17 14:07:32 +02:00 committed by Lars Karlitski
parent 23680736bb
commit 1f9752ef0f
2 changed files with 77 additions and 7 deletions

69
test/4-all.json Normal file
View file

@ -0,0 +1,69 @@
{
"name": "all",
"stages": [
{
"name": "io.weldr.dnf",
"systemResourcesFromEtc": ["/etc/pki"],
"options": {
"releasever": "30",
"repos": {
"fedora": {
"name": "Fedora",
"metalink": "https://mirrors.fedoraproject.org/metalink?repo=fedora-$releasever&arch=$basearch",
"gpgkey": "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch"
}
},
"packages": [
"@Core",
"selinux-policy-targeted",
"grub2-pc"
]
}
},
{
"name": "io.weldr.script",
"options": {
"script": "echo root | passwd --stdin root; echo 'SELINUX=disabled' > /etc/selinux/config;"
}
},
{
"name": "io.weldr.script",
"options": {
"script": "mkdir -p /var/web; echo 'hello, world!' > /var/web/index; echo -e \"[Unit]\\nDescription=Testing web server\\nAfter=network.target\\n\\n[Service]\\nType=simple\\nExecStart=python3 -m http.server 8888\\nWorkingDirectory=/var/web/\\n\\n[Install]\\nWantedBy=multi-user.target\" > /etc/systemd/system/web-server.service;"
}
},
{
"name": "io.weldr.systemd",
"options": {
"enabled_services": [
"NetworkManager",
"web-server"
],
"disabled_services": [
"firewalld"
]
}
},
{
"name": "io.weldr.grub2",
"systemResourcesFromEtc": [
"/etc/grub.d"
],
"options": {
"root_fs_uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
"partition_table_id": "0xdeadbeef"
}
}
],
"assembler": {
"name": "io.weldr.qcow2",
"systemResourcesFromEtc": [
"/etc/grub.d"
],
"options": {
"filename": "base.qcow2",
"root_fs_uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
"partition_table_id": "0xdeadbeef"
}
}
}

View file

@ -12,7 +12,7 @@ BOLD = "\033[1m"
RED = "\033[31m"
OBJECTS = os.environ.get("OBJECTS", tempfile.mkdtemp(prefix="osbuild-"))
OUTPUT_DIR = os.environ.get("OUTPUT_DIR", tempfile.mkdtemp(prefix="osbuild-"))
OSBUILD = os.environ.get("OSBUILD", os.path.join(os.path.dirname(__file__), "..", "osbuild"))
OSBUILD = os.environ.get("OSBUILD", "osbuild")
IMAGE_PATH = os.environ.get("IMAGE_PATH", OUTPUT_DIR + "/base.qcow2")
@ -40,12 +40,13 @@ def rel_path(fname: str) -> str:
def build_web_server_image():
run_osbuild(rel_path("1-create-base.json"))
r = run_osbuild(rel_path("2-configure-web-server.json"), check=False)
# TODO: remove this workaround once the grub2 stage works on the first try :-)
if r != 0:
run_osbuild(rel_path("2-configure-web-server.json"))
run_osbuild(rel_path("3-compose-qcow2.json"))
run_osbuild(rel_path("4-all.json"))
# run_osbuild(rel_path("1-create-base.json"))
# r = run_osbuild(rel_path("2-configure-web-server.json"), check=False)
# # TODO: remove this workaround once the grub2 stage works on the first try :-)
# if r != 0:
# run_osbuild(rel_path("2-configure-web-server.json"))
# run_osbuild(rel_path("3-compose-qcow2.json"))
def uname() -> str: