Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for EuroLinux 7 && EuroLinux 8 #957

Merged
merged 2 commits into from
Aug 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ get in contact with that distribution and send them our way!

| Supported OSes | Supported Public Clouds | Supported Private Clouds |
| --- | --- | --- |
| Alpine Linux<br />ArchLinux<br />Debian<br />DragonFlyBSD<br />Fedora<br />FreeBSD<br />Gentoo Linux<br />NetBSD<br />OpenBSD<br />RHEL/CentOS/AlmaLinux/Rocky/PhotonOS/Virtuozzo<br />SLES/openSUSE<br />Ubuntu<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> | Amazon Web Services<br />Microsoft Azure<br />Google Cloud Platform<br />Oracle Cloud Infrastructure<br />Softlayer<br />Rackspace Public Cloud<br />IBM Cloud<br />DigitalOcean<br />Bigstep<br />Hetzner<br />Joyent<br />CloudSigma<br />Alibaba Cloud<br />OVH<br />OpenNebula<br />Exoscale<br />Scaleway<br />CloudStack<br />AltCloud<br />SmartOS<br />HyperOne<br />Vultr<br />Rootbox<br /> | Bare metal installs<br />OpenStack<br />LXD<br />KVM<br />Metal-as-a-Service (MAAS)<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />|
| Alpine Linux<br />ArchLinux<br />Debian<br />DragonFlyBSD<br />Fedora<br />FreeBSD<br />Gentoo Linux<br />NetBSD<br />OpenBSD<br />RHEL/CentOS/AlmaLinux/Rocky/PhotonOS/Virtuozzo/EuroLinux<br />SLES/openSUSE<br />Ubuntu<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> | Amazon Web Services<br />Microsoft Azure<br />Google Cloud Platform<br />Oracle Cloud Infrastructure<br />Softlayer<br />Rackspace Public Cloud<br />IBM Cloud<br />DigitalOcean<br />Bigstep<br />Hetzner<br />Joyent<br />CloudSigma<br />Alibaba Cloud<br />OVH<br />OpenNebula<br />Exoscale<br />Scaleway<br />CloudStack<br />AltCloud<br />SmartOS<br />HyperOne<br />Vultr<br />Rootbox<br /> | Bare metal installs<br />OpenStack<br />LXD<br />KVM<br />Metal-as-a-Service (MAAS)<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />|

## To start developing cloud-init

Expand Down
9 changes: 5 additions & 4 deletions cloudinit/config/cc_ntp.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@
frequency = PER_INSTANCE
NTP_CONF = '/etc/ntp.conf'
NR_POOL_SERVERS = 4
distros = ['almalinux', 'alpine', 'centos', 'debian', 'fedora', 'opensuse',
'photon', 'rhel', 'rocky', 'sles', 'ubuntu', 'virtuozzo']
distros = ['almalinux', 'alpine', 'centos', 'debian', 'eurolinux', 'fedora',
'opensuse', 'photon', 'rhel', 'rocky', 'sles', 'ubuntu',
'virtuozzo']

