diff --git a/SOURCES/Add-MSVSphere-support.patch b/SOURCES/Add-MSVSphere-support.patch new file mode 100644 index 0000000..d5b454c --- /dev/null +++ b/SOURCES/Add-MSVSphere-support.patch @@ -0,0 +1,713 @@ +From f86df90a1b432eac30be88342a3be9aba9524cf8 Mon Sep 17 00:00:00 2001 +From: Eugene Zamriy +Date: Fri, 7 Jul 2023 23:41:25 +0300 +Subject: [PATCH] Add MSVSphere support + +--- + README.md | 2 +- + cloudinit/config/cc_ca_certs.py | 9 +++- + cloudinit/config/cc_ntp.py | 9 ++++ + cloudinit/config/cc_yum_add_repo.py | 3 +- + cloudinit/distros/__init__.py | 1 + + cloudinit/distros/msvsphere.py | 10 ++++ + cloudinit/net/sysconfig.py | 1 + + cloudinit/settings.py | 2 +- + cloudinit/sources/DataSourceRbxCloud.py | 2 +- + cloudinit/util.py | 1 + + config/cloud.cfg.tmpl | 6 +-- + doc/rtd/topics/availability.rst | 2 +- + packages/pkg-deps.json | 14 ++++++ + systemd/cloud-config.service.tmpl | 2 +- + systemd/cloud-final.service.tmpl | 4 +- + systemd/cloud-init-generator.tmpl | 2 +- + systemd/cloud-init-local.service.tmpl | 12 ++--- + systemd/cloud-init.service.tmpl | 6 +-- + templates/chrony.conf.msvsphere.tmpl | 45 ++++++++++++++++++ + templates/ntp.conf.msvsphere.tmpl | 61 +++++++++++++++++++++++++ + tests/unittests/test_net.py | 1 + + tests/unittests/test_render_cloudcfg.py | 1 + + tests/unittests/test_util.py | 44 ++++++++++++++++++ + tools/read-dependencies | 8 +++- + tools/render-cloudcfg | 1 + + tools/run-container | 6 +-- + 26 files changed, 228 insertions(+), 27 deletions(-) + create mode 100644 cloudinit/distros/msvsphere.py + create mode 100644 templates/chrony.conf.msvsphere.tmpl + create mode 100644 templates/ntp.conf.msvsphere.tmpl + +diff --git a/README.md b/README.md +index f2a745f..fa81a83 100644 +--- a/README.md ++++ b/README.md +@@ -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
ArchLinux
Debian
DragonFlyBSD
Fedora
FreeBSD
Gentoo Linux
NetBSD
OpenBSD
openEuler
RHEL/CentOS/AlmaLinux/Rocky/PhotonOS/Virtuozzo/EuroLinux/CloudLinux/MIRACLE LINUX
SLES/openSUSE
Ubuntu










| Amazon Web Services
Microsoft Azure
Google Cloud Platform
Oracle Cloud Infrastructure
Softlayer
Rackspace Public Cloud
IBM Cloud
DigitalOcean
Bigstep
Hetzner
Joyent
CloudSigma
Alibaba Cloud
OVH
OpenNebula
Exoscale
Scaleway
CloudStack
AltCloud
SmartOS
HyperOne
Vultr
Rootbox
| Bare metal installs
OpenStack
LXD
KVM
Metal-as-a-Service (MAAS)
VMware















| ++| Alpine Linux
ArchLinux
Debian
DragonFlyBSD
Fedora
FreeBSD
Gentoo Linux
NetBSD
OpenBSD
openEuler
RHEL/CentOS/AlmaLinux/Rocky/PhotonOS/Virtuozzo/EuroLinux/CloudLinux/MIRACLE LINUX/MSVSphere
SLES/openSUSE
Ubuntu










| Amazon Web Services
Microsoft Azure
Google Cloud Platform
Oracle Cloud Infrastructure
Softlayer
Rackspace Public Cloud
IBM Cloud
DigitalOcean
Bigstep
Hetzner
Joyent
CloudSigma
Alibaba Cloud
OVH
OpenNebula
Exoscale
Scaleway
CloudStack
AltCloud
SmartOS
HyperOne
Vultr
Rootbox
| Bare metal installs
OpenStack
LXD
KVM
Metal-as-a-Service (MAAS)
VMware















