canonical / canonical/cloud-init

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

Open
#6,154 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
3.8k
Forks
1.1k
Avg merge
2d 23h
Merged PRs (30d)
18

Description

# 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
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.