NTP_CLIENT_CONFIG = {
'chrony': {
Expand Down Expand Up @@ -405,9 +406,9 @@ def generate_server_names(distro):
# For legal reasons x.pool.sles.ntp.org does not exist,
# use the opensuse pool
pool_distro = 'opensuse'
elif distro == 'alpine':
elif distro == 'alpine' or distro == 'eurolinux':
# Alpine-specific pool (i.e. x.alpine.pool.ntp.org) does not exist
# so use general x.pool.ntp.org instead.
# so use general x.pool.ntp.org instead. The same applies to EuroLinux
pool_distro = ''

for x in range(0, NR_POOL_SERVERS):
Expand Down
8 changes: 4 additions & 4 deletions cloudinit/config/cc_yum_add_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

**Module frequency:** per always

**Supported distros:** almalinux, centos, fedora, photon, rhel, rocky,
virtuozzo
**Supported distros:** almalinux, centos, eurolinux, fedora, photon, rhel,
rocky, virtuozzo

**Config keys**::

Expand All @@ -37,8 +37,8 @@

from cloudinit import util

distros = ['almalinux', 'centos', 'fedora', 'photon', 'rhel', 'rocky',
'virtuozzo']
distros = ['almalinux', 'centos', 'eurolinux', 'fedora', 'photon', 'rhel',
'rocky', 'virtuozzo']


def _canonicalize_id(repo_id):
Expand Down
4 changes: 2 additions & 2 deletions cloudinit/distros/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
'debian': ['debian', 'ubuntu'],
'freebsd': ['freebsd'],
'gentoo': ['gentoo'],
'redhat': ['almalinux', 'amazon', 'centos', 'fedora', 'photon', 'rhel',
'rocky', 'virtuozzo'],
'redhat': ['almalinux', 'amazon', 'centos', 'eurolinux', 'fedora',
'photon', 'rhel', 'rocky', 'virtuozzo'],
'suse': ['opensuse', 'sles'],
}

Expand Down
9 changes: 9 additions & 0 deletions cloudinit/distros/eurolinux.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This file is part of cloud-init. See LICENSE file for license information.

from cloudinit.distros import rhel


class Distro(rhel.Distro):
pass

# vi: ts=4 expandtab
4 changes: 2 additions & 2 deletions cloudinit/net/sysconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
is_ipv6_addr, net_prefix_to_ipv4_mask, subnet_is_ipv6, IPV6_DYNAMIC_TYPES)

LOG = logging.getLogger(__name__)
KNOWN_DISTROS = ['almalinux', 'centos', 'fedora', 'rhel', 'rocky', 'suse',
'virtuozzo']
KNOWN_DISTROS = ['almalinux', 'centos', 'eurolinux', 'fedora', 'rhel', 'rocky',
'suse', 'virtuozzo']
NM_CFG_FILE = "/etc/NetworkManager/NetworkManager.conf"


