diff options
author | Michael DeHaan <mdehaan@redhat.com> | 2009-02-19 17:35:57 -0500 |
---|---|---|
committer | Michael DeHaan <mdehaan@redhat.com> | 2009-02-19 17:35:57 -0500 |
commit | 1ac1cd427551f527d03c7302b39b36627af95d1d (patch) | |
tree | 14eae64a8afc0e6f0ea9d13241c23a497255b1a1 /cobbler | |
parent | 61aaf51cf84f7388f9b8d3bc765b327f855900e9 (diff) | |
download | cobbler-1ac1cd427551f527d03c7302b39b36627af95d1d.tar.gz cobbler-1ac1cd427551f527d03c7302b39b36627af95d1d.tar.xz cobbler-1ac1cd427551f527d03c7302b39b36627af95d1d.zip |
Allow kernel options to start with '-' by fixing the YAML serializer to quote them.
Conflicts:
CHANGELOG
Diffstat (limited to 'cobbler')
-rw-r--r-- | cobbler/yaml/dump.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/cobbler/yaml/dump.py b/cobbler/yaml/dump.py index eb34955b..43d74d50 100644 --- a/cobbler/yaml/dump.py +++ b/cobbler/yaml/dump.py @@ -254,17 +254,17 @@ def quote(data): return str(data)
single = "'"
double = '"'
- quote = ''
+ mquote = ''
if len(data) == 0:
return "''"
if hasSpecialChar(data) or data[0] == single:
data = `data`[1:-1]
data = string.replace(data, r"\x08", r"\b")
- quote = double
+ mquote = double
elif needsSingleQuote(data):
- quote = single
+ mquote = single
data = doubleUpQuotes(data)
- return "%s%s%s" % (quote, data, quote)
+ return "%s%s%s" % (mquote, data, mquote)
def needsSingleQuote(data):
if re.match(r"^-?\d", data):
@@ -273,7 +273,7 @@ def needsSingleQuote(data): return 1
if data[0] in ['&', ' ']:
return 1
- if data[0] == '"':
+ if data[0] == '"' or data[0] == "'":
return 1
if data[-1] == ' ':
return 1
@@ -281,7 +281,7 @@ def needsSingleQuote(data): def hasSpecialChar(data):
# need test to drive out '#' from this
- return re.search(r'[\t\b\r\f#]', data)
+ return re.search(r'[-\t\b\r\f#]', data)
def isMulti(data):
if not isStr(data):
|