Azure / Azure/SAP-automation-samples
BoM j2 files - NW750SPS25_JAVA_HANA_v0001ms / NW750SPS25_JAVA_HANA_v0002ms
- Dominant language
- Jinja
- Stars
- 23
- Forks
- 39
- Avg merge
- 3m
- Merged PRs (30d)
- 1
Description
Hey Team - we used these two BoM's and we got an error in the installations phase of the scs instance.
BoMs:
SAP/NW750SPS25_JAVA_HANA_v0001ms/templates/NW750SPS25_JAVA_HANA_v0001ms-scs-inifile-param.j2
SAP/NW750SPS25_JAVA_HANA_v0001ms/templates/NW750SPS25_JAVA_HANA_v0002ms-scs-inifile-param.j2
Error Message:
```
TASK [roles-sap/3.3.1-bom-utility : 3.3.1 BoM Template processing: Create ini file NW750SPS25_JAVA_HANA_v0002ms-scs-xxx-xyz.params from NW750SPS25_JAVA_HANA_v0002ms-scs-inifile-param.j2] ***
task path: /home/azureadm/agent/_work/5/s/sap-automation/deploy/ansible/roles-sap/3.3.1-bom-utility/tasks/bom-template.yaml:71
The full traceback is:
Traceback (most recent call last):
File "/opt/ansible/venv/2.15/lib/python3.10/site-packages/ansible/template/__init__.py", line 1015, in do_template
res = myenv.concat(rf)
File "/opt/ansible/venv/2.15/lib/python3.10/site-packages/ansible/template/native_helpers.py", line 83, in ansible_concat
return ''.join([to_text(v) for v in nodes])
File "/opt/ansible/venv/2.15/lib/python3.10/site-packages/ansible/template/native_helpers.py", line 83, in
return ''.join([to_text(v) for v in nodes])
File "", line 39, in root
File "/opt/ansible/venv/2.15/lib/python3.10/site-packages/ansible/template/__init__.py", line 295, in wrapper
ret = func(*args, **kwargs)
File "/opt/ansible/venv/2.15/lib/python3.10/site-packages/ansible/template/__init__.py", line 558, in _ansible_finalize
return thing if _fail_on_undefined(thing) is not None else ''
File "/opt/ansible/venv/2.15/lib/python3.10/site-packages/ansible/template/__init__.py", line 530, in _fail_on_undefined
elif is_sequence(data):
File "/opt/ansible/venv/2.15/lib/python3.10/site-packages/ansible/module_utils/common/collections.py", line 94, in is_sequence
if not include_strings and is_string(seq):
File "/opt/ansible/venv/2.15/lib/python3.10/site-packages/jinja2/runtime.py", line 857, in _fail_with_undefined_error
raise self._undefined_exception(self._undefined_message)
jinja2.exceptions.UndefinedError: 'scs_hostname' is undefined
```
We fixed the issue by setting the value from "scs_hostname" to "sap_scs_hostname".
```
58 # You can specify a virtual host name for the ASCS instance. Leave empty for default.
59 NW_SCS_Instance.scsVirtualHostname = {{ sap_scs_hostname }}
```
We tested this on a test machine and it passed successfully with the change.
Contributor guide
Research direction
Inspect the two named templates, NW750SPS25_JAVA_HANA_v0001ms/templates/NW750SPS25_JAVA_HANA_v0001ms-scs-inifile-param.j2 and NW750SPS25_JAVA_HANA_v0002ms/templates/NW750SPS25_JAVA_HANA_v0002ms-scs-inifile-param.j2, and the bom-template task at deploy/ansible/roles-sap/3.3.1-bom-utility/tasks/bom-template.yaml:71. Re-run the SCS installation or template-processing path; done means both templates generate their .params files without an undefined-variable error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ansible
- Domain
- infrastructure
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100