File size: 2,950 Bytes
f50dbbb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
diff --git a/.changes/next-release/bugfix-cloudwatch-5230.json b/.changes/next-release/bugfix-cloudwatch-5230.json
new file mode 100644
index 000000000000..88ca4e3ba078
--- /dev/null
+++ b/.changes/next-release/bugfix-cloudwatch-5230.json
@@ -0,0 +1,5 @@
+{
+  "type": "bugfix",
+  "category": "``cloudwatch``",
+  "description": "Rename ``get-o-tel-enrichment``, ``start-o-tel-enrichment``, and ``stop-o-tel-enrichment`` commands to ``get-otel-enrichment``, ``start-otel-enrichment``, and ``stop-otel-enrichment``. The old names are kept as hidden aliases for backward compatibility."
+}
diff --git a/.changes/next-release/cloudwatch-otel-rename.json b/.changes/next-release/cloudwatch-otel-rename.json
deleted file mode 100644
index d611abf8bab2..000000000000
--- a/.changes/next-release/cloudwatch-otel-rename.json
+++ /dev/null
@@ -1,7 +0,0 @@
-[
-    {
-        "category": "``cloudwatch``",
-        "description": "Rename ``get-o-tel-enrichment``, ``start-o-tel-enrichment``, and ``stop-o-tel-enrichment`` commands to ``get-otel-enrichment``, ``start-otel-enrichment``, and ``stop-otel-enrichment``. The old names are kept as hidden aliases for backward compatibility.",
-        "type": "bugfix"
-    }
-]
diff --git a/awscli/customizations/cloudwatch.py b/awscli/customizations/cloudwatch.py
index ea35d9738034..b8051d4da057 100644
--- a/awscli/customizations/cloudwatch.py
+++ b/awscli/customizations/cloudwatch.py
@@ -11,26 +11,20 @@
 # ANY KIND, either express or implied. See the License for the specific
 # language governing permissions and limitations under the License.
 from awscli.customizations.utils import make_hidden_command_alias
-from awscli.customizations.utils import rename_command
 
 
 def register_rename_otel_commands(event_emitter):
     event_emitter.register(
-        'building-command-table.cloudwatch',
-        rename_otel_commands
+        'building-command-table.cloudwatch', alias_otel_commands
     )
 
 
-def rename_otel_commands(command_table, **kwargs):
-    """Rename o-tel commands to otel, keeping o-tel as hidden aliases."""
-    renames = {
-        'get-o-tel-enrichment': 'get-otel-enrichment',
-        'start-o-tel-enrichment': 'start-otel-enrichment',
-        'stop-o-tel-enrichment': 'stop-otel-enrichment',
+def alias_otel_commands(command_table, **kwargs):
+    aliases = {
+        'get-otel-enrichment': 'get-o-tel-enrichment',
+        'start-otel-enrichment': 'start-o-tel-enrichment',
+        'stop-otel-enrichment': 'stop-o-tel-enrichment',
     }
-    for old_name, new_name in renames.items():
-        if old_name in command_table:
-            rename_command(command_table, old_name, new_name)
-            make_hidden_command_alias(
-                command_table, new_name, old_name
-            )
+    for existing_name, alias_name in aliases.items():
+        if existing_name in command_table:
+            make_hidden_command_alias(command_table, existing_name, alias_name)