OpenNebula config format question


(kvaps) #1

Hi, I have a question:
Which specific config format is OpenNebula use?

This format is uses everywhere begin from oned.conf file and end for VM and VNET templates.

Example:

ANIMAL = "dog"
ARRAY = [
  ANOTHER_VAR = "foo",
  NUM = "0",
  VAR1 = "abcabc",
  VAR2 = "dcedce" ]
BAR = "1234"
COLOR = "green"
FOO = "BAZBAZ"

I’ve tried to find some parser for that, but I was not succeed. The main problem that this fromat is not documented anywhere, the most suitable is “TOML” but still it is a bit different.

This is not looks like “JSON” or “YAML” and this is not “TOML”, so how can I parse it?
Thanks!


#2

Good question, related to https://forum.opennebula.org/t/feature-request-parsing-of-opennebula-conf-files


(Gandalf Corvotempesta) #3

I think it’s a simple ruby file, with variables and arrays used as configuration


(kvaps) #4

Are you sure?

Is there some oneline script for parse configs like this one?

For example:

  • How to get ARRAY["VAR1"] value?
  • How to remove ARRAY["VAR2"] secton from this config?
  • Or how to convert this config to json format, for make what ever I want with jq and convert it from json back

The example code should work with multidimensional array and handle any newlines (like opennebula do)