project-lakitu: update cloud-init to 21.2

BUG=b/186856893
TEST=presubmit
RELEASE_NOTE=Update cloud-init to 21.2

Change-Id: I73f6f52adc4091d2823eaf2f8d3e0091fc848282
Reviewed-on: https://cos-review.googlesource.com/c/cos/overlays/board-overlays/+/17610
Tested-by: Cusky Presubmit Bot <presubmit@cos-infra-prod.iam.gserviceaccount.com>
Reviewed-by: Robert Kolchmeyer <rkolchmeyer@google.com>
diff --git a/project-lakitu/app-emulation/cloud-init/Manifest b/project-lakitu/app-emulation/cloud-init/Manifest
index c613182..3fa6a10 100644
--- a/project-lakitu/app-emulation/cloud-init/Manifest
+++ b/project-lakitu/app-emulation/cloud-init/Manifest
@@ -1,2 +1 @@
-DIST cloud-init-19.4.tar.gz 1091893 BLAKE2B 2ab8fef70b420c066d6d8f83871568eeac24f00879ecf3d58c3768dd809cff6a3b79c7e72d9a10204002101049ab86ab64f0c524362e00497a9222960ef380df SHA512 e69ea47eab41d69d64fa44102fbde59319da5f71a68f28a0f6ac65cd6866542b4fe58a71b84c903cfa9b1d2f26eb648cdf4de633b8df61e4f89c9fa4c2a2b1d3
-DIST cloud-init-20.1.tar.gz 1088152 BLAKE2B 1c075676bcf7454965beafaaa38f3cdf08f321ddd0303b7f710c49d2a69e0fb2ec8a81870a632b7504c47af6436555c97ea9fa9c8416955de78f8f551b5509b7 SHA512 ad28e4a0290165308ef2cdb8a935778ad99039978a204bee1098460de006bc3f375a3b81d0d72971fc4f4195d5d2ade9c648fb19e6d6eba12decf750dc54b6eb
+DIST cloud-init-21.2.tar.gz 1278878 BLAKE2B 74e07649a24fc85df54aafcd72797a05f0bdbcceb90fe90c6af7024da09e876780b67bb1d7963cd164d03e3151715944b1f3fd5709d3557ac341a09061409fcc SHA512 8cc24945efc6f16b3c64411c5e7e5b83582d337f1c3f546163d52c14a6177ff752e91ba1fec04b7ade800f921c2b79c04d032df62c2b4171930ca1fb74c49a7d
diff --git a/project-lakitu/app-emulation/cloud-init/cloud-init-20.1-r7.ebuild b/project-lakitu/app-emulation/cloud-init/cloud-init-20.1-r7.ebuild
deleted file mode 120000
index 1e276a9..0000000
--- a/project-lakitu/app-emulation/cloud-init/cloud-init-20.1-r7.ebuild
+++ /dev/null
@@ -1 +0,0 @@
-cloud-init-20.1.ebuild
\ No newline at end of file
diff --git a/project-lakitu/app-emulation/cloud-init/cloud-init-21.2-r1.ebuild b/project-lakitu/app-emulation/cloud-init/cloud-init-21.2-r1.ebuild
new file mode 120000
index 0000000..7e583fd
--- /dev/null
+++ b/project-lakitu/app-emulation/cloud-init/cloud-init-21.2-r1.ebuild
@@ -0,0 +1 @@
+cloud-init-21.2.ebuild
\ No newline at end of file
diff --git a/project-lakitu/app-emulation/cloud-init/cloud-init-20.1.ebuild b/project-lakitu/app-emulation/cloud-init/cloud-init-21.2.ebuild
similarity index 90%
rename from project-lakitu/app-emulation/cloud-init/cloud-init-20.1.ebuild
rename to project-lakitu/app-emulation/cloud-init/cloud-init-21.2.ebuild
index cd2e68d..c1c6b20 100644
--- a/project-lakitu/app-emulation/cloud-init/cloud-init-20.1.ebuild
+++ b/project-lakitu/app-emulation/cloud-init/cloud-init-21.2.ebuild
@@ -55,19 +55,22 @@
 	# Fix Gentoo support
 	# https://code.launchpad.net/~gilles-dartiguelongue/cloud-init/+git/cloud-init/+merge/358777
 	"${FILESDIR}/${PN}-18.4-fix-packages-module.patch"
-	"${FILESDIR}/${PN}-20.1-gentoo-support-upstream-templates.patch"
+	"${FILESDIR}/${PN}-21.2-gentoo-support-upstream-templates.patch"
 	"${FILESDIR}"/18.4-fix-filename-for-storing-locale.patch
 	"${FILESDIR}"/18.4-fix-update_package_sources-function.patch
 	"${FILESDIR}"/18.4-add-support-for-package_upgrade.patch
 
-	# Upstream fix for invalid request for ec2.
-	# Remove this after update for versions greater than 20.3
-	"${FILESDIR}"/20.1-ec2-redact-token-in-headers-not-request.patch
-
 	# For lakitu
-	"${FILESDIR}/${PV}-stable-uid.patch"
-	"${FILESDIR}/${PV}-fix-cross-compile.patch"
+	# Google Metadata Server
 	"${FILESDIR}/${PV}-datasource-gce-platform-google.patch"
+	"${FILESDIR}/${PV}-add-retries-gce-metadata-server.patch"
+
+	# Ensures the user added through cloud-init have UID in range [2000, 5000) 
+	"${FILESDIR}/${PV}-stable-uid.patch"
+        
+	"${FILESDIR}/${PV}-fix-cross-compile.patch"
+        
+	# Ensure we don't add ssh keys to the root user
 	"${FILESDIR}/${PV}-skip-root-ssh-keys.patch"
 )
 
@@ -78,7 +81,8 @@
 	else
 		PATCHES+=("${FILESDIR}/${PV}-remove-sshd-dependency.patch")
 	fi
-
+	
+        # Remove dhclient dependency on cloud-init
 	if use platform_azure; then
 		PATCHES+=("${FILESDIR}"/cloud-init-azure-remove-dhclient.patch)
 	fi
@@ -125,8 +129,8 @@
 pkg_postinst() {
 	# delete the default cloud.cfg to override in the cloud-init-config
 	rm -f -v "${ROOT}/etc/cloud/cloud.cfg"
-	
-        # [2000, 5000) are reserved for users created by clout-init.
+
+	# [2000, 5000) are reserved for users created by clout-init.
 	# Start from 5000 for automatic uid selection in useradd.
 	sed -i -r 's/^(UID_MIN\s+)1000/\15000/' "${ROOT}"/etc/login.defs
 
diff --git a/project-lakitu/app-emulation/cloud-init/files/20.1-ec2-redact-token-in-headers-not-request.patch b/project-lakitu/app-emulation/cloud-init/files/20.1-ec2-redact-token-in-headers-not-request.patch
deleted file mode 100644
index b9a8569..0000000
--- a/project-lakitu/app-emulation/cloud-init/files/20.1-ec2-redact-token-in-headers-not-request.patch
+++ /dev/null
@@ -1,111 +0,0 @@
-From: varsha teratipally <teratipally@google.com>
-Date: Mon, 15 Feb 2021 00:07:25 +0000
-Subject:Cherry-pick of an upstream patch
-https://github.com/canonical/cloud-init/pull/230/commits
-/8760e675a6be774e2ed9a8a97934fb3bd463b1c7
-
-From 8760e675a6be774e2ed9a8a97934fb3bd463b1c7 Mon Sep 17 00:00:00 2001
-From: Chad Smith <chad.smith@canonical.com>
-Date: Tue, 3 Mar 2020 06:42:15 -0700
-Subject: [PATCH] ec2: only redact token request headers in logs, avoid
- altering request
-
-Our header redact logic was redacting both logged request headers and
-the actual source request. This results in DataSourceEc2 sending the
-invalid header "X-aws-ec2-metadata-token-ttl-seconds: REDACTED" which
-gets an HTTP status response of 400.
-
-Cloud-init retries this failed token request for 2 minutes before
-falling back to IMDSv1.
-
-LP: #1865882
----
- cloudinit/tests/test_url_helper.py | 34 +++++++++++++++++++++++++++++-
- cloudinit/url_helper.py            | 15 +++++++------
- 2 files changed, 41 insertions(+), 8 deletions(-)
-
-diff --git a/cloudinit/tests/test_url_helper.py b/cloudinit/tests/test_url_helper.py
-index 1674120fb..29b39374a 100644
---- a/cloudinit/tests/test_url_helper.py
-+++ b/cloudinit/tests/test_url_helper.py
-@@ -1,7 +1,8 @@
- # This file is part of cloud-init. See LICENSE file for license information.
- 
- from cloudinit.url_helper import (
--    NOT_FOUND, UrlError, oauth_headers, read_file_or_url, retry_on_url_exc)
-+    NOT_FOUND, UrlError, REDACTED, oauth_headers, read_file_or_url,
-+    retry_on_url_exc)
- from cloudinit.tests.helpers import CiTestCase, mock, skipIf
- from cloudinit import util
- from cloudinit import version
-@@ -50,6 +51,9 @@ def sign(self, url):
- 
- 
- class TestReadFileOrUrl(CiTestCase):
-+
-+    with_logs = True
-+
-     def test_read_file_or_url_str_from_file(self):
-         """Test that str(result.contents) on file is text version of contents.
-         It should not be "b'data'", but just "'data'" """
-@@ -71,6 +75,34 @@ def test_read_file_or_url_str_from_url(self):
-         self.assertEqual(result.contents, data)
-         self.assertEqual(str(result), data.decode('utf-8'))
- 
-+    @httpretty.activate
-+    def test_read_file_or_url_str_from_url_redacting_headers_from_logs(self):
-+        """Headers are redacted from logs but unredacted in requests."""
-+        url = 'http://hostname/path'
-+        headers = {'sensitive': 'sekret', 'server': 'blah'}
-+        httpretty.register_uri(httpretty.GET, url)
-+
-+        read_file_or_url(url, headers=headers, headers_redact=['sensitive'])
-+        logs = self.logs.getvalue()
-+        for k in headers.keys():
-+            self.assertEqual(headers[k],  httpretty.last_request().headers[k])
-+        self.assertIn(REDACTED, logs)
-+        self.assertNotIn('sekret', logs)
-+
-+    @httpretty.activate
-+    def test_read_file_or_url_str_from_url_redacts_noheaders(self):
-+        """When no headers_redact, header values are in logs and requests."""
-+        url = 'http://hostname/path'
-+        headers = {'sensitive': 'sekret', 'server': 'blah'}
-+        httpretty.register_uri(httpretty.GET, url)
-+
-+        read_file_or_url(url, headers=headers)
-+        for k in headers.keys():
-+            self.assertEqual(headers[k], httpretty.last_request().headers[k])
-+        logs = self.logs.getvalue()
-+        self.assertNotIn(REDACTED, logs)
-+        self.assertIn('sekret', logs)
-+
-     @mock.patch(M_PATH + 'readurl')
-     def test_read_file_or_url_passes_params_to_readurl(self, m_readurl):
-         """read_file_or_url passes all params through to readurl."""
-diff --git a/cloudinit/url_helper.py b/cloudinit/url_helper.py
-index eeb27aa86..f3c0cf9c0 100644
---- a/cloudinit/url_helper.py
-+++ b/cloudinit/url_helper.py
-@@ -281,13 +281,14 @@ def _cb(url):
-         for (k, v) in req_args.items():
-             if k == 'data':
-                 continue
--            filtered_req_args[k] = v
--            if k == 'headers':
--                for hkey, _hval in v.items():
--                    if hkey in headers_redact:
--                        filtered_req_args[k][hkey] = (
--                            copy.deepcopy(req_args[k][hkey]))
--                        filtered_req_args[k][hkey] = REDACTED
-+            if k == 'headers' and headers_redact:
-+                matched_headers = [k for k in headers_redact if v.get(k)]
-+                if matched_headers:
-+                    filtered_req_args[k] = copy.deepcopy(v)
-+                    for key in matched_headers:
-+                        filtered_req_args[k][key] = REDACTED
-+            else:
-+                filtered_req_args[k] = v
-         try:
- 
-             if log_req_resp:
diff --git a/project-lakitu/app-emulation/cloud-init/files/20.1-remove-sshd-dependency.patch b/project-lakitu/app-emulation/cloud-init/files/20.1-remove-sshd-dependency.patch
deleted file mode 100644
index ae24c05..0000000
--- a/project-lakitu/app-emulation/cloud-init/files/20.1-remove-sshd-dependency.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From 1f3ff12272368b2b91daa4284de1607c88a69d75 Mon Sep 17 00:00:00 2001
-From: Wei Xu <weixugc@google.com>
-Date: Tue, 21 Jan 2020 17:35:43 -0800
-Subject: [PATCH] Remove sshd.service dependencies from cloud-init.service.
-
----
- systemd/cloud-init.service.tmpl | 4 ----
- 1 file changed, 4 deletions(-)
-
-diff --git a/systemd/cloud-init.service.tmpl b/systemd/cloud-init.service.tmpl
-index 9ad3574c..6a8592ed 100644
---- a/systemd/cloud-init.service.tmpl
-+++ b/systemd/cloud-init.service.tmpl
-@@ -3,8 +3,6 @@
- Description=Initial cloud-init job (metadata service crawler)
- DefaultDependencies=no
- Wants=cloud-init-local.service
--Wants=sshd-keygen.service
--Wants=sshd.service
- After=cloud-init-local.service
- After=systemd-networkd-wait-online.service
- {% if variant in ["ubuntu", "unknown", "debian"] %}
-@@ -21,8 +19,6 @@ After=wicked.service
- After=dbus.service
- {% endif %}
- Before=network-online.target
--Before=sshd-keygen.service
--Before=sshd.service
- {% if variant in ["ubuntu", "unknown", "debian"] %}
- Before=sysinit.target
- Conflicts=shutdown.target
--- 
-2.25.1.481.gfbce0eb801-goog
-
diff --git a/project-lakitu/app-emulation/cloud-init/files/20.1-add-retries-gce-metadata-server.patch b/project-lakitu/app-emulation/cloud-init/files/21.2-add-retries-gce-metadata-server.patch
similarity index 100%
rename from project-lakitu/app-emulation/cloud-init/files/20.1-add-retries-gce-metadata-server.patch
rename to project-lakitu/app-emulation/cloud-init/files/21.2-add-retries-gce-metadata-server.patch
diff --git a/project-lakitu/app-emulation/cloud-init/files/20.1-cloud-init-remove-sshd-and-network-service-dependencies.patch b/project-lakitu/app-emulation/cloud-init/files/21.2-cloud-init-remove-sshd-and-network-service-dependencies.patch
similarity index 63%
rename from project-lakitu/app-emulation/cloud-init/files/20.1-cloud-init-remove-sshd-and-network-service-dependencies.patch
rename to project-lakitu/app-emulation/cloud-init/files/21.2-cloud-init-remove-sshd-and-network-service-dependencies.patch
index 12bcec1..bda7a3b 100644
--- a/project-lakitu/app-emulation/cloud-init/files/20.1-cloud-init-remove-sshd-and-network-service-dependencies.patch
+++ b/project-lakitu/app-emulation/cloud-init/files/21.2-cloud-init-remove-sshd-and-network-service-dependencies.patch
@@ -1,18 +1,27 @@
-From:Varsh teratipally
-Subject: Removed network-pre.target and network-online.target as it was blocking
-the services that depend on network-online.target to start.
-Removed sshd server dependencies, if cloud-init fails, it will enable us to ssh
+From ee65a69ff12ab28ef8a44f35c7952d55c6c52fe9 Mon Sep 17 00:00:00 2001
+From: varsha teratipally <teratipally@google.com>
+Date: Sat, 5 Jun 2021 00:23:15 +0000
+Subject: [PATCH] Remove network and sshd dependencies
+
+removed network-pre.target and network-online.target as it was blocking
+the services that depend on network-online.target to start.Removed sshd
+server dependencies, if cloud-init fails, it will enable us to ssh
 and debug the issue.
