Skip to content

Commit

Permalink
Add miraclelinux support (#1128)
Browse files Browse the repository at this point in the history
  • Loading branch information
tSU-RooT authored Dec 7, 2021
1 parent cd40789 commit 0ed00ad
Show file tree
Hide file tree
Showing 15 changed files with 70 additions and 16 deletions.
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 />openEuler<br />RHEL/CentOS/AlmaLinux/Rocky/PhotonOS/Virtuozzo/EuroLinux/CloudLinux<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 />VMware<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 />openEuler<br />RHEL/CentOS/AlmaLinux/Rocky/PhotonOS/Virtuozzo/EuroLinux/CloudLinux/MIRACLE LINUX<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 />VMware<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />|

## To start developing cloud-init

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

NTP_CLIENT_CONFIG = {
'chrony': {
Expand Down
2 changes: 1 addition & 1 deletion cloudinit/config/cc_yum_add_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
**Module frequency:** always
**Supported distros:** almalinux, centos, cloudlinux, eurolinux, fedora,
openEuler, photon, rhel, rocky, virtuozzo
miraclelinux, openEuler, photon, rhel, rocky, virtuozzo
**Config keys**::
Expand Down
3 changes: 2 additions & 1 deletion cloudinit/distros/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@
'freebsd': ['freebsd'],
'gentoo': ['gentoo'],
'redhat': ['almalinux', 'amazon', 'centos', 'cloudlinux', 'eurolinux',
'fedora', 'openEuler', 'photon', 'rhel', 'rocky', 'virtuozzo'],
'fedora', 'miraclelinux', 'openEuler', 'photon', 'rhel',
'rocky', 'virtuozzo'],
'suse': ['opensuse', 'sles'],
}

Expand Down
8 changes: 8 additions & 0 deletions cloudinit/distros/miraclelinux.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# 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
3 changes: 2 additions & 1 deletion cloudinit/net/sysconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@

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


Expand Down
4 changes: 2 additions & 2 deletions cloudinit/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,8 +540,8 @@ def _get_variant(info):
linux_dist = info['dist'][0].lower()
if linux_dist in (
'almalinux', 'alpine', 'arch', 'centos', 'cloudlinux',
'debian', 'eurolinux', 'fedora', 'openeuler', 'photon',
'rhel', 'rocky', 'suse', 'virtuozzo'):
'debian', 'eurolinux', 'fedora', 'miraclelinux', 'openeuler',
'photon', 'rhel', 'rocky', 'suse', 'virtuozzo'):
variant = linux_dist
elif linux_dist in ('ubuntu', 'linuxmint', 'mint'):
variant = 'ubuntu'
Expand Down
6 changes: 3 additions & 3 deletions config/cloud.cfg.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ disable_root: true
{% endif %}

{% if variant in ["almalinux", "alpine", "amazon", "centos", "cloudlinux", "eurolinux",
"fedora", "openEuler", "rhel", "rocky", "virtuozzo"] %}
"fedora", "miraclelinux", "openEuler", "rhel", "rocky", "virtuozzo"] %}
mount_default_fields: [~, ~, 'auto', 'defaults,nofail', '0', '2']
{% if variant == "amazon" %}
resize_rootfs: noblock
Expand Down Expand Up @@ -176,7 +176,7 @@ cloud_final_modules:
system_info:
# This will affect which distro class gets used
{% if variant in ["almalinux", "alpine", "amazon", "arch", "centos", "cloudlinux", "debian",
"eurolinux", "fedora", "freebsd", "netbsd", "openbsd", "openEuler",
"eurolinux", "fedora", "freebsd", "netbsd", "miraclelinux", "openbsd", "openEuler",
"photon", "rhel", "rocky", "suse", "ubuntu", "virtuozzo"] %}
distro: {{ variant }}
{% elif variant in ["dragonfly"] %}
Expand Down Expand Up @@ -231,7 +231,7 @@ system_info:
security: http://ports.ubuntu.com/ubuntu-ports
ssh_svcname: ssh
{% elif variant in ["almalinux", "alpine", "amazon", "arch", "centos", "cloudlinux", "eurolinux",
"fedora", "openEuler", "rhel", "rocky", "suse", "virtuozzo"] %}
"fedora", "miraclelinux", "openEuler", "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 systemd/cloud-init-generator.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ default() {
check_for_datasource() {
local ds_rc=""
{% if variant in ["almalinux", "centos", "cloudlinux", "eurolinux", "fedora",
"openEuler", "rhel", "rocky", "virtuozzo"] %}
"miraclelinux", "openEuler", "rhel", "rocky", "virtuozzo"] %}
local dsidentify="/usr/libexec/cloud-init/ds-identify"
{% else %}
local dsidentify="/usr/lib/cloud-init/ds-identify"
Expand Down
2 changes: 1 addition & 1 deletion systemd/cloud-init.service.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ After=systemd-networkd-wait-online.service
After=networking.service
{% endif %}
{% if variant in ["almalinux", "centos", "cloudlinux", "eurolinux", "fedora",
"openEuler", "rhel", "rocky", "virtuozzo"] %}
"miraclelinux", "openEuler", "rhel", "rocky", "virtuozzo"] %}
After=network.service
After=NetworkManager.service
{% endif %}
Expand Down
5 changes: 3 additions & 2 deletions tests/unittests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,9 @@ def test_wb_devel_schema_subcommand_doc_all_spot_check(self):
"**Supported distros:** all",
(
"**Supported distros:** almalinux, alpine, centos, "
"cloudlinux, debian, eurolinux, fedora, openEuler, "
"opensuse, photon, rhel, rocky, sles, ubuntu, virtuozzo"
"cloudlinux, debian, eurolinux, fedora, miraclelinux, "
"openEuler, opensuse, photon, rhel, rocky, sles, ubuntu, "
"virtuozzo"
),
"**Config schema**:\n **resize_rootfs:** "
"(true/false/noblock)",
Expand Down
38 changes: 38 additions & 0 deletions tests/unittests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,25 @@
"""
)

OS_RELEASE_MIRACLELINUX_8 = dedent(
"""\
NAME="MIRACLE LINUX"
VERSION="8.4 (Peony)"
ID="miraclelinux"
ID_LIKE="rhel fedora"
PLATFORM_ID="platform:el8"
VERSION_ID="8"
PRETTY_NAME="MIRACLE LINUX 8.4 (Peony)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:cybertrust_japan:miracle_linux:8"
HOME_URL="https://www.cybertrust.co.jp/miracle-linux/"
DOCUMENTATION_URL="https://www.miraclelinux.com/support/miraclelinux8"
BUG_REPORT_URL="https://bugzilla.asianux.com/"
MIRACLELINUX_SUPPORT_PRODUCT="MIRACLE LINUX"
MIRACLELINUX_SUPPORT_PRODUCT_VERSION="8"
"""
)

OS_RELEASE_ROCKY_8 = dedent(
"""\
NAME="Rocky Linux"
Expand Down Expand Up @@ -255,6 +274,7 @@
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_MIRACLELINUX_8 = "MIRACLE LINUX release 8.4 (Peony)"
REDHAT_RELEASE_ROCKY_8 = "Rocky Linux release 8.3 (Green Obsidian)"
REDHAT_RELEASE_VIRTUOZZO_8 = "Virtuozzo Linux release 8"
REDHAT_RELEASE_CLOUDLINUX_8 = "CloudLinux release 8.4 (Valery Rozhdestvensky)"
Expand Down Expand Up @@ -754,6 +774,24 @@ def test_get_linux_eurolinux8_osrelease(self, m_os_release, m_path_exists):
dist = util.get_linux_distro()
self.assertEqual(('eurolinux', '8.4', 'Vaduz'), dist)

