Skip to content

Commit

Permalink
module_utils.modules: expose module.params as a readonly dict
Browse files Browse the repository at this point in the history
Use a MappingProxyType without backend to ensure the `module.params`
dict is readonly.
  • Loading branch information
goneri committed Oct 19, 2022
1 parent 6d1b2ea commit 7c7adf6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions plugins/module_utils/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
import os
import re
import traceback

from types import MappingProxyType

try:
from cStringIO import StringIO
Expand Down Expand Up @@ -120,6 +120,7 @@ def __init__(self, **kwargs):
kwargs["argument_spec"] = argument_spec_full

self._module = AnsibleAWSModule.default_settings["module_class"](**kwargs)
self._ro_params = MappingProxyType(self._module.params)

if local_settings["check_boto3"]:
if not HAS_BOTO3:
Expand Down Expand Up @@ -171,7 +172,7 @@ def __init__(self, **kwargs):

@property
def params(self):
return self._module.params
return self._ro_params

def _get_resource_action_list(self):
actions = []
Expand Down

0 comments on commit 7c7adf6

Please sign in to comment.