+---
+ systemd/cloud-init-local.service.tmpl |  4 ----
+ systemd/cloud-init.service.tmpl       | 10 +++-------
+ 2 files changed, 3 insertions(+), 11 deletions(-)
 
 diff --git a/systemd/cloud-init-local.service.tmpl b/systemd/cloud-init-local.service.tmpl
-index ff9c644d..168f25d8 100644
+index 7166f640..168f25d8 100644
 --- a/systemd/cloud-init-local.service.tmpl
 +++ b/systemd/cloud-init-local.service.tmpl
-@@ -4,10 +4,7 @@ Description=Initial cloud-init job (pre-networking)
+@@ -4,11 +4,7 @@ Description=Initial cloud-init job (pre-networking)
  {% if variant in ["ubuntu", "unknown", "debian"] %}
  DefaultDependencies=no
  {% endif %}
 -Wants=network-pre.target
+-After=hv_kvp_daemon.service
  After=systemd-remount-fs.service
 -Before=NetworkManager.service
 -Before=network-pre.target
@@ -20,7 +29,7 @@
  {% if variant in ["ubuntu", "unknown", "debian"] %}
  Before=sysinit.target
 diff --git a/systemd/cloud-init.service.tmpl b/systemd/cloud-init.service.tmpl
-index 9ad3574c..3552c74e 100644
+index f140344d..9aec6816 100644
 --- a/systemd/cloud-init.service.tmpl
 +++ b/systemd/cloud-init.service.tmpl
 @@ -2,11 +2,10 @@
@@ -47,14 +56,16 @@
 +After=network-online.target
  {% if variant in ["ubuntu", "unknown", "debian"] %}
  Before=sysinit.target
- Conflicts=shutdown.target
-@@ -30,7 +27,6 @@ Conflicts=shutdown.target
- {% if variant in ["suse"] %}
+ Before=shutdown.target
+@@ -32,7 +29,6 @@ Conflicts=shutdown.target
+ Before=shutdown.target
  Conflicts=shutdown.target
  {% endif %}
 -Before=systemd-user-sessions.service
  
  [Service]
  Type=oneshot
- 
+-- 
+2.32.0.rc1.229.g3e70b5a671-goog
+
 
diff --git a/project-lakitu/app-emulation/cloud-init/files/20.1-datasource-gce-platform-google.patch b/project-lakitu/app-emulation/cloud-init/files/21.2-datasource-gce-platform-google.patch
similarity index 75%
rename from project-lakitu/app-emulation/cloud-init/files/20.1-datasource-gce-platform-google.patch
rename to project-lakitu/app-emulation/cloud-init/files/21.2-datasource-gce-platform-google.patch
index f6f826b..8217665 100644
--- a/project-lakitu/app-emulation/cloud-init/files/20.1-datasource-gce-platform-google.patch
+++ b/project-lakitu/app-emulation/cloud-init/files/21.2-datasource-gce-platform-google.patch
@@ -6,22 +6,20 @@
 This adds "Google" as a supported platform of DataSourceGCE, in
 addition to "Google Compute Engine".
 ---
