yAnTar yAnTar - 3 months ago 10
YAML Question

What means @ in prefs.yml (vagrant config)

Yesterday I had issue with setup vagrant. Vagrant config was created by devops. This is part of

prefs.yml
file

vms:
trinidad:
memory: 1536
domains:
- trinidad.dev
mounts:
trinidad@: trinidad


I noticed 1 interesting thing - using symbol
@
in mounts section.
I tried to find what it meant. One thing, which I found - this is sentence from Wikipedia article - Two additional sigil characters are reserved in YAML for possible future standardisation: the at sign ( @ ) and accent grave ( ` ).

And nothing more. Our devops tried to explain me that this symbol uses for node.js, but I didn't understand him, because he explained in very strange way.

Answer

Although @ is a reserved character in YAML, it is only so as a directive indicator (scroll a bit up from the example). Which means that it has to come at the beginning of a scalar (and you can quote the scalar if it starts with @: "@some_scalar").

In your example the @ is not special for YAML, and the key trinidad@ is handed to vagrant as is and, if at all, interpreted there (I have not found any documentation that shows it is).

Comments