Expand Down
Binary file removed cloudinit/tests/.test_util.py.swp
Binary file not shown.
66 changes: 66 additions & 0 deletions cloudinit/tests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,38 @@
ALMALINUX_MANTISBT_PROJECT_VERSION="8.3"
""")

OS_RELEASE_EUROLINUX_7 = dedent("""\
VERSION="7.9 (Minsk)"
ID="eurolinux"
ID_LIKE="rhel scientific centos fedora"
VERSION_ID="7.9"
PRETTY_NAME="EuroLinux 7.9 (Minsk)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:eurolinux:eurolinux:7.9:GA"
HOME_URL="http://www.euro-linux.com/"
BUG_REPORT_URL="mailto:support@euro-linux.com"
REDHAT_BUGZILLA_PRODUCT="EuroLinux 7"
REDHAT_BUGZILLA_PRODUCT_VERSION=7.9
REDHAT_SUPPORT_PRODUCT="EuroLinux"
REDHAT_SUPPORT_PRODUCT_VERSION="7.9"
""")

OS_RELEASE_EUROLINUX_8 = dedent("""\
NAME="EuroLinux"
VERSION="8.4 (Vaduz)"
ID="eurolinux"
ID_LIKE="rhel fedora centos"
VERSION_ID="8.4"
PLATFORM_ID="platform:el8"
PRETTY_NAME="EuroLinux 8.4 (Vaduz)"
ANSI_COLOR="0;34"
CPE_NAME="cpe:/o:eurolinux:eurolinux:8"
HOME_URL="https://www.euro-linux.com/"
BUG_REPORT_URL="https://github.com/EuroLinux/eurolinux-distro-bugs-and-rfc/"
REDHAT_SUPPORT_PRODUCT="EuroLinux"
REDHAT_SUPPORT_PRODUCT_VERSION="8"
""")

OS_RELEASE_ROCKY_8 = dedent("""\
NAME="Rocky Linux"
VERSION="8.3 (Green Obsidian)"
Expand Down Expand Up @@ -162,6 +194,8 @@
"Red Hat Enterprise Linux Server release 7.5 (Maipo)")
REDHAT_RELEASE_ALMALINUX_8 = (
"AlmaLinux release 8.3 (Purple Manul)")
REDHAT_RELEASE_EUROLINUX_7 = "EuroLinux release 7.9 (Minsk)"
REDHAT_RELEASE_EUROLINUX_8 = "EuroLinux release 8.4 (Vaduz)"
REDHAT_RELEASE_ROCKY_8 = (
"Rocky Linux release 8.3 (Green Obsidian)")
REDHAT_RELEASE_VIRTUOZZO_8 = (
Expand Down Expand Up @@ -581,6 +615,38 @@ def test_get_linux_almalinux8_osrelease(self, m_os_release, m_path_exists):
dist = util.get_linux_distro()
self.assertEqual(('almalinux', '8.3', 'Purple Manul'), dist)

@mock.patch('cloudinit.util.load_file')
def test_get_linux_eurolinux7_rhrelease(self, m_os_release, m_path_exists):
"""Verify eurolinux 7 read from redhat-release."""
m_os_release.return_value = REDHAT_RELEASE_EUROLINUX_7
m_path_exists.side_effect = TestGetLinuxDistro.redhat_release_exists
dist = util.get_linux_distro()
self.assertEqual(('eurolinux', '7.9', 'Minsk'), dist)

@mock.patch('cloudinit.util.load_file')
def test_get_linux_eurolinux7_osrelease(self, m_os_release, m_path_exists):
"""Verify eurolinux 7 read from os-release."""
m_os_release.return_value = OS_RELEASE_EUROLINUX_7
m_path_exists.side_effect = TestGetLinuxDistro.os_release_exists
dist = util.get_linux_distro()
self.assertEqual(('eurolinux', '7.9', 'Minsk'), dist)

@mock.patch('cloudinit.util.load_file')
def test_get_linux_eurolinux8_rhrelease(self, m_os_release, m_path_exists):
"""Verify eurolinux 8 read from redhat-release."""
m_os_release.return_value = REDHAT_RELEASE_EUROLINUX_8
m_path_exists.side_effect = TestGetLinuxDistro.redhat_release_exists
dist = util.get_linux_distro()
self.assertEqual(('eurolinux', '8.4', 'Vaduz'), dist)

@mock.patch('cloudinit.util.load_file')
def test_get_linux_eurolinux8_osrelease(self, m_os_release, m_path_exists):
"""Verify eurolinux 8 read from os-release."""
m_os_release.return_value = OS_RELEASE_EUROLINUX_8
m_path_exists.side_effect = TestGetLinuxDistro.os_release_exists
dist = util.get_linux_distro()
self.assertEqual(('eurolinux', '8.4', 'Vaduz'), dist)

@mock.patch('cloudinit.util.load_file')
def test_get_linux_rocky8_rhrelease(self, m_os_release, m_path_exists):
"""Verify rocky linux 8 read from redhat-release."""
Expand Down
4 changes: 2 additions & 2 deletions cloudinit/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,8 +547,8 @@ def system_info():
if system == "linux":
linux_dist = info['dist'][0].lower()
if linux_dist in (
'almalinux', 'alpine', 'arch', 'centos', 'debian', 'fedora',
'photon', 'rhel', 'rocky', 'suse', 'virtuozzo'):
'almalinux', 'alpine', 'arch', 'centos', 'debian', 'eurolinux',
'fedora', 'photon', 'rhel', 'rocky', 'suse', 'virtuozzo'):
var = linux_dist
elif linux_dist in ('ubuntu', 'linuxmint', 'mint'):
var = 'ubuntu'
Expand Down
12 changes: 6 additions & 6 deletions config/cloud.cfg.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ disable_root: false
disable_root: true
{% endif %}

