Add a domain name if not present in a vm's name
Tested and works for me...
Purpose explained in #355
Two new params. Intended to handle these types of things:
- shortname -> shortname.example.com (add domain)
- foo.site1 -> foo.site1.example.com (add domain)
- foo.site2.example.com -> foo.site2.example.com (no change)
- foobar.example.net -> foobar.example.net
For when names in vCenter have an implied domain if not included.
Hi,
This would be a great addition. I'm afraid that it would not cover the case where one would only assign a missing domain to certain VMs. Could you change it to work the same way as existing relations?
You mean something like this?
vm_domain_name_relation = ^[a-z]\.foo$ = example.net, ^[a-z]-bar$ = example.com
Replacing simple add_vm_domain_name with:
vm_domain_name_relation = .* = example.net
Should that still have the keep_vm_domain_name_filter regex param to skip things that already have a domain name on them?
Sorry @eric-eisenhart I missed your comment.
the first example looks good to me. Would need to craft your config precisely. And if the relation matches but the correct domain name is already part of the VM name then it would not add the domain name again.
What do you think?