Skip to content

Commit

Permalink
Switch container OS to debian
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik-Lamers1 committed Oct 31, 2023
1 parent 1e5888c commit db68713
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 13 deletions.
24 changes: 15 additions & 9 deletions vnet_manager/environment/lxc.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def execute_and_log(command: str, **kwargs) -> Tuple[int, AnyStr, AnyStr]:
logger.debug("Checking for DNS connectivity")
dns = False
for _ in range(0, settings.LXC_MAX_STATUS_WAIT_ATTEMPTS):
if execute_and_log("host -t A google.com")[0] == 0:
if execute_and_log("ping -w 2 -c 1 google.com > /dev/null")[0] == 0:
dns = True
break
# No DNS connectivity (yet), try again
Expand All @@ -102,14 +102,7 @@ def execute_and_log(command: str, **kwargs) -> Tuple[int, AnyStr, AnyStr]:
machine.stop()
raise RuntimeError("Base machine started without working DNS, unable to continue")

# Set the FRR routing source and key
execute_and_log("bash -c 'curl -s https://deb.frrouting.org/frr/keys.asc | apt-key add'")
execute_and_log(
f"bash -c 'echo deb https://deb.frrouting.org/frr $(lsb_release -s -c) {settings.FRR_RELEASE} "
f"| tee -a /etc/apt/sources.list.d/frr.list'"
)

# Update and install packages
# Update and install base packages
execute_and_log("apt-get update")
execute_and_log(
"apt-get upgrade -y -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold'",
Expand All @@ -121,6 +114,19 @@ def execute_and_log(command: str, **kwargs) -> Tuple[int, AnyStr, AnyStr]:
environment={"DEBIAN_FRONTEND": "noninteractive"},
)

# Set the FRR routing source and key
execute_and_log("bash -c 'curl -s https://deb.frrouting.org/frr/keys.asc | apt-key add'")
execute_and_log(
f"bash -c 'echo deb https://deb.frrouting.org/frr $(lsb_release -s -c) {settings.FRR_RELEASE} "
f"| tee -a /etc/apt/sources.list.d/frr.list'"
)
# Install FRR packages
execute_and_log(
f"apt-get install -y -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' "
f"{' '.join(settings['PROVIDERS']['lxc']['frr_packages'])}",
environment={"DEBIAN_FRONTEND": "noninteractive"},
)

# Disable radvd by default
execute_and_log("systemctl disable radvd")
# Disable cloud init messing with our networking
Expand Down
12 changes: 8 additions & 4 deletions vnet_manager/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,24 @@
"guest_packages": [
"man", # List of packages to install on the guest
"net-tools",
"dnsutils",
"traceroute",
"nano",
"vim",
"bridge-utils",
"radvd",
"frr",
"frr-pythontools",
"vlan",
"avahi-daemon",
"avahi-utils",
"curl",
],
"frr_packages": [
"frr",
"frr-pythontools",
],
"base_image": { # Download info for the base image
"os": "20.04",
"server": "https://cloud-images.ubuntu.com/daily",
"os": "debian/12/cloud",
"server": "https://images.linuxcontainers.org/",
"protocol": "simplestreams",
},
}
Expand Down

0 comments on commit db68713

Please sign in to comment.