- Community Home
- >
- Software
- >
- HPE Morpheus Software
- >
- HPE Morpheus Enterprise Software
- >
- Catalog Item Morpheus Variable Evaluation - Unexpe...
Categories
Company
Local Language
Forums
Discussions
- Integrity Servers
- Server Clustering
- HPE NonStop Compute
- HPE Apollo Systems
- High Performance Computing
Knowledge Base
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Knowledge Base
Forums
Discussions
- Cloud Mentoring and Education
- Software - General
- HPE OneView
- HPE Ezmeral Software platform
- HPE OpsRamp Software
Knowledge Base
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2022 07:21 AM
04-27-2022 07:21 AM
Catalog Item Morpheus Variable Evaluation - Unexpected behaviour with "\\"
In Morpheus you may need to be careful when using \\ within the context of Morpheus variable evaluation, as it could result in unexpected behaviour. In the future this might not be necessary, however I am writing this incase anyone else hits this behaviour. On writing this, the latest Morpheus version is 5.4.5-2.
I was recently investigating an issue for a customer where <%= customOptions.group.split('\\|')[0] %> was evaluating to “1” instead of “10” when getting used within a Catalog Item where customOptions.group was equal to “10|VMware”. <%= customOptions.group.split('\\|')[0] %> was correctly evaluating to “10” elsewhere within Morpheus.
When evaluating catalog item config variables, Morpheus does some preemptive escaping for certain character sets. In this case, the \\ characters were being replaced with a specific charset. This was breaking the expected .split() functionality and as such, Groovy was returning each character within “10|VMware” within the returned List. Consequently, customOptions.group.split('\\|')[0] would evaluate to the ID “1”, which was not a group available within the customers environment.
For this use-case, changing .split('\\|') to .split(/[|]/) or .tokenize('|'), will avoid the escaped \\ and can achieve the desired functionality for splitting the output on the | character.
If you are experiencing unexpected behaviour with Variable evaluation and you are using \\, consider using a different syntax to achieve the same goal as \\ may be getting replaced before the Variable is evaluated.
Thanks