open-vm-tools: upgrade to v12.1.0
python-pyserial: new package addition, needed for cloud-init
Change-Id: I939b9db17497888eb9f5767790ef2b89286b74e6
Signed-off-by: Shreenidhi Shedi <sshedi@vmware.com>
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/17674
Tested-by: gerrit-photon <photon-checkins@vmware.com>
| 1 | 1 |
deleted file mode 100644 |
| ... | ... |
@@ -1,30 +0,0 @@ |
| 1 |
-From 25326a39a51996f37ef8c3cb976fe31c041a2edd Mon Sep 17 00:00:00 2001 |
|
| 2 |
-From: James Falcon <james.falcon@canonical.com> |
|
| 3 |
-Date: Fri, 12 Aug 2022 10:52:50 -0500 |
|
| 4 |
-Subject: [PATCH] Return cc_set_hostname to PER_INSTANCE frequency (#1651) |
|
| 5 |
- |
|
| 6 |
-In 96eb95a the frequency was inadvertently changed to ALWAYS due to |
|
| 7 |
-the documentation being incorrect. The code and documentation should |
|
| 8 |
-now align to be PER_INSTANCE. |
|
| 9 |
- |
|
| 10 |
-LP: #1983811 |
|
| 11 |
- cloudinit/config/cc_set_hostname.py | 4 ++-- |
|
| 12 |
- 1 file changed, 2 insertions(+), 2 deletions(-) |
|
| 13 |
- |
|
| 14 |
-diff --git a/cloudinit/config/cc_set_hostname.py b/cloudinit/config/cc_set_hostname.py |
|
| 15 |
-index 2a4c565f70..3ea9e4ed8e 100644 |
|
| 16 |
-+++ b/cloudinit/config/cc_set_hostname.py |
|
| 17 |
-@@ -14,9 +14,9 @@ |
|
| 18 |
- from cloudinit.atomic_helper import write_json |
|
| 19 |
- from cloudinit.config.schema import MetaSchema, get_meta_doc |
|
| 20 |
- from cloudinit.distros import ALL_DISTROS |
|
| 21 |
--from cloudinit.settings import PER_ALWAYS |
|
| 22 |
-+from cloudinit.settings import PER_INSTANCE |
|
| 23 |
- |
|
| 24 |
--frequency = PER_ALWAYS |
|
| 25 |
-+frequency = PER_INSTANCE |
|
| 26 |
- MODULE_DESCRIPTION = """\ |
|
| 27 |
- This module handles setting the system hostname and fully qualified domain |
|
| 28 |
- name (FQDN). If ``preserve_hostname`` is set, then the hostname will not be |
| ... | ... |
@@ -1,32 +1,32 @@ |
| 1 | 1 |
diff --git a/cloudinit/sources/helpers/azure.py b/cloudinit/sources/helpers/azure.py |
| 2 |
-index d07dc3c0..c5d93a7d 100755 |
|
| 2 |
+index 56f44339..bf4398d9 100644 |
|
| 3 | 3 |
--- a/cloudinit/sources/helpers/azure.py |
| 4 | 4 |
+++ b/cloudinit/sources/helpers/azure.py |
| 5 | 5 |
@@ -1,5 +1,6 @@ |
| 6 | 6 |
# This file is part of cloud-init. See LICENSE file for license information. |
| 7 | 7 |
import base64 |
| 8 | 8 |
+import configobj |
| 9 |
+ import enum |
|
| 9 | 10 |
import json |
| 10 | 11 |
import logging |
| 11 |
- import os |
|
| 12 |
-@@ -19,6 +20,7 @@ from cloudinit import ( |
|
| 13 |
- from cloudinit import distros, subp, temp_utils, url_helper, util, version |
|
| 12 |
+@@ -20,6 +21,7 @@ from xml.sax.saxutils import escape |
|
| 13 |
+ from cloudinit import distros, dmi, subp, temp_utils, url_helper, util, version |
|
| 14 | 14 |
from cloudinit.reporting import events |
| 15 | 15 |
from cloudinit.settings import CFG_BUILTIN |
| 16 | 16 |
+from io import StringIO |
| 17 | 17 |
|
| 18 | 18 |
LOG = logging.getLogger(__name__) |
| 19 | 19 |
|
| 20 |
-@@ -59,6 +61,8 @@ DEFAULT_REPORT_FAILURE_USER_VISIBLE_MESSAGE = ( |
|
| 20 |
+@@ -50,6 +52,8 @@ DEFAULT_REPORT_FAILURE_USER_VISIBLE_MESSAGE = ( |
|
| 21 | 21 |
"for more information on remediation." |
| 22 | 22 |
) |
| 23 | 23 |
|
| 24 | 24 |
+NETWORKD_LEASES_DIR = '/run/systemd/netif/leases' |
| 25 | 25 |
+ |
| 26 |
- |
|
| 26 |
+ |
|
| 27 | 27 |
def azure_ds_telemetry_reporter(func): |
| 28 | 28 |
def impl(*args, **kwargs): |
| 29 |
-@@ -942,6 +945,32 @@ class WALinuxAgentShim: |
|
| 29 |
+@@ -956,6 +960,32 @@ class WALinuxAgentShim: |
|
| 30 | 30 |
report_diagnostic_event(msg, logger_func=LOG.debug) |
| 31 | 31 |
return goal_state |
| 32 | 32 |
|
| 33 | 33 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,368 @@ |
| 0 |
+From 70ce64428119be5b21b188994b72f2ebb65a0c57 Mon Sep 17 00:00:00 2001 |
|
| 1 |
+From: James Falcon <james.falcon@canonical.com> |
|
| 2 |
+Date: Tue, 30 Aug 2022 14:26:03 -0500 |
|
| 3 |
+Subject: [PATCH] Fix v2 interface matching when no MAC |
|
| 4 |
+ |
|
| 5 |
+Commit af40478 added a regression. When parsing v2 config, matching can |
|
| 6 |
+fail when no MAC is available. This commit fixes that behavior. |
|
| 7 |
+ |
|
| 8 |
+LP: #1986551 |
|
| 9 |
+--- |
|
| 10 |
+ cloudinit/cmd/devel/net_convert.py | 2 +- |
|
| 11 |
+ cloudinit/distros/__init__.py | 4 +- |
|
| 12 |
+ cloudinit/net/network_state.py | 13 ++- |
|
| 13 |
+ cloudinit/net/networkd.py | 6 +- |
|
| 14 |
+ tests/unittests/conftest.py | 10 ++ |
|
| 15 |
+ .../cloud-init-encc000.2653.nmconnection | 21 ++++ |
|
| 16 |
+ .../cloud-init-encc000.nmconnection | 12 +++ |
|
| 17 |
+ .../cloud-init-zz-all-en.nmconnection | 16 +++ |
|
| 18 |
+ .../cloud-init-zz-all-eth.nmconnection | 16 +++ |
|
| 19 |
+ .../net/artifacts/no_matching_mac_v2.yaml | 22 ++++ |
|
| 20 |
+ tests/unittests/net/test_net_rendering.py | 101 ++++++++++++++++++ |
|
| 21 |
+ 11 files changed, 212 insertions(+), 11 deletions(-) |
|
| 22 |
+ create mode 100644 tests/unittests/net/artifacts/no_matching_mac/etc/NetworkManager/system-connections/cloud-init-encc000.2653.nmconnection |
|
| 23 |
+ create mode 100644 tests/unittests/net/artifacts/no_matching_mac/etc/NetworkManager/system-connections/cloud-init-encc000.nmconnection |
|
| 24 |
+ create mode 100644 tests/unittests/net/artifacts/no_matching_mac/etc/NetworkManager/system-connections/cloud-init-zz-all-en.nmconnection |
|
| 25 |
+ create mode 100644 tests/unittests/net/artifacts/no_matching_mac/etc/NetworkManager/system-connections/cloud-init-zz-all-eth.nmconnection |
|
| 26 |
+ create mode 100644 tests/unittests/net/artifacts/no_matching_mac_v2.yaml |
|
| 27 |
+ create mode 100644 tests/unittests/net/test_net_rendering.py |
|
| 28 |
+ |
|
| 29 |
+diff --git a/cloudinit/cmd/devel/net_convert.py b/cloudinit/cmd/devel/net_convert.py |
|
| 30 |
+index 50e268a293..269d72cd5a 100755 |
|
| 31 |
+--- a/cloudinit/cmd/devel/net_convert.py |
|
| 32 |
+@@ -140,7 +140,7 @@ def handle_args(name, args): |
|
| 33 |
+ config = distro.renderer_configs.get("eni")
|
|
| 34 |
+ elif args.output_kind == "netplan": |
|
| 35 |
+ r_cls = netplan.Renderer |
|
| 36 |
+- config = distro.renderer_configs.get("netplan")
|
|
| 37 |
++ config = distro.renderer_configs.get("netplan", {})
|
|
| 38 |
+ # don't run netplan generate/apply |
|
| 39 |
+ config["postcmds"] = False |
|
| 40 |
+ # trim leading slash |
|
| 41 |
+diff --git a/cloudinit/distros/__init__.py b/cloudinit/distros/__init__.py |
|
| 42 |
+index 8de3955e34..4a468cf8ca 100644 |
|
| 43 |
+--- a/cloudinit/distros/__init__.py |
|
| 44 |
+@@ -16,7 +16,7 @@ |
|
| 45 |
+ import string |
|
| 46 |
+ import urllib.parse |
|
| 47 |
+ from io import StringIO |
|
| 48 |
+-from typing import Any, Mapping, Optional, Type |
|
| 49 |
++from typing import Any, Mapping, MutableMapping, Optional, Type |
|
| 50 |
+ |
|
| 51 |
+ from cloudinit import importer |
|
| 52 |
+ from cloudinit import log as logging |
|
| 53 |
+@@ -79,7 +79,7 @@ class Distro(persistence.CloudInitPickleMixin, metaclass=abc.ABCMeta): |
|
| 54 |
+ tz_zone_dir = "/usr/share/zoneinfo" |
|
| 55 |
+ default_owner = "root:root" |
|
| 56 |
+ init_cmd = ["service"] # systemctl, service etc |
|
| 57 |
+- renderer_configs: Mapping[str, Mapping[str, Any]] = {}
|
|
| 58 |
++ renderer_configs: Mapping[str, MutableMapping[str, Any]] = {}
|
|
| 59 |
+ _preferred_ntp_clients = None |
|
| 60 |
+ networking_cls: Type[Networking] = LinuxNetworking |
|
| 61 |
+ # This is used by self.shutdown_command(), and can be overridden in |
|
| 62 |
+diff --git a/cloudinit/net/network_state.py b/cloudinit/net/network_state.py |
|
| 63 |
+index fd92bf0eb7..e4f7a7fdcb 100644 |
|
| 64 |
+--- a/cloudinit/net/network_state.py |
|
| 65 |
+@@ -796,7 +796,7 @@ def handle_wifis(self, command): |
|
| 66 |
+ " netplan rendering support." |
|
| 67 |
+ ) |
|
| 68 |
+ |
|
| 69 |
+- def _v2_common(self, cfg): |
|
| 70 |
++ def _v2_common(self, cfg) -> None: |
|
| 71 |
+ LOG.debug("v2_common: handling config:\n%s", cfg)
|
|
| 72 |
+ for iface, dev_cfg in cfg.items(): |
|
| 73 |
+ if "set-name" in dev_cfg: |
|
| 74 |
+@@ -813,10 +813,13 @@ def _v2_common(self, cfg): |
|
| 75 |
+ name_cmd.update({"address": dns})
|
|
| 76 |
+ self.handle_nameserver(name_cmd) |
|
| 77 |
+ |
|
| 78 |
+- mac_address = dev_cfg.get("match", {}).get("macaddress")
|
|
| 79 |
+- real_if_name = find_interface_name_from_mac(mac_address) |
|
| 80 |
+- if real_if_name: |
|
| 81 |
+- iface = real_if_name |
|
| 82 |
++ mac_address: Optional[str] = dev_cfg.get("match", {}).get(
|
|
| 83 |
++ "macaddress" |
|
| 84 |
++ ) |
|
| 85 |
++ if mac_address: |
|
| 86 |
++ real_if_name = find_interface_name_from_mac(mac_address) |
|
| 87 |
++ if real_if_name: |
|
| 88 |
++ iface = real_if_name |
|
| 89 |
+ |
|
| 90 |
+ self._handle_individual_nameserver(name_cmd, iface) |
|
| 91 |
+ |
|
| 92 |
+diff --git a/cloudinit/net/networkd.py b/cloudinit/net/networkd.py |
|
| 93 |
+index abfc1037ee..e0a5d84814 100644 |
|
| 94 |
+--- a/cloudinit/net/networkd.py |
|
| 95 |
+@@ -255,7 +255,7 @@ def _render_content(self, ns): |
|
| 96 |
+ self.parse_routes(route, cfg) |
|
| 97 |
+ |
|
| 98 |
+ if ns.version == 2: |
|
| 99 |
+- name = iface["name"] |
|
| 100 |
++ name: Optional[str] = iface["name"] |
|
| 101 |
+ # network state doesn't give dhcp domain info |
|
| 102 |
+ # using ns.config as a workaround here |
|
| 103 |
+ |
|
| 104 |
+@@ -270,8 +270,8 @@ def _render_content(self, ns): |
|
| 105 |
+ if dev_cfg.get("set-name") == name:
|
|
| 106 |
+ name = dev_name |
|
| 107 |
+ break |
|
| 108 |
+- |
|
| 109 |
+- self.dhcp_domain(ns.config["ethernets"][name], cfg) |
|
| 110 |
++ if name in ns.config["ethernets"]: |
|
| 111 |
++ self.dhcp_domain(ns.config["ethernets"][name], cfg) |
|
| 112 |
+ |
|
| 113 |
+ ret_dict.update({link: cfg.get_final_conf()})
|
|
| 114 |
+ |
|
| 115 |
+diff --git a/tests/unittests/conftest.py b/tests/unittests/conftest.py |
|
| 116 |
+index e265a285ca..1ab17e8b10 100644 |
|
| 117 |
+--- a/tests/unittests/conftest.py |
|
| 118 |
+@@ -1,6 +1,7 @@ |
|
| 119 |
+ import builtins |
|
| 120 |
+ import glob |
|
| 121 |
+ import os |
|
| 122 |
++from pathlib import Path |
|
| 123 |
+ |
|
| 124 |
+ import pytest |
|
| 125 |
+ |
|
| 126 |
+@@ -55,3 +56,12 @@ def fake_filesystem(mocker, tmpdir): |
|
| 127 |
+ func = getattr(mod, f) |
|
| 128 |
+ trap_func = retarget_many_wrapper(str(tmpdir), nargs, func) |
|
| 129 |
+ mocker.patch.object(mod, f, trap_func) |
|
| 130 |
++ |
|
| 131 |
++ |
|
| 132 |
++PYTEST_VERSION_TUPLE = tuple(map(int, pytest.__version__.split(".")))
|
|
| 133 |
++ |
|
| 134 |
++if PYTEST_VERSION_TUPLE < (3, 9, 0): |
|
| 135 |
++ |
|
| 136 |
++ @pytest.fixture |
|
| 137 |
++ def tmp_path(tmpdir): |
|
| 138 |
++ return Path(tmpdir) |
|
| 139 |
+diff --git a/tests/unittests/net/artifacts/no_matching_mac/etc/NetworkManager/system-connections/cloud-init-encc000.2653.nmconnection b/tests/unittests/net/artifacts/no_matching_mac/etc/NetworkManager/system-connections/cloud-init-encc000.2653.nmconnection |
|
| 140 |
+new file mode 100644 |
|
| 141 |
+index 0000000000..80483d4f00 |
|
| 142 |
+--- /dev/null |
|
| 143 |
+@@ -0,0 +1,21 @@ |
|
| 144 |
++# Generated by cloud-init. Changes will be lost. |
|
| 145 |
++ |
|
| 146 |
++[connection] |
|
| 147 |
++id=cloud-init encc000.2653 |
|
| 148 |
++uuid=116aaf19-aabc-50ea-b480-e9aee18bda59 |
|
| 149 |
++type=vlan |
|
| 150 |
++interface-name=encc000.2653 |
|
| 151 |
++ |
|
| 152 |
++[user] |
|
| 153 |
++org.freedesktop.NetworkManager.origin=cloud-init |
|
| 154 |
++ |
|
| 155 |
++[vlan] |
|
| 156 |
++id=2653 |
|
| 157 |
++parent=f869ebd3-f175-5747-bf02-d0d44d687248 |
|
| 158 |
++ |
|
| 159 |
++[ipv4] |
|
| 160 |
++method=manual |
|
| 161 |
++may-fail=false |
|
| 162 |
++address1=10.245.236.14/24 |
|
| 163 |
++gateway=10.245.236.1 |
|
| 164 |
++dns=10.245.236.1; |
|
| 165 |
+diff --git a/tests/unittests/net/artifacts/no_matching_mac/etc/NetworkManager/system-connections/cloud-init-encc000.nmconnection b/tests/unittests/net/artifacts/no_matching_mac/etc/NetworkManager/system-connections/cloud-init-encc000.nmconnection |
|
| 166 |
+new file mode 100644 |
|
| 167 |
+index 0000000000..3368388d4a |
|
| 168 |
+--- /dev/null |
|
| 169 |
+@@ -0,0 +1,12 @@ |
|
| 170 |
++# Generated by cloud-init. Changes will be lost. |
|
| 171 |
++ |
|
| 172 |
++[connection] |
|
| 173 |
++id=cloud-init encc000 |
|
| 174 |
++uuid=f869ebd3-f175-5747-bf02-d0d44d687248 |
|
| 175 |
++type=ethernet |
|
| 176 |
++interface-name=encc000 |
|
| 177 |
++ |
|
| 178 |
++[user] |
|
| 179 |
++org.freedesktop.NetworkManager.origin=cloud-init |
|
| 180 |
++ |
|
| 181 |
++[ethernet] |
|
| 182 |
+diff --git a/tests/unittests/net/artifacts/no_matching_mac/etc/NetworkManager/system-connections/cloud-init-zz-all-en.nmconnection b/tests/unittests/net/artifacts/no_matching_mac/etc/NetworkManager/system-connections/cloud-init-zz-all-en.nmconnection |
|
| 183 |
+new file mode 100644 |
|
| 184 |
+index 0000000000..16120bc179 |
|
| 185 |
+--- /dev/null |
|
| 186 |
+@@ -0,0 +1,16 @@ |
|
| 187 |
++# Generated by cloud-init. Changes will be lost. |
|
| 188 |
++ |
|
| 189 |
++[connection] |
|
| 190 |
++id=cloud-init zz-all-en |
|
| 191 |
++uuid=159daec9-cba3-5101-85e7-46d831857f43 |
|
| 192 |
++type=ethernet |
|
| 193 |
++interface-name=zz-all-en |
|
| 194 |
++ |
|
| 195 |
++[user] |
|
| 196 |
++org.freedesktop.NetworkManager.origin=cloud-init |
|
| 197 |
++ |
|
| 198 |
++[ethernet] |
|
| 199 |
++ |
|
| 200 |
++[ipv4] |
|
| 201 |
++method=auto |
|
| 202 |
++may-fail=false |
|
| 203 |
+diff --git a/tests/unittests/net/artifacts/no_matching_mac/etc/NetworkManager/system-connections/cloud-init-zz-all-eth.nmconnection b/tests/unittests/net/artifacts/no_matching_mac/etc/NetworkManager/system-connections/cloud-init-zz-all-eth.nmconnection |
|
| 204 |
+new file mode 100644 |
|
| 205 |
+index 0000000000..df44d546c8 |
|
| 206 |
+--- /dev/null |
|
| 207 |
+@@ -0,0 +1,16 @@ |
|
| 208 |
++# Generated by cloud-init. Changes will be lost. |
|
| 209 |
++ |
|
| 210 |
++[connection] |
|
| 211 |
++id=cloud-init zz-all-eth |
|
| 212 |
++uuid=23a83d8a-d7db-5133-a77b-e68a6ac61ec9 |
|
| 213 |
++type=ethernet |
|
| 214 |
++interface-name=zz-all-eth |
|
| 215 |
++ |
|
| 216 |
++[user] |
|
| 217 |
++org.freedesktop.NetworkManager.origin=cloud-init |
|
| 218 |
++ |
|
| 219 |
++[ethernet] |
|
| 220 |
++ |
|
| 221 |
++[ipv4] |
|
| 222 |
++method=auto |
|
| 223 |
++may-fail=false |
|
| 224 |
+diff --git a/tests/unittests/net/artifacts/no_matching_mac_v2.yaml b/tests/unittests/net/artifacts/no_matching_mac_v2.yaml |
|
| 225 |
+new file mode 100644 |
|
| 226 |
+index 0000000000..f5fc5ef10a |
|
| 227 |
+--- /dev/null |
|
| 228 |
+@@ -0,0 +1,22 @@ |
|
| 229 |
++network: |
|
| 230 |
++ version: 2 |
|
| 231 |
++ ethernets: |
|
| 232 |
++ encc000: {}
|
|
| 233 |
++ zz-all-en: |
|
| 234 |
++ match: |
|
| 235 |
++ name: "en*" |
|
| 236 |
++ dhcp4: true |
|
| 237 |
++ zz-all-eth: |
|
| 238 |
++ match: |
|
| 239 |
++ name: "eth*" |
|
| 240 |
++ dhcp4: true |
|
| 241 |
++ vlans: |
|
| 242 |
++ encc000.2653: |
|
| 243 |
++ id: 2653 |
|
| 244 |
++ link: "encc000" |
|
| 245 |
++ addresses: |
|
| 246 |
++ - "10.245.236.14/24" |
|
| 247 |
++ gateway4: "10.245.236.1" |
|
| 248 |
++ nameservers: |
|
| 249 |
++ addresses: |
|
| 250 |
++ - "10.245.236.1" |
|
| 251 |
+diff --git a/tests/unittests/net/test_net_rendering.py b/tests/unittests/net/test_net_rendering.py |
|
| 252 |
+new file mode 100644 |
|
| 253 |
+index 0000000000..06feab8914 |
|
| 254 |
+--- /dev/null |
|
| 255 |
+@@ -0,0 +1,101 @@ |
|
| 256 |
++"""Home of the tests for end-to-end net rendering |
|
| 257 |
++ |
|
| 258 |
++Tests defined here should take a v1 or v2 yaml config as input, and verify |
|
| 259 |
++that the rendered network config is as expected. Input files are defined |
|
| 260 |
++under `tests/unittests/net/artifacts` with the format of |
|
| 261 |
++ |
|
| 262 |
++<test_name><format>.yaml |
|
| 263 |
++ |
|
| 264 |
++For example, if my test name is "test_all_the_things" and I'm testing a |
|
| 265 |
++v2 format, I should have a file named test_all_the_things_v2.yaml. |
|
| 266 |
++ |
|
| 267 |
++If a renderer outputs multiple files, the expected files should live in |
|
| 268 |
++the artifacts directory under the given test name. For example, if I'm |
|
| 269 |
++expecting NetworkManager to output a file named eth0.nmconnection as |
|
| 270 |
++part of my "test_all_the_things" test, then in the artifacts directory |
|
| 271 |
++there should be a |
|
| 272 |
++`test_all_the_things/etc/NetworkManager/system-connections/eth0.nmconnection` |
|
| 273 |
++file. |
|
| 274 |
++ |
|
| 275 |
++To add a new nominal test, create the input and output files, then add the test |
|
| 276 |
++name to the `test_convert` test along with it's supported renderers. |
|
| 277 |
++ |
|
| 278 |
++Before adding a test here, check that it is not already represented |
|
| 279 |
++in `unittests/test_net.py`. While that file contains similar tests, it has |
|
| 280 |
++become too large to be maintainable. |
|
| 281 |
++""" |
|
| 282 |
++import glob |
|
| 283 |
++from enum import Flag, auto |
|
| 284 |
++from pathlib import Path |
|
| 285 |
++ |
|
| 286 |
++import pytest |
|
| 287 |
++ |
|
| 288 |
++from cloudinit import safeyaml |
|
| 289 |
++from cloudinit.net.netplan import Renderer as NetplanRenderer |
|
| 290 |
++from cloudinit.net.network_manager import Renderer as NetworkManagerRenderer |
|
| 291 |
++from cloudinit.net.network_state import NetworkState, parse_net_config_data |
|
| 292 |
++ |
|
| 293 |
++ARTIFACT_DIR = Path(__file__).parent.absolute() / "artifacts" |
|
| 294 |
++ |
|
| 295 |
++ |
|
| 296 |
++class Renderer(Flag): |
|
| 297 |
++ Netplan = auto() |
|
| 298 |
++ NetworkManager = auto() |
|
| 299 |
++ Networkd = auto() |
|
| 300 |
++ |
|
| 301 |
++ |
|
| 302 |
++@pytest.fixture(autouse=True) |
|
| 303 |
++def setup(mocker): |
|
| 304 |
++ mocker.patch("cloudinit.net.network_state.get_interfaces_by_mac")
|
|
| 305 |
++ |
|
| 306 |
++ |
|
| 307 |
++def _check_netplan( |
|
| 308 |
++ network_state: NetworkState, netplan_path: Path, expected_config |
|
| 309 |
++): |
|
| 310 |
++ if network_state.version == 2: |
|
| 311 |
++ renderer = NetplanRenderer(config={"netplan_path": netplan_path})
|
|
| 312 |
++ renderer.render_network_state(network_state) |
|
| 313 |
++ assert safeyaml.load(netplan_path.read_text()) == expected_config, ( |
|
| 314 |
++ f"Netplan config generated at {netplan_path} does not match v2 "
|
|
| 315 |
++ "config defined for this test." |
|
| 316 |
++ ) |
|
| 317 |
++ else: |
|
| 318 |
++ raise NotImplementedError |
|
| 319 |
++ |
|
| 320 |
++ |
|
| 321 |
++def _check_network_manager(network_state: NetworkState, tmp_path: Path): |
|
| 322 |
++ renderer = NetworkManagerRenderer() |
|
| 323 |
++ renderer.render_network_state( |
|
| 324 |
++ network_state, target=str(tmp_path / "no_matching_mac") |
|
| 325 |
++ ) |
|
| 326 |
++ expected_paths = glob.glob( |
|
| 327 |
++ str(ARTIFACT_DIR / "no_matching_mac" / "**/*.nmconnection"), |
|
| 328 |
++ recursive=True, |
|
| 329 |
++ ) |
|
| 330 |
++ for expected_path in expected_paths: |
|
| 331 |
++ expected_contents = Path(expected_path).read_text() |
|
| 332 |
++ actual_path = tmp_path / expected_path.split( |
|
| 333 |
++ str(ARTIFACT_DIR), maxsplit=1 |
|
| 334 |
++ )[1].lstrip("/")
|
|
| 335 |
++ assert ( |
|
| 336 |
++ actual_path.exists() |
|
| 337 |
++ ), f"Expected {actual_path} to exist, but it does not"
|
|
| 338 |
++ actual_contents = actual_path.read_text() |
|
| 339 |
++ assert expected_contents.strip() == actual_contents.strip() |
|
| 340 |
++ |
|
| 341 |
++ |
|
| 342 |
++@pytest.mark.parametrize( |
|
| 343 |
++ "test_name, renderers", |
|
| 344 |
++ [("no_matching_mac_v2", Renderer.Netplan | Renderer.NetworkManager)],
|
|
| 345 |
++) |
|
| 346 |
++def test_convert(test_name, renderers, tmp_path): |
|
| 347 |
++ network_config = safeyaml.load( |
|
| 348 |
++ Path(ARTIFACT_DIR, f"{test_name}.yaml").read_text()
|
|
| 349 |
++ ) |
|
| 350 |
++ network_state = parse_net_config_data(network_config["network"]) |
|
| 351 |
++ if Renderer.Netplan in renderers: |
|
| 352 |
++ _check_netplan( |
|
| 353 |
++ network_state, tmp_path / "netplan.yaml", network_config |
|
| 354 |
++ ) |
|
| 355 |
++ if Renderer.NetworkManager in renderers: |
|
| 356 |
++ _check_network_manager(network_state, tmp_path) |
| ... | ... |
@@ -1,6 +1,6 @@ |
| 1 | 1 |
Name: cloud-init |
| 2 |
-Version: 22.2.2 |
|
| 3 |
-Release: 2%{?dist}
|
|
| 2 |
+Version: 22.3 |
|
| 3 |
+Release: 1%{?dist}
|
|
| 4 | 4 |
Summary: Cloud instance init scripts |
| 5 | 5 |
Group: System Environment/Base |
| 6 | 6 |
License: GPLv3 |
| ... | ... |
@@ -9,13 +9,13 @@ Vendor: VMware, Inc. |
| 9 | 9 |
Distribution: Photon |
| 10 | 10 |
|
| 11 | 11 |
Source0: https://launchpad.net/cloud-init/trunk/%{version}/+download/%{name}-%{version}.tar.gz
|
| 12 |
-%define sha512 %{name}=18b75ebbb5e808e19df5ceddb6402cc881c33443fb169f736f54837254ba43836994f2392a26febbd8df3342b3467ee72759b6942cfeb96d07c0e452c11dd0bf
|
|
| 12 |
+%define sha512 %{name}=50675caf75d5b5535782b87d7bdefa92740f575bb82d86bf72ed696a00713da4c6e15f06b6001497e84f5ec11e0a90d7322d118cd5d931f57805af2ca43fc646
|
|
| 13 | 13 |
|
| 14 | 14 |
Patch0: cloud-init-azureds.patch |
| 15 | 15 |
Patch1: ds-identify.patch |
| 16 | 16 |
Patch2: ds-vmware-photon.patch |
| 17 | 17 |
Patch3: cloud-cfg.patch |
| 18 |
-Patch4: cc_set_hostname_fix.patch |
|
| 18 |
+Patch4: cloud-init-interface-match-without-mac.patch |
|
| 19 | 19 |
|
| 20 | 20 |
BuildRequires: python3-devel |
| 21 | 21 |
BuildRequires: systemd-devel |
| ... | ... |
@@ -41,6 +41,7 @@ BuildRequires: python3-configobj |
| 41 | 41 |
BuildRequires: python3-jsonpatch |
| 42 | 42 |
BuildRequires: python3-pytest |
| 43 | 43 |
BuildRequires: python3-jsonschema |
| 44 |
+BuildRequires: python3-pyserial |
|
| 44 | 45 |
%endif |
| 45 | 46 |
|
| 46 | 47 |
Requires: iproute2 |
| ... | ... |
@@ -60,6 +61,7 @@ Requires: python3-setuptools |
| 60 | 60 |
Requires: python3-xml |
| 61 | 61 |
Requires: python3-jsonschema |
| 62 | 62 |
Requires: python3-netifaces |
| 63 |
+Requires: python3-pyserial |
|
| 63 | 64 |
Requires: dhcp-client |
| 64 | 65 |
|
| 65 | 66 |
BuildArch: noarch |
| ... | ... |
@@ -104,9 +106,10 @@ echo -e 'CERT1\nLINE2\nLINE3\nCERT2\nLINE2\nLINE3' > "${crt_file}"
|
| 104 | 104 |
|
| 105 | 105 |
conf_file='%{_sysconfdir}/ca-certificates.conf'
|
| 106 | 106 |
|
| 107 |
-%define test_pkgs pytest-metadata unittest2 mock attrs iniconfig httpretty netifaces responses pytest-mock |
|
| 107 |
+%define pkglist1 pytest-metadata unittest2 mock attrs iniconfig |
|
| 108 |
+%define pkglist2 httpretty netifaces responses pytest-mock |
|
| 108 | 109 |
|
| 109 |
-pip3 install --upgrade %test_pkgs |
|
| 110 |
+pip3 install --upgrade %{pkglist1} %{pkglist2}
|
|
| 110 | 111 |
make check %{?_smp_mflags}
|
| 111 | 112 |
%endif |
| 112 | 113 |
|
| ... | ... |
@@ -134,6 +137,7 @@ rm -rf %{buildroot}
|
| 134 | 134 |
%dir %{_sharedstatedir}/cloud
|
| 135 | 135 |
%dir %{_sysconfdir}/cloud/templates
|
| 136 | 136 |
%doc %{_sysconfdir}/cloud/cloud.cfg.d/README
|
| 137 |
+%doc %{_sysconfdir}/cloud/clean.d/README
|
|
| 137 | 138 |
%{_sysconfdir}/dhcp/dhclient-exit-hooks.d/hook-dhclient
|
| 138 | 139 |
%{_sysconfdir}/NetworkManager/dispatcher.d/hook-network-manager
|
| 139 | 140 |
%config(noreplace) %{_sysconfdir}/cloud/templates/*
|
| ... | ... |
@@ -146,6 +150,9 @@ rm -rf %{buildroot}
|
| 146 | 146 |
%{_sysconfdir}/systemd/system/sshd-keygen@.service.d/disable-sshd-keygen-if-cloud-init-active.conf
|
| 147 | 147 |
|
| 148 | 148 |
%changelog |
| 149 |
+* Tue Aug 23 2022 Shivani Agarwal <shivania2@vmware.com> 22.3-1 |
|
| 150 |
+- Upgrade to v22.3 |
|
| 151 |
+- Add patch to fix interface matching when no MAC |
|
| 149 | 152 |
* Sat Aug 13 2022 Shreenidhi Shedi <sshedi@vmware.com> 22.2.2-2 |
| 150 | 153 |
- Fix hostname setting issue |
| 151 | 154 |
* Fri Jul 01 2022 Shreenidhi Shedi <sshedi@vmware.com> 22.2.2-1 |
| ... | ... |
@@ -9,7 +9,7 @@ Signed-off-by: Shreenidhi Shedi <sshedi@vmware.com> |
| 9 | 9 |
1 file changed, 125 insertions(+), 3 deletions(-) |
| 10 | 10 |
|
| 11 | 11 |
diff --git a/cloudinit/sources/DataSourceVMware.py b/cloudinit/sources/DataSourceVMware.py |
| 12 |
-index 6ef7c9d5..e886ea1e 100644 |
|
| 12 |
+index 80a01e89..9e4c70f1 100644 |
|
| 13 | 13 |
--- a/cloudinit/sources/DataSourceVMware.py |
| 14 | 14 |
+++ b/cloudinit/sources/DataSourceVMware.py |
| 15 | 15 |
@@ -73,6 +73,7 @@ import netifaces |
| ... | ... |
@@ -17,7 +17,7 @@ index 6ef7c9d5..e886ea1e 100644 |
| 17 | 17 |
from cloudinit import dmi |
| 18 | 18 |
from cloudinit import log as logging |
| 19 | 19 |
+from cloudinit.net import network_state |
| 20 |
- from cloudinit import sources, util |
|
| 20 |
+ from cloudinit import net, sources, util |
|
| 21 | 21 |
from cloudinit.subp import ProcessExecutionError, subp, which |
| 22 | 22 |
|
| 23 | 23 |
@@ -83,6 +84,7 @@ NOVAL = "No value found" |
| ... | ... |
@@ -189,6 +189,3 @@ index 6ef7c9d5..e886ea1e 100644 |
| 189 | 189 |
else: |
| 190 | 190 |
return sources.METADATA_UNKNOWN |
| 191 | 191 |
|
| 192 |
-2.35.1 |
|
| 193 |
- |
| 194 | 192 |
deleted file mode 100644 |
| ... | ... |
@@ -1,36 +0,0 @@ |
| 1 |
-From be635a7eaf7bd19177b7002aa2c793c78be77ecc Mon Sep 17 00:00:00 2001 |
|
| 2 |
-From: John Wolfe <jwolfe@vmware.com> |
|
| 3 |
-Date: Wed, 10 Aug 2022 07:20:28 -0700 |
|
| 4 |
-Subject: [PATCH] Properly check authorization on incoming guestOps requests |
|
| 5 |
- |
|
| 6 |
-Fix public pipe request checks. Only a SessionRequest type should |
|
| 7 |
-be accepted on the public pipe. |
|
| 8 |
- open-vm-tools/vgauth/serviceImpl/proto.c | 6 +++++- |
|
| 9 |
- 1 file changed, 5 insertions(+), 1 deletion(-) |
|
| 10 |
- |
|
| 11 |
-diff --git a/open-vm-tools/vgauth/serviceImpl/proto.c b/open-vm-tools/vgauth/serviceImpl/proto.c |
|
| 12 |
-index db7159e..c4f85b0 100644 |
|
| 13 |
-+++ b/open-vm-tools/vgauth/serviceImpl/proto.c |
|
| 14 |
-@@ -1,5 +1,5 @@ |
|
| 15 |
- /********************************************************* |
|
| 16 |
-- * Copyright (C) 2011-2016,2019-2021 VMware, Inc. All rights reserved. |
|
| 17 |
-+ * Copyright (c) 2011-2016,2019-2022 VMware, Inc. All rights reserved. |
|
| 18 |
- * |
|
| 19 |
- * This program is free software; you can redistribute it and/or modify it |
|
| 20 |
- * under the terms of the GNU Lesser General Public License as published |
|
| 21 |
-@@ -1201,6 +1201,10 @@ Proto_SecurityCheckRequest(ServiceConnection *conn, |
|
| 22 |
- VGAuthError err; |
|
| 23 |
- gboolean isSecure = ServiceNetworkIsConnectionPrivateSuperUser(conn); |
|
| 24 |
- |
|
| 25 |
-+ if (conn->isPublic && req->reqType != PROTO_REQUEST_SESSION_REQ) {
|
|
| 26 |
-+ return VGAUTH_E_PERMISSION_DENIED; |
|
| 27 |
-+ } |
|
| 28 |
-+ |
|
| 29 |
- switch (req->reqType) {
|
|
| 30 |
- /* |
|
| 31 |
- * This comes over the public connection; alwsys let it through. |
|
| 32 |
-2.6.2 |
|
| 33 |
- |
| ... | ... |
@@ -3,18 +3,20 @@ |
| 3 | 3 |
|
| 4 | 4 |
Summary: Usermode tools for VMware virts |
| 5 | 5 |
Name: open-vm-tools |
| 6 |
-Version: 12.0.5 |
|
| 7 |
-Release: 2%{?dist}
|
|
| 6 |
+Version: 12.1.0 |
|
| 7 |
+Release: 1%{?dist}
|
|
| 8 | 8 |
License: LGPLv2+ |
| 9 | 9 |
URL: https://github.com/vmware/open-vm-tools |
| 10 | 10 |
Group: Applications/System |
| 11 | 11 |
Vendor: VMware, Inc. |
| 12 | 12 |
Distribution: Photon |
| 13 | 13 |
|
| 14 |
-Source0: https://github.com/vmware/open-vm-tools/archive/%{name}-stable-%{version}.tar.gz
|
|
| 15 |
-%define sha512 %{name}=c5503caa8a6d4a7e0a18066781448bba4a800288b1a0e788204d57faf039cddfd297e809e006a5d37e336ba96bfc42ec6d33ab540c0ce62dd59c8a946df8d6ed
|
|
| 14 |
+Source0: https://github.com/vmware/open-vm-tools/archive/%{name}-stable-%{version}.tar.gz
|
|
| 15 |
+%define sha512 %{name}=9280decf20381de56174bfdbab9a86c525f992ce35eda499938c9b6b00e59a012a4410fd2972bbc52f8951bb071042cc7bf77fc1d687acc7980cc54a26461aed
|
|
| 16 |
+ |
|
| 16 | 17 |
Source1: https://gitlab.eng.vmware.com/photon-gosc/gosc-scripts/-/archive/%{gosc_ver}/gosc-scripts-%{gosc_ver}.tar.gz
|
| 17 | 18 |
%define sha512 %{gosc_scripts}-%{gosc_ver}=b88d46d480edf169f1e12b4a760d2b00d705dc428b3b5ec614cc9d323871ea501f7ebce2885a2e9aaf4a60662481c62d2504b471e58a7f6d0482fe9cfe76c4ec
|
| 19 |
+ |
|
| 18 | 20 |
Source2: vmtoolsd.service |
| 19 | 21 |
Source3: vgauthd.service |
| 20 | 22 |
|
| ... | ... |
@@ -22,11 +24,10 @@ Source3: vgauthd.service |
| 22 | 22 |
# If patch is taken from gosc-scripts repo, prefix it with 'gosc-' |
| 23 | 23 |
Patch0: ovt-linux-deployment.patch |
| 24 | 24 |
Patch1: gosc-root-password-update.patch |
| 25 |
-Patch2: CVE-2022-31676.patch |
|
| 26 | 25 |
|
| 27 | 26 |
%if "%{_arch}" == "aarch64"
|
| 28 | 27 |
# TODO: This must be removed once VMCI config is enabled in aarch64 kernel |
| 29 |
-Patch3: ovt-unknown-ioctl.patch |
|
| 28 |
+Patch2: ovt-unknown-ioctl.patch |
|
| 30 | 29 |
%endif |
| 31 | 30 |
|
| 32 | 31 |
BuildRequires: glib-devel |
| ... | ... |
@@ -63,18 +64,18 @@ Requires: systemd >= 239-23 |
| 63 | 63 |
VMware virtualization user mode tools |
| 64 | 64 |
|
| 65 | 65 |
%package devel |
| 66 |
-Summary: Header and development files for open-vm-tools |
|
| 66 |
+Summary: Header and development files for %{name}
|
|
| 67 | 67 |
Requires: %{name} = %{version}-%{release}
|
| 68 | 68 |
|
| 69 | 69 |
%description devel |
| 70 | 70 |
It contains the libraries and header files to create applications. |
| 71 | 71 |
|
| 72 | 72 |
%package sdmp |
| 73 |
-Summary: Service Discovery plugin for open-vm-tools |
|
| 73 |
+Summary: Service Discovery plugin for %{name}
|
|
| 74 | 74 |
Requires: %{name} = %{version}-%{release}
|
| 75 | 75 |
|
| 76 | 76 |
%description sdmp |
| 77 |
-The "open-vm-tools-sdmp" package contains a plugin for Service Discovery. |
|
| 77 |
+The "%{name}-sdmp" package contains a plugin for Service Discovery.
|
|
| 78 | 78 |
|
| 79 | 79 |
%package gosc |
| 80 | 80 |
Summary: GOSC scripts |
| ... | ... |
@@ -98,7 +99,7 @@ autoreconf -i |
| 98 | 98 |
--with-tirpc \ |
| 99 | 99 |
--enable-servicediscovery |
| 100 | 100 |
|
| 101 |
-make %{?_smp_mflags}
|
|
| 101 |
+%make_build |
|
| 102 | 102 |
|
| 103 | 103 |
%install |
| 104 | 104 |
#collecting hacks to manually drop the vmhgfs module |
| ... | ... |
@@ -109,14 +110,11 @@ install -p -m 644 %{SOURCE2} %{buildroot}/%{_unitdir}
|
| 109 | 109 |
install -p -m 644 %{SOURCE3} %{buildroot}/%{_unitdir}
|
| 110 | 110 |
|
| 111 | 111 |
cd %{name}
|
| 112 |
-make DESTDIR=%{buildroot} install %{?_smp_mflags}
|
|
| 112 |
+%make_install %{?_smp_mflags}
|
|
| 113 | 113 |
|
| 114 | 114 |
chmod -x %{buildroot}/etc/pam.d/vmtoolsd
|
| 115 | 115 |
find %{buildroot}%{_libdir} -name '*.la' -delete
|
| 116 | 116 |
|
| 117 |
-%check |
|
| 118 |
-make %{?_smp_mflags} check
|
|
| 119 |
- |
|
| 120 | 117 |
%post |
| 121 | 118 |
/sbin/ldconfig |
| 122 | 119 |
%systemd_post vgauthd.service vmtoolsd.service |
| ... | ... |
@@ -179,6 +177,8 @@ fi |
| 179 | 179 |
%{_datadir}/%{name}/%{gosc_scripts}
|
| 180 | 180 |
|
| 181 | 181 |
%changelog |
| 182 |
+* Sat Aug 27 2022 Shreenidhi Shedi <sshedi@vmware.com> 12.1.0-1 |
|
| 183 |
+- Upgrade to v12.1.0 |
|
| 182 | 184 |
* Wed Aug 17 2022 Shivani Agarwal <shivania2@vmware.com> 12.0.5-2 |
| 183 | 185 |
- Fix CVE-2022-31676 |
| 184 | 186 |
* Thu May 26 2022 Shivani Agarwal <shivania2@vmware.com> 12.0.5-1 |
| 185 | 187 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,51 @@ |
| 0 |
+Summary: Python serial port access library |
|
| 1 |
+Name: python3-pyserial |
|
| 2 |
+Version: 3.5 |
|
| 3 |
+Release: 1%{?dist}
|
|
| 4 |
+License: BSD |
|
| 5 |
+Vendor: VMware, Inc. |
|
| 6 |
+Group: Development/Libraries |
|
| 7 |
+Distribution: Photon |
|
| 8 |
+URL: http://pypi.python.org/pypi/pyserial |
|
| 9 |
+ |
|
| 10 |
+Source0: https://github.com/pyserial/pyserial/archive/refs/tags/pyserial-%{version}.tar.gz
|
|
| 11 |
+%define sha512 pyserial=c2a700f5e08905bdab070c95cec41d6d423c20d2a9648c8c2f048db86de72f39fe2b8df560172d5b9d480be44c35ff0799df8f1d684d3f41f8fc61174105256e |
|
| 12 |
+ |
|
| 13 |
+BuildRequires: python3-devel |
|
| 14 |
+BuildRequires: python3-setuptools |
|
| 15 |
+ |
|
| 16 |
+Requires: python3 |
|
| 17 |
+ |
|
| 18 |
+BuildArch: noarch |
|
| 19 |
+ |
|
| 20 |
+%description |
|
| 21 |
+This module encapsulates the access for the serial port. It provides backends |
|
| 22 |
+for standard Python running on Windows, Linux, BSD (possibly any POSIX |
|
| 23 |
+compliant system) and Jython. The module named "serial" automatically selects |
|
| 24 |
+the appropriate backend. |
|
| 25 |
+ |
|
| 26 |
+%prep |
|
| 27 |
+%autosetup -p1 -n pyserial-%{version}
|
|
| 28 |
+ |
|
| 29 |
+%build |
|
| 30 |
+%py3_build |
|
| 31 |
+ |
|
| 32 |
+%install |
|
| 33 |
+%py3_install |
|
| 34 |
+ |
|
| 35 |
+%if 0%{?with_check}
|
|
| 36 |
+%check |
|
| 37 |
+export PYTHONPATH=%{buildroot}%{python3_sitelib}
|
|
| 38 |
+%{python3} test/run_all_tests.py
|
|
| 39 |
+%endif |
|
| 40 |
+ |
|
| 41 |
+%files |
|
| 42 |
+%doc LICENSE.txt CHANGES.rst README.rst examples |
|
| 43 |
+%{python3_sitelib}/serial
|
|
| 44 |
+%{python3_sitelib}/pyserial-%{version}-py%{python3_version}.egg-info
|
|
| 45 |
+%{_bindir}/pyserial-miniterm
|
|
| 46 |
+%{_bindir}/pyserial-ports
|
|
| 47 |
+ |
|
| 48 |
+%changelog |
|
| 49 |
+* Mon Aug 29 2022 Shreenidhi Shedi <sshedi@vmware.com> 3.5-1 |
|
| 50 |
+- Initial build, needed for cloud-init >= v22.3 |