Commit 166df605 authored by Scott Moser's avatar Scott Moser

fix decoding of utf-8 chars in yaml test

Python 3 would fail to load yaml from doc/examples/cloud-config-apt.txt
when the LANG (specifically LC_CTYPE) was 'C'.

The changes here do 2 things:
 a.) remove the non-ascii characters from the yaml file.
 b.) fix the validate-yaml.py program to decode using utf-8 specifically
     rather than using the inherited settings.

This fixes it now for ascii and in the future also should non-ascii slip in.
parent f6d5dc48
......@@ -70,7 +70,7 @@ apt:
# modifications have been made.
# Suites are even disabled if no other modification was made,
# but not if is preserve_sources_list is active.
# There is a special alias “$RELEASE” as in the sources that will be replace
# There is a special alias "$RELEASE" as in the sources that will be replace
# by the matching release.
#
# To ease configuration and improve readability the following common ubuntu
......@@ -84,7 +84,7 @@ apt:
# There is no harm in specifying a suite to be disabled that is not found in
# the source.list file (just a no-op then)
#
# Note: Lines dont get deleted, but disabled by being converted to a comment.
# Note: Lines don't get deleted, but disabled by being converted to a comment.
# The following example disables all usual defaults except $RELEASE-security.
# On top it disables a custom suite called "mysuite"
disable_suites: [$RELEASE-updates, backports, $RELEASE, mysuite]
......
......@@ -12,8 +12,8 @@ if __name__ == "__main__":
for fn in sys.argv[1:]:
sys.stdout.write("%s" % (fn))
try:
fh = open(fn, 'r')
yaml.safe_load(fh.read())
fh = open(fn, 'rb')
yaml.safe_load(fh.read().decode('utf-8'))
fh.close()
sys.stdout.write(" - ok\n")
except Exception as e:
......
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