cloud-init icon indicating copy to clipboard operation
cloud-init copied to clipboard

[enhancement]: reset_rmc module should check for IBM platform and bail if not IBM.

Open ani-sinha opened this issue 8 months ago • 1 comments

Enhancement

cc_reset_rmc module is only for IBM PowerVM Hypervisor. The module does not check if its actually running on IBM cloud platform. This check should be added. Perhaps something like this?

diff --git a/cloudinit/config/cc_reset_rmc.py b/cloudinit/config/cc_reset_rmc.py
index c6ce4881c..f2c563d5e 100644
--- a/cloudinit/config/cc_reset_rmc.py
+++ b/cloudinit/config/cc_reset_rmc.py
@@ -33,6 +33,7 @@ from cloudinit.config import Config
 from cloudinit.config.schema import MetaSchema
 from cloudinit.distros import ALL_DISTROS
 from cloudinit.settings import PER_INSTANCE
+from cloudinit.sources.DataSourceIBMCloud import get_ibm_platform
 
 meta: MetaSchema = {
     "id": "cc_reset_rmc",
@@ -63,6 +64,11 @@ def handle(name: str, cfg: Config, cloud: Cloud, args: list) -> None:
         LOG.debug("Skipping creation of new ct_node_id node")
         return
 
+    ibm_platform, _ = get_ibm_platform()
+    if not ibm_platform:
+        LOG.debug("module disabled: not IBM platform")
+        return
+
     if not os.path.isdir(RSCT_PATH):
         LOG.debug("module disabled, RSCT_PATH not present")
         return

ani-sinha avatar Apr 08 '25 06:04 ani-sinha

cc: @smoser @Aman306 See also https://github.com/canonical/cloud-init/pull/584

ani-sinha avatar Apr 08 '25 06:04 ani-sinha