{% if variant in ["almalinux", "alpine", "amazon", "centos", "fedora",
"rhel", "rocky", "virtuozzo"] %}
{% if variant in ["almalinux", "alpine", "amazon", "centos", "eurolinux",
"fedora", "rhel", "rocky", "virtuozzo"] %}
mount_default_fields: [~, ~, 'auto', 'defaults,nofail', '0', '2']
{% if variant == "amazon" %}
resize_rootfs: noblock
Expand Down Expand Up @@ -174,8 +174,8 @@ cloud_final_modules:
system_info:
# This will affect which distro class gets used
{% if variant in ["almalinux", "alpine", "amazon", "arch", "centos", "debian",
"fedora", "freebsd", "netbsd", "openbsd", "photon", "rhel",
"rocky", "suse", "ubuntu", "virtuozzo"] %}
"eurolinux", "fedora", "freebsd", "netbsd", "openbsd",
"photon", "rhel", "rocky", "suse", "ubuntu", "virtuozzo"] %}
distro: {{ variant }}
{% elif variant in ["dragonfly"] %}
distro: dragonflybsd
Expand Down Expand Up @@ -228,8 +228,8 @@ system_info:
primary: http://ports.ubuntu.com/ubuntu-ports
security: http://ports.ubuntu.com/ubuntu-ports
ssh_svcname: ssh
{% elif variant in ["almalinux", "alpine", "amazon", "arch", "centos", "fedora",
"rhel", "rocky", "suse", "virtuozzo"] %}
{% elif variant in ["almalinux", "alpine", "amazon", "arch", "centos", "eurolinux",
"fedora", "rhel", "rocky", "suse", "virtuozzo"] %}
# Default user name + that default users groups (if added/used)
default_user:
{% if variant == "amazon" %}
Expand Down
2 changes: 1 addition & 1 deletion doc/rtd/topics/availability.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ OpenBSD and DragonFlyBSD:
- NetBSD
- OpenBSD
- Photon OS
- RHEL/CentOS
- RHEL/CentOS/AlmaLinux/Rocky Linux/EuroLinux
- SLES/openSUSE
- Ubuntu

