-
Notifications
You must be signed in to change notification settings - Fork 28
MTV-3443: MTV template methods #796
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
Merged
RichardHoch
merged 1 commit into
kubev2v:main
from
RichardHoch:MTV-3443_mtv_template_methods
Dec 3, 2025
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,146 @@ | ||
| // Module included in the following assemblies: | ||
| // | ||
| // * documentation/doc-Migrating_your_virtual_machines/assembly_migrating-from-vmware.adoc | ||
|
|
||
| :_content-type: CONCEPT | ||
| [id="mtv-template-utility_{context}"] | ||
| = {project-short} template utility for {vmw} VM names | ||
|
|
||
| [role="_abstract"] | ||
| You can use the template utility of {project-first} to generate names for your virtual machines (VMs). Using names generated by these methods reduces the possibilities of problems with your VMs after their migration to {virt}. | ||
|
|
||
| The tables that follow describe string and mathematical functions that you can use in templates that rename VMs for use with {project-short}. | ||
|
|
||
| [cols="1,1,1",options="header"] | ||
| .String functions | ||
|
|
||
| |=== | ||
| | Function | ||
| | Description | ||
| | Example | ||
|
|
||
| | `lower` | ||
| | Converts a string to lowercase. | ||
| | `{{ lower "TEXT" }}` → `text` | ||
|
|
||
| | `upper` | ||
| | Converts a string to uppercase. | ||
| | `{{ upper "text" }}` → `TEXT` | ||
|
|
||
| | `contains` | ||
| | Checks if a string contains a specific substring. | ||
| | `{{ contains "hello" "lo" }}` → `true` | ||
|
|
||
| | `replace` | ||
| | Replaces occurrences in a string. | ||
| | `{{"I Am Henry VIII" \| replace "{nbsp}" "-"}}`→ `I-Am-Henry-VIII` | ||
|
|
||
| | `trim` | ||
| | Removes whitespace from both ends of a string. | ||
| | `{{ trim " text " }}` → `text` | ||
|
|
||
| | `trimAll` | ||
| | Removes specified characters from both ends of a string. | ||
| | `{{ trimAll "$" "$5.00$" }}` → `5.00` | ||
|
|
||
| | `trimSuffix` | ||
| | Removes the specified suffix from a string, if it is present. | ||
| | `{{ trimSuffix ".go" "file.go" }}` → `file` | ||
|
|
||
| | `trimPrefix` | ||
| | Removes the specified prefix from a string, if it is present. | ||
| | `{{ trimPrefix "go." "go.file" }}` → `file` | ||
|
|
||
| | `title` | ||
| | Converts a string to title case. | ||
| | `{{ title "hello world" }}` → `Hello World` | ||
|
|
||
| | `untitle` | ||
| | Converts a string in title case to lowercase. | ||
| | `{{ untitle "Hello World" }}`→ `hello world` | ||
|
|
||
| | `repeat` | ||
| | Repeats a string _n_ times. | ||
| | `{{ repeat 3 "abc" }}` → `abcabcabc` | ||
|
|
||
| | `substr` | ||
| | Extracts substring from _index>=a_ to _b<index_. | ||
| | `{{ substr 1 4 "abcdef" }}` → `bcd` | ||
|
|
||
| | `nospace` | ||
| | Removes all whitespace from a string. | ||
| | `{{ nospace "a b c" }}` → `abc` | ||
|
|
||
| | `trunc` | ||
| | Truncates a string to specified length. | ||
| | `{{ trunc 3 "abcdef" }}` → `abc` | ||
|
|
||
| | `initials` | ||
| | Extracts the first letter of each word in a string. | ||
| | `{{ initials "John Doe" }} → `JD` | ||
|
|
||
| | `hasPrefix` | ||
| | Checks if a string starts with the specified prefix. | ||
| | `{{ hasPrefix "go" "golang" }}` → `true` | ||
|
|
||
| | `hasSuffix` | ||
| | Checks if a string ends with the specified suffix. | ||
| | `{{ hasSuffix "ing" "coding" }}` → `true` | ||
|
|
||
| | `mustRegexReplaceAll` | ||
| | Replaces matches using regular expressions with submatch expansion. | ||
| | `{{ mustRegexReplaceAll "a(x*)b" "-ab-axxb-" "${1}W" }}` → `-W-xxW-` | ||
| |=== | ||
|
|
||
| [cols="1,1,1",options="header"] | ||
| .Mathematical functions | ||
|
|
||
| |=== | ||
| | Function | ||
| | Description | ||
| | Example | ||
|
|
||
| | `add` | ||
| | Sum of the numbers that follow. | ||
| | `{{ add 1 2 3 }}` → `6` | ||
|
|
||
| | `add1` | ||
| | Increment by 1. | ||
| | `{{ add1 5 }}` → `6` | ||
|
|
||
| | `sub` | ||
| | Subtract the second number from the first. | ||
| | `{{ sub 5 3 }}` → `2` | ||
|
|
||
| | `div` | ||
| | Integer division (remainder discarded). | ||
| | `{{ div 10 3 }}`→`3` | ||
|
|
||
| | `mod` | ||
| | Modulo operation. | ||
| | `{{ mod 10 3 }}` → `1` | ||
|
|
||
| | `multiply` | ||
| | Multiply the numbers that follow. | ||
| | `{{ mul 2 3 4 }}` → `24` | ||
|
|
||
| | `max` | ||
| | Return the largest of the following integers. | ||
| | `{{ max 1 5 3 }}` → `5` | ||
|
|
||
| | `min` | ||
| | Return the smallest of the following integers. | ||
| | `{{ min 1 5 3 }}` → `1` | ||
|
|
||
| | `floor` | ||
| | Round the following number down to the nearest integer. | ||
| | `{{ floor 3.75 }}` → `3.0` | ||
|
|
||
| | `ceil` | ||
| | Round the following number up to the nearest integer. | ||
| | `{{ ceil 3.25 }}` → `4.0` | ||
|
|
||
| | `round` | ||
| | Round the following number to the specified number of decimal places. | ||
| | `{{ round 3.75159 2 }}` → `3.75` | ||
| |=== | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.