Skip to content

Commit

Permalink
new namespace (#3139)
Browse files Browse the repository at this point in the history
  • Loading branch information
nagworld9 authored Jun 10, 2024
1 parent 81140ee commit 49d3ce3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def update(self, template: Dict[str, Any], is_lisa_template: bool) -> None:
#
encoded_script = base64.b64encode(AgentWaitForCloudInit.CloudInitScript.encode('utf-8')).decode('utf-8')

get_os_profile = self.get_lisa_function(template, 'getOSProfile')
get_os_profile = self.get_lisa_function(template, 'getOsProfile')
output = self.get_function_output(get_os_profile)
if output.get('customData') is not None:
raise Exception(f"The getOSProfile function already has a 'customData'. Won't override it. Definition: {get_os_profile}")
Expand Down
5 changes: 3 additions & 2 deletions tests_e2e/tests/lib/update_arm_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ def get_resource_by_name(resources: Dict[str, Dict[str, Any]], resource_name: st
@staticmethod
def get_lisa_function(template: Dict[str, Any], function_name: str) -> Dict[str, Any]:
"""
Looks for the given function name in the LISA namespace and returns its definition. Raises KeyError if the function is not found.
Looks for the given function name in the bicep namespace and returns its definition. Raises KeyError if the function is not found.
Note: LISA leverages the bicep language to define the ARM templates.Now namespace is changed to __bicep instead lisa
"""
#
# NOTE: LISA's functions are in the "lisa" namespace, for example:
Expand Down Expand Up @@ -96,7 +97,7 @@ def get_lisa_function(template: Dict[str, Any], function_name: str) -> Dict[str,
name = namespace.get("namespace")
if name is None:
raise Exception(f'Cannot find "namespace" in the LISA template: {namespace}')
if name == "lisa":
if name == "__bicep":
lisa_functions = namespace.get('members')
if lisa_functions is None:
raise Exception(f'Cannot find the members of the lisa namespace in the LISA template: {namespace}')
Expand Down

0 comments on commit 49d3ce3

Please sign in to comment.