| + + ## To start developing cloud-init + +diff --git a/cloudinit/config/cc_ca_certs.py b/cloudinit/config/cc_ca_certs.py +index 6084cb4..150076b 100644 +--- a/cloudinit/config/cc_ca_certs.py ++++ b/cloudinit/config/cc_ca_certs.py +@@ -19,6 +19,13 @@ DEFAULT_CONFIG = { + "ca_cert_update_cmd": ["update-ca-certificates"], + } + DISTRO_OVERRIDES = { ++ "msvsphere": { ++ "ca_cert_path": "/usr/share/pki/ca-trust-source/", ++ "ca_cert_filename": "anchors/cloud-init-ca-certs.crt", ++ "ca_cert_config": None, ++ "ca_cert_system_path": "/etc/pki/ca-trust/", ++ "ca_cert_update_cmd": ["update-ca-trust"], ++ }, + "rhel": { + "ca_cert_path": "/usr/share/pki/ca-trust-source/", + "ca_cert_filename": "anchors/cloud-init-ca-certs.crt", +@@ -43,7 +50,7 @@ can be removed from the system with the configuration option + ca-certificates package is installed but not if the + ca-certificates-bundle package is installed. + """ +-distros = ["alpine", "debian", "ubuntu", "rhel"] ++distros = ["alpine", "debian", "ubuntu", "msvsphere", "rhel"] + + meta: MetaSchema = { + "id": "cc_ca_certs", +diff --git a/cloudinit/config/cc_ntp.py b/cloudinit/config/cc_ntp.py +index 25bba76..6de1d85 100644 +--- a/cloudinit/config/cc_ntp.py ++++ b/cloudinit/config/cc_ntp.py +@@ -33,6 +33,7 @@ distros = [ + "eurolinux", + "fedora", + "miraclelinux", ++ "msvsphere", + "openEuler", + "opensuse", + "photon", +@@ -96,6 +97,14 @@ DISTRO_CLIENT_CONFIG = { + "confpath": "/etc/chrony/chrony.conf", + }, + }, ++ "msvsphere": { ++ "ntp": { ++ "service_name": "ntpd", ++ }, ++ "chrony": { ++ "service_name": "chronyd", ++ }, ++ }, + "opensuse": { + "chrony": { + "service_name": "chronyd", +diff --git a/cloudinit/config/cc_yum_add_repo.py b/cloudinit/config/cc_yum_add_repo.py +index 7a23268..58e938e 100644 +--- a/cloudinit/config/cc_yum_add_repo.py ++++ b/cloudinit/config/cc_yum_add_repo.py +@@ -19,7 +19,7 @@ entry, the config entry will be skipped. + **Module frequency:** always + + **Supported distros:** almalinux, centos, cloudlinux, eurolinux, fedora, +- miraclelinux, openEuler, photon, rhel, rocky, virtuozzo ++ miraclelinux, msvsphere, openEuler, photon, rhel, rocky, virtuozzo + + **Config keys**:: + +@@ -43,6 +43,7 @@ distros = [ + "cloudlinux", + "eurolinux", + "fedora", ++ "msvsphere", + "openEuler", + "photon", + "rhel", +diff --git a/cloudinit/distros/__init__.py b/cloudinit/distros/__init__.py +index 76acd6a..798e428 100755 +--- a/cloudinit/distros/__init__.py ++++ b/cloudinit/distros/__init__.py +@@ -46,6 +46,7 @@ OSFAMILIES = { + "eurolinux", + "fedora", + "miraclelinux", ++ "msvsphere", + "openEuler", + "photon", + "rhel", +diff --git a/cloudinit/distros/msvsphere.py b/cloudinit/distros/msvsphere.py +new file mode 100644 +index 0000000..3dc0a34 +--- /dev/null ++++ b/cloudinit/distros/msvsphere.py +@@ -0,0 +1,10 @@ ++# 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 +diff --git a/cloudinit/net/sysconfig.py b/cloudinit/net/sysconfig.py +index b50035b..b1e0045 100644 +--- a/cloudinit/net/sysconfig.py ++++ b/cloudinit/net/sysconfig.py +@@ -28,6 +28,7 @@ KNOWN_DISTROS = [ + "eurolinux", + "fedora", + "miraclelinux", ++ "msvsphere", + "openEuler", + "rhel", + "rocky", +diff --git a/cloudinit/settings.py b/cloudinit/settings.py +index 38a90b7..2a2f530 100644 +--- a/cloudinit/settings.py ++++ b/cloudinit/settings.py +@@ -58,7 +58,7 @@ CFG_BUILTIN = { + 'cloud_dir': '/var/lib/cloud', + 'templates_dir': '/etc/cloud/templates/', + }, +- 'distro': 'rhel', ++ 'distro': 'msvsphere', + 'network': {'renderers': None}, + }, + "vendor_data": {"enabled": True, "prefix": []}, +diff --git a/cloudinit/sources/DataSourceRbxCloud.py b/cloudinit/sources/DataSourceRbxCloud.py +index 14ac77e..55d6724 100644 +--- a/cloudinit/sources/DataSourceRbxCloud.py ++++ b/cloudinit/sources/DataSourceRbxCloud.py +@@ -55,7 +55,7 @@ def _sub_arp(cmd): + + def gratuitous_arp(items, distro): + source_param = "-S" +- if distro.name in ["fedora", "centos", "rhel"]: ++ if distro.name in ["fedora", "centos", "msvsphere", "rhel"]: + source_param = "-s" + for item in items: + try: +diff --git a/cloudinit/util.py b/cloudinit/util.py +index 4cb2155..36d901f 100644 +--- a/cloudinit/util.py ++++ b/cloudinit/util.py +@@ -585,6 +585,7 @@ def _get_variant(info): + "eurolinux", + "fedora", + "miraclelinux", ++ "msvsphere", + "openeuler", + "photon", + "rhel", +diff --git a/config/cloud.cfg.tmpl b/config/cloud.cfg.tmpl +index 08b6efb..b5fed23 100644 +--- a/config/cloud.cfg.tmpl ++++ b/config/cloud.cfg.tmpl +@@ -34,7 +34,7 @@ disable_root: true + {% endif %} + + {% if variant in ["almalinux", "alpine", "amazon", "cloudlinux", "eurolinux", +- "fedora", "miraclelinux", "openEuler", "openmandriva", "rocky", "virtuozzo"] or is_rhel %} ++ "fedora", "miraclelinux", "msvsphere", "openEuler", "openmandriva", "rocky", "virtuozzo"] or is_rhel %} + {% if is_rhel %} + mount_default_fields: [~, ~, 'auto', 'defaults,nofail,x-systemd.requires=cloud-init.service,_netdev', '0', '2'] + {% else %} +@@ -195,7 +195,7 @@ cloud_final_modules: + system_info: + # This will affect which distro class gets used + {% if variant in ["almalinux", "alpine", "amazon", "arch", "cloudlinux", "debian", +- "eurolinux", "fedora", "freebsd", "gentoo", "netbsd", "miraclelinux", "openbsd", "openEuler", ++ "eurolinux", "fedora", "freebsd", "gentoo", "netbsd", "miraclelinux", "msvsphere", "openbsd", "openEuler", + "openmandriva", "photon", "rocky", "suse", "ubuntu", "virtuozzo"] or is_rhel %} + distro: {{ variant }} + {% elif variant in ["dragonfly"] %} +@@ -250,7 +250,7 @@ system_info: + security: http://ports.ubuntu.com/ubuntu-ports + ssh_svcname: ssh + {% elif variant in ["almalinux", "alpine", "amazon", "arch", "cloudlinux", "eurolinux", +- "fedora", "gentoo", "miraclelinux", "openEuler", "openmandriva", "rocky", "suse", "virtuozzo"] or is_rhel %} ++ "fedora", "gentoo", "miraclelinux", "msvsphere", "openEuler", "openmandriva", "rocky", "suse", "virtuozzo"] or is_rhel %} + # Default user name + that default users groups (if added/used) + default_user: + {% if variant == "amazon" %} +diff --git a/doc/rtd/topics/availability.rst b/doc/rtd/topics/availability.rst +index d8ca9d1..8a5e604 100644 +--- a/doc/rtd/topics/availability.rst ++++ b/doc/rtd/topics/availability.rst +@@ -27,7 +27,7 @@ OpenBSD and DragonFlyBSD: + - NetBSD + - OpenBSD + - Photon OS +-- RHEL/CentOS/AlmaLinux/Rocky Linux/EuroLinux ++- RHEL/CentOS/AlmaLinux/Rocky Linux/EuroLinux/MSVSphere + - SLES/openSUSE + - Ubuntu + +diff --git a/packages/pkg-deps.json b/packages/pkg-deps.json +index eaf1346..e12ab07 100644 +--- a/packages/pkg-deps.json ++++ b/packages/pkg-deps.json +@@ -41,6 +41,20 @@ + "sudo" + ] + }, ++ "msvsphere" : { ++ "build-requires" : [ ++ "python3-devel" ++ ], ++ "requires" : [ ++ "e2fsprogs", ++ "iproute", ++ "net-tools", ++ "procps", ++ "rsyslog", ++ "shadow-utils", ++ "sudo" ++ ] ++ }, + "redhat" : { + "build-requires" : [ + "python3-devel" +diff --git a/systemd/cloud-config.service.tmpl b/systemd/cloud-config.service.tmpl +index d5568a6..3e416a4 100644 +--- a/systemd/cloud-config.service.tmpl ++++ b/systemd/cloud-config.service.tmpl +@@ -4,7 +4,7 @@ Description=Apply the settings specified in cloud-config + After=network-online.target cloud-config.target + After=snapd.seeded.service + Wants=network-online.target cloud-config.target +-{% if variant == "rhel" %} ++{% if variant in ["msvsphere", "rhel"] %} + ConditionPathExists=!/etc/cloud/cloud-init.disabled + ConditionKernelCommandLine=!cloud-init=disabled + {% endif %} +diff --git a/systemd/cloud-final.service.tmpl b/systemd/cloud-final.service.tmpl +index 85f423a..10b7e72 100644 +--- a/systemd/cloud-final.service.tmpl ++++ b/systemd/cloud-final.service.tmpl +@@ -7,7 +7,7 @@ After=multi-user.target + Before=apt-daily.service + {% endif %} + Wants=network-online.target cloud-config.service +-{% if variant == "rhel" %} ++{% if variant in ["msvsphere", "rhel"] %} + ConditionPathExists=!/etc/cloud/cloud-init.disabled + ConditionKernelCommandLine=!cloud-init=disabled + {% endif %} +@@ -19,7 +19,7 @@ ExecStart=/usr/bin/cloud-init modules --mode=final + RemainAfterExit=yes + TimeoutSec=0 + KillMode=process +-{% if variant == "rhel" %} ++{% if variant in ["msvsphere", "rhel"] %} + # Restart NetworkManager if it is present and running. + ExecStartPost=/bin/sh -c 'u=NetworkManager.service; \ + out=$(systemctl show --property=SubState $u) || exit; \ +diff --git a/systemd/cloud-init-generator.tmpl b/systemd/cloud-init-generator.tmpl +index 74d4742..0d39ed0 100644 +--- a/systemd/cloud-init-generator.tmpl ++++ b/systemd/cloud-init-generator.tmpl +@@ -84,7 +84,7 @@ default() { + check_for_datasource() { + local ds_rc="" + {% if variant in ["almalinux", "centos", "cloudlinux", "eurolinux", "fedora", +- "miraclelinux", "openEuler", "rhel", "rocky", "virtuozzo"] %} ++ "miraclelinux", "msvsphere", "openEuler", "rhel", "rocky", "virtuozzo"] %} + local dsidentify="/usr/libexec/cloud-init/ds-identify" + {% else %} + local dsidentify="/usr/lib/cloud-init/ds-identify" +diff --git a/systemd/cloud-init-local.service.tmpl b/systemd/cloud-init-local.service.tmpl +index a6b8265..1331231 100644 +--- a/systemd/cloud-init-local.service.tmpl ++++ b/systemd/cloud-init-local.service.tmpl +@@ -1,23 +1,23 @@ + ## template:jinja + [Unit] + Description=Initial cloud-init job (pre-networking) +-{% if variant in ["ubuntu", "unknown", "debian", "rhel" ] %} ++{% if variant in ["ubuntu", "unknown", "debian", "msvsphere", "rhel" ] %} + DefaultDependencies=no + {% endif %} + Wants=network-pre.target + After=hv_kvp_daemon.service + After=systemd-remount-fs.service +-{% if variant == "rhel" %} ++{% if variant in ["msvsphere", "rhel"] %} + Requires=dbus.socket + After=dbus.socket + {% endif %} + Before=NetworkManager.service +-{% if variant == "rhel" %} ++{% if variant in ["msvsphere", "rhel"] %} + Before=network.service + {% endif %} + Before=network-pre.target + Before=shutdown.target +-{% if variant == "rhel" %} ++{% if variant in ["msvsphere", "rhel"] %} + Before=firewalld.target + Conflicts=shutdown.target + {% endif %} +@@ -26,14 +26,14 @@ Before=sysinit.target + Conflicts=shutdown.target + {% endif %} + RequiresMountsFor=/var/lib/cloud +-{% if variant == "rhel" %} ++{% if variant in ["msvsphere", "rhel"] %} + ConditionPathExists=!/etc/cloud/cloud-init.disabled + ConditionKernelCommandLine=!cloud-init=disabled + {% endif %} + + [Service] + Type=oneshot +-{% if variant == "rhel" %} ++{% if variant in ["msvsphere", "rhel"] %} + ExecStartPre=/bin/mkdir -p /run/cloud-init + ExecStartPre=/sbin/restorecon /run/cloud-init + ExecStartPre=/usr/bin/touch /run/cloud-init/enabled +diff --git a/systemd/cloud-init.service.tmpl b/systemd/cloud-init.service.tmpl +index fc984d5..acab0e8 100644 +--- a/systemd/cloud-init.service.tmpl ++++ b/systemd/cloud-init.service.tmpl +@@ -1,7 +1,7 @@ + ## template:jinja + [Unit] + Description=Initial cloud-init job (metadata service crawler) +-{% if variant not in ["photon", "rhel"] %} ++{% if variant not in ["photon", "msvsphere", "rhel"] %} + DefaultDependencies=no + {% endif %} + Wants=cloud-init-local.service +@@ -13,7 +13,7 @@ After=systemd-networkd-wait-online.service + After=networking.service + {% endif %} + {% if variant in ["almalinux", "centos", "cloudlinux", "eurolinux", "fedora", +- "miraclelinux", "openEuler", "rhel", "rocky", "virtuozzo"] %} ++ "miraclelinux", "msvsphere", "openEuler", "rhel", "rocky", "virtuozzo"] %} + After=network.service + After=NetworkManager.service + After=NetworkManager-wait-online.service +@@ -37,7 +37,7 @@ Before=shutdown.target + Conflicts=shutdown.target + {% endif %} + Before=systemd-user-sessions.service +-{% if variant == "rhel" %} ++{% if variant in ["msvsphere", "rhel"] %} + ConditionPathExists=!/etc/cloud/cloud-init.disabled + ConditionKernelCommandLine=!cloud-init=disabled + {% endif %} +diff --git a/templates/chrony.conf.msvsphere.tmpl b/templates/chrony.conf.msvsphere.tmpl +new file mode 100644 +index 0000000..5b3542e +--- /dev/null ++++ b/templates/chrony.conf.msvsphere.tmpl +@@ -0,0 +1,45 @@ ++## template:jinja ++# Use public servers from the pool.ntp.org project. ++# Please consider joining the pool (http://www.pool.ntp.org/join.html). ++{% if pools %}# pools ++{% endif %} ++{% for pool in pools -%} ++pool {{pool}} iburst ++{% endfor %} ++{%- if servers %}# servers ++{% endif %} ++{% for server in servers -%} ++server {{server}} iburst ++{% endfor %} ++ ++# Record the rate at which the system clock gains/losses time. ++driftfile /var/lib/chrony/drift ++ ++# Allow the system clock to be stepped in the first three updates ++# if its offset is larger than 1 second. ++makestep 1.0 3 ++ ++# Enable kernel synchronization of the real-time clock (RTC). ++rtcsync ++ ++# Enable hardware timestamping on all interfaces that support it. ++#hwtimestamp * ++ ++# Increase the minimum number of selectable sources required to adjust ++# the system clock. ++#minsources 2 ++ ++# Allow NTP client access from local network. ++#allow 192.168.0.0/16 ++ ++# Serve time even if not synchronized to a time source. ++#local stratum 10 ++ ++# Specify file containing keys for NTP authentication. ++#keyfile /etc/chrony.keys ++ ++# Specify directory for log files. ++logdir /var/log/chrony ++ ++# Select which information is logged. ++#log measurements statistics tracking +diff --git a/templates/ntp.conf.msvsphere.tmpl b/templates/ntp.conf.msvsphere.tmpl +new file mode 100644 +index 0000000..62b4776 +--- /dev/null ++++ b/templates/ntp.conf.msvsphere.tmpl +@@ -0,0 +1,61 @@ ++## template:jinja ++ ++# For more information about this file, see the man pages ++# ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5). ++ ++driftfile /var/lib/ntp/drift ++ ++# Permit time synchronization with our time source, but do not ++# permit the source to query or modify the service on this system. ++restrict default kod nomodify notrap nopeer noquery ++restrict -6 default kod nomodify notrap nopeer noquery ++ ++# Permit all access over the loopback interface. This could ++# be tightened as well, but to do so would effect some of ++# the administrative functions. ++restrict 127.0.0.1 ++restrict -6 ::1 ++ ++# Hosts on local network are less restricted. ++#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap ++ ++# Use public servers from the pool.ntp.org project. ++# Please consider joining the pool (http://www.pool.ntp.org/join.html). ++{% if pools %}# pools ++{% endif %} ++{% for pool in pools -%} ++pool {{pool}} iburst ++{% endfor %} ++{%- if servers %}# servers ++{% endif %} ++{% for server in servers -%} ++server {{server}} iburst ++{% endfor %} ++ ++#broadcast 192.168.1.255 autokey # broadcast server ++#broadcastclient # broadcast client ++#broadcast 224.0.1.1 autokey # multicast server ++#multicastclient 224.0.1.1 # multicast client ++#manycastserver 239.255.254.254 # manycast server ++#manycastclient 239.255.254.254 autokey # manycast client ++ ++# Enable public key cryptography. ++#crypto ++ ++includefile /etc/ntp/crypto/pw ++ ++# Key file containing the keys and key identifiers used when operating ++# with symmetric key cryptography. ++keys /etc/ntp/keys ++ ++# Specify the key identifiers which are trusted. ++#trustedkey 4 8 42 ++ ++# Specify the key identifier to use with the ntpdc utility. ++#requestkey 8 ++ ++# Specify the key identifier to use with the ntpq utility. ++#controlkey 8 ++ ++# Enable writing of statistics records. ++#statistics clockstats cryptostats loopstats peerstats +diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py +index 591241b..51b06c8 100644 +--- a/tests/unittests/test_net.py ++++ b/tests/unittests/test_net.py +@@ -6259,6 +6259,7 @@ class TestNetRenderers(CiTestCase): + "eurolinux", + "fedora", + "rhel", ++ "msvsphere", + ] + for distro_name in variants: + m_info.return_value = {"variant": distro_name} +diff --git a/tests/unittests/test_render_cloudcfg.py b/tests/unittests/test_render_cloudcfg.py +index 1a6e271..aa322ee 100644 +--- a/tests/unittests/test_render_cloudcfg.py ++++ b/tests/unittests/test_render_cloudcfg.py +@@ -17,6 +17,7 @@ DISTRO_VARIANTS = [ + "fedora", + "freebsd", + "gentoo", ++ "msvsphere", + "netbsd", + "openbsd", + "photon", +diff --git a/tests/unittests/test_util.py b/tests/unittests/test_util.py +index 528b7f3..2b03753 100644 +--- a/tests/unittests/test_util.py ++++ b/tests/unittests/test_util.py +@@ -202,6 +202,28 @@ OS_RELEASE_MIRACLELINUX_8 = dedent( + """ + ) + ++OS_RELEASE_MSVSPHERE_9 = dedent( ++ """\ ++ NAME="MSVSphere" ++ VERSION="9.2 (Inferit)" ++ ID="msvsphere" ++ ID_LIKE="rhel centos fedora" ++ VERSION_ID="9.2" ++ PLATFORM_ID="platform:el9" ++ PRETTY_NAME="MSVSphere 9.2 (Inferit)" ++ ANSI_COLOR="0;34" ++ LOGO="fedora-logo-icon" ++ CPE_NAME="cpe:/o:ncsd:msvsphere:9::baseos" ++ HOME_URL="https://msvsphere.ru/" ++ BUG_REPORT_URL="https://bugs.msvsphere.ru/" ++ ++ MSVSPHERE_MANTISBT_PROJECT="MSVSphere-9" ++ MSVSPHERE_MANTISBT_PROJECT_VERSION="9.2" ++ REDHAT_SUPPORT_PRODUCT="MSVSphere" ++ REDHAT_SUPPORT_PRODUCT_VERSION="9.2" ++""" ++) ++ + OS_RELEASE_ROCKY_8 = dedent( + """\ + NAME="Rocky Linux" +@@ -273,6 +295,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_MSVSPHERE_9 = "MSVSphere release 9.2 (Inferit)" + 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)" +@@ -792,6 +815,26 @@ class TestGetLinuxDistro(CiTestCase): + dist = util.get_linux_distro() + self.assertEqual(("miraclelinux", "8", "Peony"), dist) + ++ @mock.patch("cloudinit.util.load_file") ++ def test_get_linux_msvsphere9_rhrelease( ++ self, m_os_release, m_path_exists ++ ): ++ """Verify msvsphere 9 read from redhat-release.""" ++ m_os_release.return_value = REDHAT_RELEASE_MSVSPHERE_9 ++ m_path_exists.side_effect = TestGetLinuxDistro.redhat_release_exists ++ dist = util.get_linux_distro() ++ self.assertEqual(("msvsphere", "9.2", "Inferit"), dist) ++ ++ @mock.patch("cloudinit.util.load_file") ++ def test_get_linux_msvsphere9_osrelease( ++ self, m_os_release, m_path_exists ++ ): ++ """Verify msvsphere 9 read from os-release.""" ++ m_os_release.return_value = OS_RELEASE_MSVSPHERE_9 ++ m_path_exists.side_effect = TestGetLinuxDistro.os_release_exists ++ dist = util.get_linux_distro() ++ self.assertEqual(("msvsphere", "9.2", "Inferit"), 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.""" +@@ -955,6 +998,7 @@ class TestGetVariant: + ({"system": "linux", "dist": ("ubuntu",)}, "ubuntu"), + ({"system": "linux", "dist": ("linuxmint",)}, "ubuntu"), + ({"system": "linux", "dist": ("mint",)}, "ubuntu"), ++ ({"system": "linux", "dist": ("msvsphere",)}, "msvsphere"), + ({"system": "linux", "dist": ("redhat",)}, "rhel"), + ({"system": "linux", "dist": ("opensuse",)}, "suse"), + ({"system": "linux", "dist": ("opensuse-tumbleweed",)}, "suse"), +diff --git a/tools/read-dependencies b/tools/read-dependencies +index 6ef72a9..bc51610 100755 +--- a/tools/read-dependencies ++++ b/tools/read-dependencies +@@ -25,6 +25,7 @@ DISTRO_PKG_TYPE_MAP = { + 'centos': 'redhat', + 'eurolinux': 'redhat', + 'miraclelinux': 'redhat', ++ 'msvsphere': 'redhat', + 'rocky': 'redhat', + 'redhat': 'redhat', + 'debian': 'debian', +@@ -72,6 +73,7 @@ DRY_DISTRO_INSTALL_PKG_CMD = { + 'centos': ['yum', 'install', '--assumeyes'], + 'eurolinux': ['yum', 'install', '--assumeyes'], + 'miraclelinux': ['yum', 'install', '--assumeyes'], ++ 'msvsphere': ['yum', 'install', '--assumeyes'], + 'redhat': ['yum', 'install', '--assumeyes'], + } + +@@ -79,6 +81,7 @@ DISTRO_INSTALL_PKG_CMD = { + 'rocky': MAYBE_RELIABLE_YUM_INSTALL, + 'eurolinux': MAYBE_RELIABLE_YUM_INSTALL, + 'miraclelinux': MAYBE_RELIABLE_YUM_INSTALL, ++ 'msvsphere': MAYBE_RELIABLE_YUM_INSTALL, + 'centos': MAYBE_RELIABLE_YUM_INSTALL, + 'redhat': MAYBE_RELIABLE_YUM_INSTALL, + 'debian': ['apt', 'install', '-y'], +@@ -93,6 +96,7 @@ CI_SYSTEM_BASE_PKGS = { + 'common': ['make', 'sudo', 'tar'], + 'eurolinux': ['python3-tox'], + 'miraclelinux': ['python3-tox'], ++ 'msvsphere': ['python3-tox'], + 'redhat': ['python3-tox'], + 'centos': ['python3-tox'], + 'ubuntu': ['devscripts', 'python3-dev', 'libssl-dev', 'tox', 'sbuild'], +@@ -285,10 +289,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', 'eurolinux']: ++ if distro in ['centos', 'redhat', 'rocky', 'eurolinux', "msvsphere"]: + # 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', 'eurolinux']: ++ if distro in ['suse', 'opensuse', 'redhat', 'rocky', 'centos', 'eurolinux', "msvsphere"]: + pkg_list.append('rpm-build') + subprocess.check_call(install_cmd + pkg_list) + +diff --git a/tools/render-cloudcfg b/tools/render-cloudcfg +index afe999e..c727370 100755 +--- a/tools/render-cloudcfg ++++ b/tools/render-cloudcfg +@@ -22,6 +22,7 @@ def main(): + "freebsd", + "gentoo", + "miraclelinux", ++ "msvsphere", + "netbsd", + "openbsd", + "openEuler", +diff --git a/tools/run-container b/tools/run-container +index e049dfd..35b1e7e 100755 +--- a/tools/run-container ++++ b/tools/run-container +@@ -247,7 +247,7 @@ apt_install() { + install_packages() { + get_os_info || return + case "$OS_NAME" in +- centos|rocky*) yum_install "$@";; ++ centos|msvsphere|rocky*) yum_install "$@";; + opensuse) zypper_install "$@";; + debian|ubuntu) apt_install "$@";; + *) error "Do not know how to install packages on ${OS_NAME}"; +@@ -486,7 +486,7 @@ main() { + + local build_pkg="" build_srcpkg="" pkg_ext="" distflag="" + case "$OS_NAME" in +- centos|rocky) distflag="--distro=redhat";; ++ centos|msvsphere|rocky) distflag="--distro=redhat";; + opensuse) distflag="--distro=suse";; + esac + +@@ -495,7 +495,7 @@ main() { + build_pkg="./packages/bddeb -d" + build_srcpkg="./packages/bddeb -S -d" + pkg_ext=".deb";; +- centos|opensuse|rocky) ++ centos|opensuse|msvsphere|rocky) + build_pkg="./packages/brpm $distflag" + build_srcpkg="./packages/brpm $distflag --srpm" + pkg_ext=".rpm";; +-- +2.40.1 + diff --git a/SOURCES/cloud-init-22.1-add_msvsphere.patch b/SOURCES/cloud-init-22.1-add_msvsphere.patch deleted file mode 100644 index 0ade5f8..0000000 --- a/SOURCES/cloud-init-22.1-add_msvsphere.patch +++ /dev/null @@ -1,154 +0,0 @@ -diff --git a/cloudinit/config/cc_ntp.py b/cloudinit/config/cc_ntp.py -index 25bba76..aaf1228 100644 ---- a/cloudinit/config/cc_ntp.py -+++ b/cloudinit/config/cc_ntp.py -@@ -33,6 +33,7 @@ distros = [ - "eurolinux", - "fedora", - "miraclelinux", -+ "msvsphere", - "openEuler", - "opensuse", - "photon", -diff --git a/cloudinit/config/cc_yum_add_repo.py b/cloudinit/config/cc_yum_add_repo.py -index 7a23268..58e938e 100644 ---- a/cloudinit/config/cc_yum_add_repo.py -+++ b/cloudinit/config/cc_yum_add_repo.py -@@ -19,7 +19,7 @@ entry, the config entry will be skipped. - **Module frequency:** always - - **Supported distros:** almalinux, centos, cloudlinux, eurolinux, fedora, -- miraclelinux, openEuler, photon, rhel, rocky, virtuozzo -+ miraclelinux, msvsphere, openEuler, photon, rhel, rocky, virtuozzo - - **Config keys**:: - -@@ -43,6 +43,7 @@ distros = [ - "cloudlinux", - "eurolinux", - "fedora", -+ "msvsphere", - "openEuler", - "photon", - "rhel", -diff --git a/cloudinit/distros/__init__.py b/cloudinit/distros/__init__.py -index 76acd6a..798e428 100755 ---- a/cloudinit/distros/__init__.py -+++ b/cloudinit/distros/__init__.py -@@ -46,6 +46,7 @@ OSFAMILIES = { - "eurolinux", - "fedora", - "miraclelinux", -+ "msvsphere", - "openEuler", - "photon", - "rhel", -diff --git a/cloudinit/net/sysconfig.py b/cloudinit/net/sysconfig.py -index b50035b..b1e0045 100644 ---- a/cloudinit/net/sysconfig.py -+++ b/cloudinit/net/sysconfig.py -@@ -28,6 +28,7 @@ KNOWN_DISTROS = [ - "eurolinux", - "fedora", - "miraclelinux", -+ "msvsphere", - "openEuler", - "rhel", - "rocky", -diff --git a/cloudinit/util.py b/cloudinit/util.py -index 4cb2155..36d901f 100644 ---- a/cloudinit/util.py -+++ b/cloudinit/util.py -@@ -585,6 +585,7 @@ def _get_variant(info): - "eurolinux", - "fedora", - "miraclelinux", -+ "msvsphere", - "openeuler", - "photon", - "rhel", -diff --git a/config/cloud.cfg.tmpl b/config/cloud.cfg.tmpl -index 08b6efb..b5fed23 100644 ---- a/config/cloud.cfg.tmpl -+++ b/config/cloud.cfg.tmpl -@@ -34,7 +34,7 @@ disable_root: true - {% endif %} - - {% if variant in ["almalinux", "alpine", "amazon", "cloudlinux", "eurolinux", -- "fedora", "miraclelinux", "openEuler", "openmandriva", "rocky", "virtuozzo"] or is_rhel %} -+ "fedora", "miraclelinux", "msvsphere", "openEuler", "openmandriva", "rocky", "virtuozzo"] or is_rhel %} - {% if is_rhel %} - mount_default_fields: [~, ~, 'auto', 'defaults,nofail,x-systemd.requires=cloud-init.service,_netdev', '0', '2'] - {% else %} -@@ -195,7 +195,7 @@ cloud_final_modules: - system_info: - # This will affect which distro class gets used - {% if variant in ["almalinux", "alpine", "amazon", "arch", "cloudlinux", "debian", -- "eurolinux", "fedora", "freebsd", "gentoo", "netbsd", "miraclelinux", "openbsd", "openEuler", -+ "eurolinux", "fedora", "freebsd", "gentoo", "netbsd", "miraclelinux", "msvsphere", "openbsd", "openEuler", - "openmandriva", "photon", "rocky", "suse", "ubuntu", "virtuozzo"] or is_rhel %} - distro: {{ variant }} - {% elif variant in ["dragonfly"] %} -@@ -250,7 +250,7 @@ system_info: - security: http://ports.ubuntu.com/ubuntu-ports - ssh_svcname: ssh - {% elif variant in ["almalinux", "alpine", "amazon", "arch", "cloudlinux", "eurolinux", -- "fedora", "gentoo", "miraclelinux", "openEuler", "openmandriva", "rocky", "suse", "virtuozzo"] or is_rhel %} -+ "fedora", "gentoo", "miraclelinux", "msvsphere", "openEuler", "openmandriva", "rocky", "suse", "virtuozzo"] or is_rhel %} - # Default user name + that default users groups (if added/used) - default_user: - {% if variant == "amazon" %} -diff --git a/doc/rtd/topics/availability.rst b/doc/rtd/topics/availability.rst -index d8ca9d1..8a5e604 100644 ---- a/doc/rtd/topics/availability.rst -+++ b/doc/rtd/topics/availability.rst -@@ -27,7 +27,7 @@ OpenBSD and DragonFlyBSD: - - NetBSD - - OpenBSD - - Photon OS --- RHEL/CentOS/AlmaLinux/Rocky Linux/EuroLinux -+- RHEL/CentOS/AlmaLinux/Rocky Linux/EuroLinux/MSVSphere - - SLES/openSUSE - - Ubuntu - -diff --git a/systemd/cloud-init-generator.tmpl b/systemd/cloud-init-generator.tmpl -index 74d4742..0d39ed0 100644 ---- a/systemd/cloud-init-generator.tmpl -+++ b/systemd/cloud-init-generator.tmpl -@@ -84,7 +84,7 @@ default() { - check_for_datasource() { - local ds_rc="" - {% if variant in ["almalinux", "centos", "cloudlinux", "eurolinux", "fedora", -- "miraclelinux", "openEuler", "rhel", "rocky", "virtuozzo"] %} -+ "miraclelinux", "msvsphere", "openEuler", "rhel", "rocky", "virtuozzo"] %} - local dsidentify="/usr/libexec/cloud-init/ds-identify" - {% else %} - local dsidentify="/usr/lib/cloud-init/ds-identify" -diff --git a/systemd/cloud-init.service.tmpl b/systemd/cloud-init.service.tmpl -index fc984d5..4a453eb 100644 ---- a/systemd/cloud-init.service.tmpl -+++ b/systemd/cloud-init.service.tmpl -@@ -13,7 +13,7 @@ After=systemd-networkd-wait-online.service - After=networking.service - {% endif %} - {% if variant in ["almalinux", "centos", "cloudlinux", "eurolinux", "fedora", -- "miraclelinux", "openEuler", "rhel", "rocky", "virtuozzo"] %} -+ "miraclelinux", "msvsphere", "openEuler", "rhel", "rocky", "virtuozzo"] %} - After=network.service - After=NetworkManager.service - After=NetworkManager-wait-online.service -diff --git a/tools/render-cloudcfg b/tools/render-cloudcfg -index 176df36..cd8ccf5 100755 ---- a/tools/render-cloudcfg -+++ b/tools/render-cloudcfg -@@ -22,6 +22,7 @@ def main(): - "freebsd", - "gentoo", - "miraclelinux", -+ "msvsphere", - "netbsd", - "openbsd", - "openEuler", --- -2.39.2 - diff --git a/SPECS/cloud-init.spec b/SPECS/cloud-init.spec index d3ecb49..6f596ae 100644 --- a/SPECS/cloud-init.spec +++ b/SPECS/cloud-init.spec @@ -1,6 +1,6 @@ Name: cloud-init Version: 22.1 -Release: 9%{?dist}.inferit +Release: 9%{?dist}.inferit.1 Summary: Cloud instance init scripts License: ASL 2.0 or GPLv3 URL: http://launchpad.net/cloud-init @@ -56,7 +56,7 @@ Patch21: ci-cc_set_hostname-ignore-var-lib-cloud-data-set-hostna.patch Patch22: ci-Allow-growpart-to-resize-encrypted-partitions-1316.patch # MSVSphere patches -Patch100: cloud-init-22.1-add_msvsphere.patch +Patch100: Add-MSVSphere-support.patch # Source-git patches @@ -250,6 +250,10 @@ fi %config(noreplace) %{_sysconfdir}/rsyslog.d/21-cloudinit.conf %changelog +* Fri Jul 07 2023 Eugene Zamriy - 22.1-9.inferit.1 +- Updates MSVSphere support patch: adds missing distribution config, + support to systemd templates and so on. + * Tue May 16 2023 Sergey Cherevko - 22.1-9.inferit - Debrand for MSVSphere - Rebuilt for MSVSphere 9.2.