- cloudinit/sources/DataSourceGCE.py | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
 diff --git a/cloudinit/sources/DataSourceGCE.py b/cloudinit/sources/DataSourceGCE.py
-index 7fb43c09..230ee51d 100644
+index 746caddb..8588e679 100644
 --- a/cloudinit/sources/DataSourceGCE.py
 +++ b/cloudinit/sources/DataSourceGCE.py
-@@ -254,7 +254,7 @@ def read_md(address=None, platform_check=True):
+@@ -250,7 +250,7 @@ def read_md(address=None, platform_check=True):
  
  def platform_reports_gce():
-     pname = util.read_dmi_data('system-product-name') or "N/A"
+     pname = dmi.read_dmi_data('system-product-name') or "N/A"
 -    if pname == "Google Compute Engine":
 +    if pname == "Google Compute Engine" or pname == "Google":
          return True
  
      # system-product-name is not always guaranteed (LP: #1674861)
+
 -- 
 2.25.1.481.gfbce0eb801-goog
 
diff --git a/project-lakitu/app-emulation/cloud-init/files/20.1-fix-cross-compile.patch b/project-lakitu/app-emulation/cloud-init/files/21.2-fix-cross-compile.patch
similarity index 100%
rename from project-lakitu/app-emulation/cloud-init/files/20.1-fix-cross-compile.patch
rename to project-lakitu/app-emulation/cloud-init/files/21.2-fix-cross-compile.patch
diff --git a/project-lakitu/app-emulation/cloud-init/files/21.2-remove-sshd-dependency.patch b/project-lakitu/app-emulation/cloud-init/files/21.2-remove-sshd-dependency.patch
new file mode 100644
index 0000000..933bf2b
--- /dev/null
+++ b/project-lakitu/app-emulation/cloud-init/files/21.2-remove-sshd-dependency.patch
@@ -0,0 +1,44 @@
+From acceba7c001c8711bf4205bf4ab8d004017d5f1b Mon Sep 17 00:00:00 2001
+From: varsha teratipally <teratipally@google.com>
+Original Author: Wei Xu <weixugc@google.com>
+Date: Sat, 5 Jun 2021 01:00:05 +0000
+Subject: [PATCH] Remove sshd service dependency and hv_kvp_daemon dep
+
+diff --git a/systemd/cloud-init.service.tmpl b/systemd/cloud-init.service.tmpl
+index 9ad3574c..6a8592ed 100644
+--- a/systemd/cloud-init-local.service.tmpl
++++ b/systemd/cloud-init-local.service.tmpl
+@@ -5,7 +5,6 @@ Description=Initial cloud-init job (pre-networking)
+ DefaultDependencies=no
+ {% endif %}
+ Wants=network-pre.target
+-After=hv_kvp_daemon.service
+ After=systemd-remount-fs.service
+ Before=NetworkManager.service
+ Before=network-pre.target
+diff --git a/systemd/cloud-init.service.tmpl b/systemd/cloud-init.service.tmpl
+index f140344d..f262cd7a 100644
+--- a/systemd/cloud-init.service.tmpl
++++ b/systemd/cloud-init.service.tmpl
+@@ -3,8 +3,6 @@
+ Description=Initial cloud-init job (metadata service crawler)
+ DefaultDependencies=no
+ Wants=cloud-init-local.service
+-Wants=sshd-keygen.service
+-Wants=sshd.service
+ After=cloud-init-local.service
+ After=systemd-networkd-wait-online.service
+ {% if variant in ["ubuntu", "unknown", "debian"] %}
+@@ -21,8 +19,6 @@ After=wicked.service
+ After=dbus.service
+ {% endif %}
+ Before=network-online.target
+-Before=sshd-keygen.service
+-Before=sshd.service
+ {% if variant in ["ubuntu", "unknown", "debian"] %}
+ Before=sysinit.target
+ Before=shutdown.target
+(END)
+-- 
+2.25.1.481.gfbce0eb801-goog
+
diff --git a/project-lakitu/app-emulation/cloud-init/files/20.1-skip-root-ssh-keys.patch b/project-lakitu/app-emulation/cloud-init/files/21.2-skip-root-ssh-keys.patch
similarity index 100%
rename from project-lakitu/app-emulation/cloud-init/files/20.1-skip-root-ssh-keys.patch
rename to project-lakitu/app-emulation/cloud-init/files/21.2-skip-root-ssh-keys.patch
diff --git a/project-lakitu/app-emulation/cloud-init/files/20.1-stable-uid.patch b/project-lakitu/app-emulation/cloud-init/files/21.2-stable-uid.patch
similarity index 100%
rename from project-lakitu/app-emulation/cloud-init/files/20.1-stable-uid.patch
rename to project-lakitu/app-emulation/cloud-init/files/21.2-stable-uid.patch
diff --git a/project-lakitu/app-emulation/cloud-init/files/cloud-init-19.4_CVE-2020-8631.patch b/project-lakitu/app-emulation/cloud-init/files/cloud-init-19.4_CVE-2020-8631.patch
deleted file mode 100644
index 625473c..0000000
--- a/project-lakitu/app-emulation/cloud-init/files/cloud-init-19.4_CVE-2020-8631.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From 42788bf24a1a0a5421a2d00a7f59b59e38ba1a14 Mon Sep 17 00:00:00 2001
-From: Ryan Harper <ryan.harper@canonical.com>
-Date: Fri, 24 Jan 2020 21:33:12 +0200
-Subject: [PATCH] cc_set_password: increase random pwlength from 9 to 20 (#189)
-
-Increasing the bits of security from 52 to 115.
-
-LP: #1860795
----
- cloudinit/config/cc_set_passwords.py | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/cloudinit/config/cc_set_passwords.py b/cloudinit/config/cc_set_passwords.py
-index e3b39d8be..4943d5453 100755
---- a/cloudinit/config/cc_set_passwords.py
-+++ b/cloudinit/config/cc_set_passwords.py
-@@ -236,7 +236,7 @@ def handle(_name, cfg, cloud, log, args):
-         raise errors[-1]
- 
- 
--def rand_user_password(pwlen=9):
-+def rand_user_password(pwlen=20):
-     return util.rand_str(pwlen, select_from=PW_SET)
- 
- 
diff --git a/project-lakitu/app-emulation/cloud-init/files/cloud-init-20.1-gentoo-support-upstream-templates.patch b/project-lakitu/app-emulation/cloud-init/files/cloud-init-20.1-gentoo-support-upstream-templates.patch
deleted file mode 100644
index c840f4f..0000000
--- a/project-lakitu/app-emulation/cloud-init/files/cloud-init-20.1-gentoo-support-upstream-templates.patch
+++ /dev/null
@@ -1,93 +0,0 @@
-From 823454f1ea140ec47f5f9c5c3c5ad62eb458eb8a Mon Sep 17 00:00:00 2001
-From: Gilles Dartiguelongue <eva@gentoo.org>
-Date: Wed, 24 Oct 2018 10:52:46 +0200
-Subject: [PATCH 2/5] Add support for gentoo in cloud.cfg and templates
-
----
- config/cloud.cfg.tmpl       |  8 ++++++--
- templates/hosts.gentoo.tmpl | 24 ++++++++++++++++++++++++
- tools/render-cloudcfg       |  2 +-
- 3 files changed, 31 insertions(+), 3 deletions(-)
- create mode 100644 templates/hosts.gentoo.tmpl
-
-diff --git a/config/cloud.cfg.tmpl b/config/cloud.cfg.tmpl
-index 1fef133a..3f5a41a2 100644
---- a/config/cloud.cfg.tmpl
-+++ b/config/cloud.cfg.tmpl
-@@ -134,7 +134,7 @@ cloud_final_modules:
- # (not accessible to handlers/transforms)
- system_info:
-    # This will affect which distro class gets used
--{% if variant in ["amazon", "arch", "centos", "debian", "fedora", "freebsd", "rhel", "suse", "ubuntu"] %}
-+{% if variant in ["amazon", "arch", "centos", "debian", "fedora", "freebsd", "gentoo", "rhel", "suse", "ubuntu"] %}
-    distro: {{ variant }}
- {% else %}
-    # Unknown/fallback distro.
-@@ -172,7 +172,7 @@ system_info:
-          primary: http://ports.ubuntu.com/ubuntu-ports
-          security: http://ports.ubuntu.com/ubuntu-ports
-    ssh_svcname: ssh
--{% elif variant in ["amazon", "arch", "centos", "fedora", "rhel", "suse"] %}
-+{% elif variant in ["amazon", "arch", "centos", "fedora", "gentoo", "rhel", "suse"] %}
-    # Default user name + that default users groups (if added/used)
-    default_user:
-      name: {{ variant }}
-@@ -180,6 +180,10 @@ system_info:
- {% endif %}
- {% if variant == "suse" %}
-      groups: [cdrom, users]
-+{% elif variant == "gentoo" %}
-+     groups: [users, wheel]
-+     primary_group: users
-+     no_user_group: true
- {% elif variant == "arch" %}
-      groups: [wheel, users]
- {% else %}
-diff --git a/templates/hosts.gentoo.tmpl b/templates/hosts.gentoo.tmpl
-new file mode 100644
-index 00000000..cd045fa6
---- /dev/null
-+++ b/templates/hosts.gentoo.tmpl
-@@ -0,0 +1,24 @@
-+## template:jinja
-+{#
-+This file /etc/cloud/templates/hosts.gentoo.tmpl is only utilized
-+if enabled in cloud-config.  Specifically, in order to enable it
-+you need to add the following to config:
-+  manage_etc_hosts: True
-+-#}
-+# Your system has configured 'manage_etc_hosts' as True.
-+# As a result, if you wish for changes to this file to persist
-+# then you will need to either
-+# a.) make changes to the master file in /etc/cloud/templates/hosts.gentoo.tmpl
-+# b.) change or remove the value of 'manage_etc_hosts' in
-+#     /etc/cloud/cloud.cfg or cloud-config from user-data
-+# 
-+# The following lines are desirable for IPv4 capable hosts
-+127.0.0.1 {{fqdn}} {{hostname}}
-+127.0.0.1 localhost.localdomain localhost
-+127.0.0.1 localhost4.localdomain4 localhost4
-+
-+# The following lines are desirable for IPv6 capable hosts
-+::1 {{fqdn}} {{hostname}}
-+::1 localhost.localdomain localhost
-+::1 localhost6.localdomain6 localhost6
-+
-diff --git a/tools/render-cloudcfg b/tools/render-cloudcfg
-index 8b7cb875..d109044e 100755
---- a/tools/render-cloudcfg
-+++ b/tools/render-cloudcfg
-@@ -4,7 +4,7 @@ import argparse
- import os
- import sys
- 
--VARIANTS = ["amazon", "arch", "centos", "debian", "fedora", "freebsd", "rhel",
--            "suse", "ubuntu", "unknown"]
-+VARIANTS = ["amazon", "arch", "centos", "debian", "fedora", "freebsd",
-+            "gentoo", "rhel", "suse", "ubuntu", "unknown"]
- 
- if "avoid-pep8-E402-import-not-top-of-file":
-     _tdir = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
--- 
-2.19.1
-
diff --git a/project-lakitu/app-emulation/cloud-init/files/cloud-init-19.4-gentoo-support-upstream-templates.patch b/project-lakitu/app-emulation/cloud-init/files/cloud-init-21.2-gentoo-support-upstream-templates.patch
similarity index 75%
rename from project-lakitu/app-emulation/cloud-init/files/cloud-init-19.4-gentoo-support-upstream-templates.patch
rename to project-lakitu/app-emulation/cloud-init/files/cloud-init-21.2-gentoo-support-upstream-templates.patch
index 210c294..fb4eed7 100644
--- a/project-lakitu/app-emulation/cloud-init/files/cloud-init-19.4-gentoo-support-upstream-templates.patch
+++ b/project-lakitu/app-emulation/cloud-init/files/cloud-init-21.2-gentoo-support-upstream-templates.patch
@@ -18,8 +18,12 @@
  # (not accessible to handlers/transforms)
  system_info:
     # This will affect which distro class gets used
--{% if variant in ["arch", "centos", "debian", "fedora", "freebsd", "rhel", "suse", "ubuntu"] %}
-+{% if variant in ["arch", "centos", "debian", "fedora", "freebsd", "gentoo", "rhel", "suse", "ubuntu"] %}
+-{% if variant in ["alpine", "amazon", "arch", "centos", "debian",
+-                  "fedora", "freebsd", "netbsd", "openbsd", "rhel",
+-                  "suse", "ubuntu"] %}
++{% if variant in ["alpine", "amazon", "arch", "centos", "debian",
++                  "fedora", "freebsd", "gentoo", "netbsd",
++                  "openbsd", "rhel", "suse", "ubuntu"] %}
     distro: {{ variant }}
  {% else %}
     # Unknown/fallback distro.
@@ -27,8 +31,10 @@
           primary: http://ports.ubuntu.com/ubuntu-ports
           security: http://ports.ubuntu.com/ubuntu-ports
     ssh_svcname: ssh
--{% elif variant in ["arch", "centos", "fedora", "rhel", "suse"] %}
-+{% elif variant in ["arch", "centos", "fedora", "gentoo", "rhel", "suse"] %}
+-{% elif variant in ["alpine", "amazon", "arch", "centos", "fedora",
+-                    "rhel", "suse"] %}
++{% elif variant in ["alpine", "amazon", "arch", "centos", "fedora",
++                    "gentoo", "rhel", "suse"] %}
     # Default user name + that default users groups (if added/used)
     default_user:
       name: {{ variant }}
@@ -81,10 +87,12 @@
  import os
  import sys
  
--VARIANTS = ["arch", "centos", "debian", "fedora", "freebsd", "rhel", "suse",
--            "ubuntu", "unknown"]
-+VARIANTS = ["arch", "centos", "debian", "fedora", "freebsd", "gentoo", "rhel",
-+            "suse", "ubuntu", "unknown"]
+-VARIANTS = ["alpine", "amazon", "arch", "centos", "debian", "fedora",
+-            "freebsd", "netbsd", "openbsd", "rhel", "suse", "ubuntu",
+-            "unknown"]
++VARIANTS = ["alpine", "amazon", "arch", "centos", "debian", "fedora",
++            "freebsd", "gentoo", "netbsd", "openbsd", "rhel", "suse",
++            "ubuntu", "unknown"]
  
  if "avoid-pep8-E402-import-not-top-of-file":
      _tdir = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
diff --git a/project-lakitu/app-emulation/cloud-init/files/cloud-init-azure-remove-dhclient.patch b/project-lakitu/app-emulation/cloud-init/files/cloud-init-azure-remove-dhclient.patch
index c8cd45b..967be5d 100644
--- a/project-lakitu/app-emulation/cloud-init/files/cloud-init-azure-remove-dhclient.patch
+++ b/project-lakitu/app-emulation/cloud-init/files/cloud-init-azure-remove-dhclient.patch
@@ -1,11 +1,19 @@
-Subject: cloud-init on azure required dhclient not to be 
-included in /tmp.
+From d9d724e36eea7d5464f4e55d27b7929beac0cc7f Mon Sep 17 00:00:00 2001
+From: varsha teratipally <teratipally@google.com>
+Date: Sat, 5 Jun 2021 00:56:19 +0000
+Subject: [PATCH] cloud-init on azure required dhclient not to be included in
+ /tmp.
+
+---
+ cloudinit/net/dhcp.py              | 6 +-----
+ cloudinit/sources/helpers/azure.py | 4 ++--
+ 2 files changed, 3 insertions(+), 7 deletions(-)
 
 diff --git a/cloudinit/net/dhcp.py b/cloudinit/net/dhcp.py
-index c033cc8..be60f6f 100644
+index 4394c68b..f21f0f3c 100644
 --- a/cloudinit/net/dhcp.py
 +++ b/cloudinit/net/dhcp.py
-@@ -205,13 +205,9 @@ def dhcp_discovery(dhclient_cmd_path, interface, cleandir):
+@@ -210,13 +210,9 @@ def dhcp_discovery(dhclient_cmd_path, interface, cleandir, dhcp_log_func=None):
      """
      LOG.debug('Performing a dhcp discovery on %s', interface)
  
@@ -19,34 +27,38 @@
      pid_file = os.path.join(cleandir, 'dhclient.pid')
      lease_file = os.path.join(cleandir, 'dhcp.leases')
  
-@@ -220,7 +216,7 @@ def dhcp_discovery(dhclient_cmd_path, interface, cleandir):
+@@ -231,7 +227,7 @@ def dhcp_discovery(dhclient_cmd_path, interface, cleandir, dhcp_log_func=None):
      # link up before attempting discovery. Since we are using -sf /bin/true,
      # we need to do that "link up" ourselves first.
-     util.subp(['ip', 'link', 'set', 'dev', interface, 'up'], capture=True)
+     subp.subp(['ip', 'link', 'set', 'dev', interface, 'up'], capture=True)
 -    cmd = [sandbox_dhclient_cmd, '-1', '-v', '-lf', lease_file,
 +    cmd = ['dhclient', '-1', '-v', '-lf', lease_file,
             '-pf', pid_file, interface, '-sf', '/bin/true']
-     util.subp(cmd, capture=True)
+     out, err = subp.subp(cmd, capture=True)
  
 diff --git a/cloudinit/sources/helpers/azure.py b/cloudinit/sources/helpers/azure.py
-index fc76058..869d462 100755
+index ad476076..dc192340 100755
 --- a/cloudinit/sources/helpers/azure.py
 +++ b/cloudinit/sources/helpers/azure.py
-@@ -90,7 +90,7 @@ def get_boot_telemetry():
-         raise RuntimeError("Failed to determine kernel start timestamp")
+@@ -112,7 +112,7 @@ def get_boot_telemetry():
+         ) from e
  
      try:
--        out, _ = util.subp(['/bin/systemctl',
-+        out, _ = util.subp(['systemctl',
+-        out, _ = subp.subp(['/bin/systemctl',
++        out, _ = subp.subp(['systemctl',
                              'show', '-p',
                              'UserspaceTimestampMonotonic'],
                             capture=True)
-@@ -112,7 +112,7 @@ def get_boot_telemetry():
-                            % e)
+@@ -135,7 +135,7 @@ def get_boot_telemetry():
+         ) from e
  
      try:
--        out, _ = util.subp(['/bin/systemctl', 'show',
-+        out, _ = util.subp(['systemctl', 'show',
+-        out, _ = subp.subp(['/bin/systemctl', 'show',
++        out, _ = subp.subp(['systemctl', 'show',
                              'cloud-init-local', '-p',
                              'InactiveExitTimestampMonotonic'],
                             capture=True)
+-- 
+2.32.0.rc1.229.g3e70b5a671-goog
+
+