@mock.patch('cloudinit.util.load_file')
def test_get_linux_miraclelinux8_rhrelease(self, m_os_release,
m_path_exists):
"""Verify miraclelinux 8 read from redhat-release."""
m_os_release.return_value = REDHAT_RELEASE_MIRACLELINUX_8
m_path_exists.side_effect = TestGetLinuxDistro.redhat_release_exists
dist = util.get_linux_distro()
self.assertEqual(('miracle', '8.4', 'Peony'), dist)

@mock.patch('cloudinit.util.load_file')
def test_get_linux_miraclelinux8_osrelease(self, m_os_release,
m_path_exists):
"""Verify miraclelinux 8 read from os-release."""
m_os_release.return_value = OS_RELEASE_MIRACLELINUX_8
m_path_exists.side_effect = TestGetLinuxDistro.os_release_exists
dist = util.get_linux_distro()
self.assertEqual(('miraclelinux', '8', 'Peony'), 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
1 change: 1 addition & 0 deletions tools/.github-cla-signers
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ timothegenzmer
tnt-dev
tomponline
tsanghan
tSU-RooT
vteratipally
Vultaire
WebSpider
Expand Down
4 changes: 4 additions & 0 deletions tools/read-dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ DEFAULT_REQUIREMENTS = 'requirements.txt'
DISTRO_PKG_TYPE_MAP = {
'centos': 'redhat',
'eurolinux': 'redhat',
'miraclelinux': 'redhat',
'rocky': 'redhat',
'redhat': 'redhat',
'debian': 'debian',
Expand Down Expand Up @@ -70,12 +71,14 @@ DRY_DISTRO_INSTALL_PKG_CMD = {
'rocky': ['yum', 'install', '--assumeyes'],
'centos': ['yum', 'install', '--assumeyes'],
'eurolinux': ['yum', 'install', '--assumeyes'],
'miraclelinux': ['yum', 'install', '--assumeyes'],
'redhat': ['yum', 'install', '--assumeyes'],
}

DISTRO_INSTALL_PKG_CMD = {
'rocky': MAYBE_RELIABLE_YUM_INSTALL,
'eurolinux': MAYBE_RELIABLE_YUM_INSTALL,
'miraclelinux': MAYBE_RELIABLE_YUM_INSTALL,
'centos': MAYBE_RELIABLE_YUM_INSTALL,
'redhat': MAYBE_RELIABLE_YUM_INSTALL,
'debian': ['apt', 'install', '-y'],
Expand All @@ -89,6 +92,7 @@ DISTRO_INSTALL_PKG_CMD = {
CI_SYSTEM_BASE_PKGS = {
'common': ['make', 'sudo', 'tar'],
'eurolinux': ['python3-tox'],
'miraclelinux': ['python3-tox'],
'redhat': ['python3-tox'],
'centos': ['python3-tox'],
'ubuntu': ['devscripts', 'python3-dev', 'libssl-dev', 'tox', 'sbuild'],
Expand Down
2 changes: 1 addition & 1 deletion tools/render-cloudcfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import os
import sys

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


Expand Down

0 comments on commit 0ed00ad

Please sign in to comment.