Expand Down
14 changes: 14 additions & 0 deletions packages/pkg-deps.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,20 @@
"sudo"
]
},
"eurolinux" : {
"build-requires" : [
"python3-devel"
],
"requires" : [
"e2fsprogs",
"iproute",
"net-tools",
"procps",
"rsyslog",
"shadow-utils",
"sudo"
]
},
"redhat" : {
"build-requires" : [
"python3-devel"
Expand Down
3 changes: 2 additions & 1 deletion systemd/cloud-init-generator.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ default() {

check_for_datasource() {
local ds_rc=""
{% if variant in ["almalinux", "rhel", "fedora", "centos", "rocky", "virtuozzo"] %}
{% if variant in ["almalinux", "centos", "eurolinux", "fedora", "rhel",
"rocky", "virtuozzo"] %}
local dsidentify="/usr/libexec/cloud-init/ds-identify"
{% else %}
local dsidentify="/usr/lib/cloud-init/ds-identify"
Expand Down
3 changes: 2 additions & 1 deletion systemd/cloud-init.service.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ After=systemd-networkd-wait-online.service
{% if variant in ["ubuntu", "unknown", "debian"] %}
After=networking.service
{% endif %}
{% if variant in ["almalinux", "centos", "fedora", "rhel", "rocky", "virtuozzo"] %}
{% if variant in ["almalinux", "centos", "eurolinux", "fedora", "rhel",
"rocky", "virtuozzo"] %}
After=network.service
After=NetworkManager.service
{% endif %}
Expand Down
3 changes: 2 additions & 1 deletion tests/unittests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,8 @@ def test_wb_devel_schema_subcommand_doc_content(self):
expected_doc_sections = [
'**Supported distros:** all',
('**Supported distros:** almalinux, alpine, centos, debian, '
'fedora, opensuse, photon, rhel, rocky, sles, ubuntu, virtuozzo'),
'eurolinux, fedora, opensuse, photon, rhel, rocky, sles, ubuntu, '
'virtuozzo'),
'**Config schema**:\n **resize_rootfs:** (true/false/noblock)',
'**Examples**::\n\n runcmd:\n - [ ls, -l, / ]\n'
]
Expand Down
1 change: 1 addition & 0 deletions tests/unittests/test_net.py
Original file line number Diff line number Diff line change
Expand Up @@ -5308,6 +5308,7 @@ def test_sysconfig_available_uses_variant_mapping(self, m_distro, m_avail):
('opensuse-tumbleweed', '', ''),
('sles', '', ''),
('centos', '', ''),
('eurolinux', '', ''),
('fedora', '', ''),
('redhat', '', ''),
]
Expand Down
6 changes: 3 additions & 3 deletions tests/unittests/test_render_cloudcfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
from cloudinit import util

# TODO(Look to align with tools.render-cloudcfg or cloudinit.distos.OSFAMILIES)
DISTRO_VARIANTS = ["amazon", "arch", "centos", "debian", "fedora", "freebsd",
"netbsd", "openbsd", "photon", "rhel", "suse", "ubuntu",
"unknown"]
DISTRO_VARIANTS = ["amazon", "arch", "centos", "debian", "eurolinux", "fedora",
"freebsd", "netbsd", "openbsd", "photon", "rhel", "suse",
"ubuntu", "unknown"]


@pytest.mark.allow_subp_for(sys.executable)
Expand Down
8 changes: 6 additions & 2 deletions tools/read-dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ DEFAULT_REQUIREMENTS = 'requirements.txt'
# Map the appropriate package dir needed for each distro choice
DISTRO_PKG_TYPE_MAP = {
'centos': 'redhat',
'eurolinux': 'redhat',
'rocky': 'redhat',
'redhat': 'redhat',
'debian': 'debian',
Expand Down Expand Up @@ -68,11 +69,13 @@ ZYPPER_INSTALL = [
DRY_DISTRO_INSTALL_PKG_CMD = {
'rocky': ['yum', 'install', '--assumeyes'],
'centos': ['yum', 'install', '--assumeyes'],
'eurolinux': ['yum', 'install', '--assumeyes'],
'redhat': ['yum', 'install', '--assumeyes'],
}

DISTRO_INSTALL_PKG_CMD = {
'rocky': MAYBE_RELIABLE_YUM_INSTALL,
'eurolinux': MAYBE_RELIABLE_YUM_INSTALL,
'centos': MAYBE_RELIABLE_YUM_INSTALL,
'redhat': MAYBE_RELIABLE_YUM_INSTALL,
'debian': ['apt', 'install', '-y'],
Expand All @@ -85,6 +88,7 @@ DISTRO_INSTALL_PKG_CMD = {
# List of base system packages required to enable ci automation
CI_SYSTEM_BASE_PKGS = {
'common': ['make', 'sudo', 'tar'],
'eurolinux': ['python3-tox'],
'redhat': ['python3-tox'],
'centos': ['python3-tox'],
'ubuntu': ['devscripts', 'python3-dev', 'libssl-dev', 'tox', 'sbuild'],
Expand Down Expand Up @@ -277,10 +281,10 @@ def pkg_install(pkg_list, distro, test_distro=False, dry_run=False):
cmd = DRY_DISTRO_INSTALL_PKG_CMD[distro]
install_cmd.extend(cmd)

if distro in ['centos', 'redhat', 'rocky']:
if distro in ['centos', 'redhat', 'rocky', 'eurolinux']:
# CentOS and Redhat need epel-release to access oauthlib and jsonschema
subprocess.check_call(install_cmd + ['epel-release'])
if distro in ['suse', 'opensuse', 'redhat', 'rocky', 'centos']:
if distro in ['suse', 'opensuse', 'redhat', 'rocky', 'centos', 'eurolinux']:
pkg_list.append('rpm-build')
subprocess.check_call(install_cmd + pkg_list)

Expand Down
4 changes: 2 additions & 2 deletions tools/render-cloudcfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import os
import sys

VARIANTS = ["almalinux", "alpine", "amazon", "arch", "centos", "debian",
"fedora", "freebsd", "netbsd", "openbsd", "photon", "rhel",
"suse","rocky", "ubuntu", "unknown", "virtuozzo"]
"eurolinux", "fedora", "freebsd", "netbsd", "openbsd", "photon",
"rhel", "suse","rocky", "ubuntu", "unknown", "virtuozzo"]


if "avoid-pep8-E402-import-not-top-of-file":
Expand Down