When performing "netplan try" or "netplan apply" on a network configuration with errors, netplan error out and message as follow :
$ netplan try --------------------- Error in network definition //etc/netplan/50-cloud-init.yaml line 6 column 4: unknown key xversion
An error occured: the configuration could not be generated ---------------------
$ netplan apply --------------------- Error in network definition //etc/netplan/50-cloud-init.yaml line 6 column 4: unknown key xversion ---------------------
While debugging the situation a little more I found out that it seems to come from here:
# src/generate.c --------------------- g_autofree char* glob_etc = g_strjoin(NULL, rootdir ?: "", G_DIR_SEPARATOR_S, "/etc/netplan/*.yaml", NULL); g_autofree char* glob_run = g_strjoin(NULL, rootdir ?: "", G_DIR_SEPARATOR_S, "/run/netplan/*.yaml", NULL); g_autofree char* glob_lib = g_strjoin(NULL, rootdir ?: "", G_DIR_SEPARATOR_S, "/lib/netplan/*.yaml", NULL); ---------------------
To prove my theory, as a debug exercise, I have modified netplan code to g_fprint() the variable when the above commands are executed:
$ netplan apply --------------------- glob_etc://etc/netplan/*.yaml glob_run://run/netplan/*.yaml glob_lib://lib/netplan/*.yaml Error in network definition //etc/netplan/50-cloud-init.yaml line 6 column 4: unknown key xversion ---------------------
$ netplan try --------------------- glob_etc://etc/netplan/*.yaml glob_run://run/netplan/*.yaml glob_lib://lib/netplan/*.yaml Error in network definition //etc/netplan/50-cloud-init.yaml line 6 column 4: unknown key xversion
Modifying "src/generate.c" by as follow : g_autofree char* glob_etc = g_strjoin(NULL, rootdir ?: "", G_DIR_SEPARATOR_S, "etc/netplan/*.yaml", NULL); g_autofree char* glob_run = g_strjoin(NULL, rootdir ?: "", G_DIR_SEPARATOR_S, "run/netplan/*.yaml", NULL); g_autofree char* glob_lib = g_strjoin(NULL, rootdir ?: "", G_DIR_SEPARATOR_S, "lib/netplan/*.yaml", NULL);
remove the double slashes "//" :
$ netplan apply Error in network definition /etc/netplan/50-cloud-init.yaml line 6 column 4: unknown key xversion
$ netplan try Error in network definition /etc/netplan/50-cloud-init.yaml line 6 column 4: unknown key xversion
An error occured: the configuration could not be generated
Obviously, more testing need to be done, but this indicate where the "//" come from.
When performing "netplan try" or "netplan apply" on a network configuration with errors, netplan error out and message as follow :
$ netplan try ------- ------- 50-cloud- init.yaml line 6 column 4: unknown key xversion
-------
Error in network definition //etc/netplan/
An error occured: the configuration could not be generated ------- -------
-------
$ netplan apply ------- ------- 50-cloud- init.yaml line 6 column 4: unknown key xversion ------- -------
-------
Error in network definition //etc/netplan/
-------
While debugging the situation a little more I found out that it seems to come from here:
# src/generate.c ------- ------- *.yaml" , NULL); *.yaml" , NULL); *.yaml" , NULL); ------- -------
-------
g_autofree char* glob_etc = g_strjoin(NULL, rootdir ?: "", G_DIR_SEPARATOR_S, "/etc/netplan/
g_autofree char* glob_run = g_strjoin(NULL, rootdir ?: "", G_DIR_SEPARATOR_S, "/run/netplan/
g_autofree char* glob_lib = g_strjoin(NULL, rootdir ?: "", G_DIR_SEPARATOR_S, "/lib/netplan/
-------
To prove my theory, as a debug exercise, I have modified netplan code to g_fprint() the variable when the above commands are executed:
$ netplan apply ------- ------- //etc/netplan/ *.yaml //run/netplan/ *.yaml //lib/netplan/ *.yaml 50-cloud- init.yaml line 6 column 4: unknown key xversion ------- -------
-------
glob_etc:
glob_run:
glob_lib:
Error in network definition //etc/netplan/
-------
$ netplan try ------- ------- //etc/netplan/ *.yaml //run/netplan/ *.yaml //lib/netplan/ *.yaml 50-cloud- init.yaml line 6 column 4: unknown key xversion
-------
glob_etc:
glob_run:
glob_lib:
Error in network definition //etc/netplan/
An error occured: the configuration could not be generated ------- -------
-------
Modifying "src/generate.c" by as follow : *.yaml" , NULL); *.yaml" , NULL); *.yaml" , NULL);
g_autofree char* glob_etc = g_strjoin(NULL, rootdir ?: "", G_DIR_SEPARATOR_S, "etc/netplan/
g_autofree char* glob_run = g_strjoin(NULL, rootdir ?: "", G_DIR_SEPARATOR_S, "run/netplan/
g_autofree char* glob_lib = g_strjoin(NULL, rootdir ?: "", G_DIR_SEPARATOR_S, "lib/netplan/
remove the double slashes "//" :
$ netplan apply 50-cloud- init.yaml line 6 column 4: unknown key xversion
Error in network definition /etc/netplan/
$ netplan try 50-cloud- init.yaml line 6 column 4: unknown key xversion
Error in network definition /etc/netplan/
An error occured: the configuration could not be generated
Obviously, more testing need to be done, but this indicate where the "//" come from.