Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new namespace in last template functions #3139

Merged
merged 1 commit into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading