Commit 5a7cb9d3 authored by Iustin Pop's avatar Iustin Pop
Browse files

Ignore empty/comment lines in OS variants file

Per a conversation on

  - gnt-os diagnose ; gnt-os list take in consideration blank lines in
   /etc/ganeti/instance-image/variants.list that could be confusing.

Let's fix this and also let's ignore comment lines.
Signed-off-by: default avatarIustin Pop <>
Reviewed-by: default avatarMichael Hanselmann <>
parent e1c701e7
......@@ -2,7 +2,7 @@ News
Version 2.7.0 beta0
Version 2.7.0 beta1
......@@ -22,6 +22,9 @@ Version 2.7.0 beta0
allowing files to be created in arbitrary locations. The RPC protocol
is protected using SSL/X.509 certificates, but as a design principle
Ganeti does not permit arbitrary paths to be passed.
- The parsing of the variants file for OSes (see
:manpage:`ganeti-os-interfac7(8)` has been slightly changed: now empty
lines and comment lines are ignored for better readability.
Version 2.6.1
......@@ -2291,7 +2291,8 @@ def _TryOSFromDisk(name, base_dir=None):
if constants.OS_VARIANTS_FILE in os_files:
variants_file = os_files[constants.OS_VARIANTS_FILE]
variants = utils.ReadFile(variants_file).splitlines()
variants = \
except EnvironmentError, err:
# we accept missing files, but not other errors
if err.errno != errno.ENOENT:
......@@ -265,6 +265,8 @@ variants.list is a plain text file containing all the declared supported
variants for this OS, one per line. If this file is missing or empty,
then the OS won't be considered to support variants.
Empty lines and lines starting with a hash (``#``) are ignored.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment