qvm-template: Replace newlines in machine-readable output.
This commit is contained in:
parent
ed35802ca2
commit
ba7b113206
@ -898,7 +898,7 @@ def list_templates(args: argparse.Namespace,
|
|||||||
outputs.append((status, output))
|
outputs.append((status, output))
|
||||||
return outputs
|
return outputs
|
||||||
|
|
||||||
def info_to_machine_output(tpls):
|
def info_to_machine_output(tpls, replace_newline=True):
|
||||||
outputs = []
|
outputs = []
|
||||||
for status, grp in itertools.groupby(tpls, lambda x: x[0]):
|
for status, grp in itertools.groupby(tpls, lambda x: x[0]):
|
||||||
output = []
|
output = []
|
||||||
@ -908,7 +908,8 @@ def list_templates(args: argparse.Namespace,
|
|||||||
dlsize = str(dlsize)
|
dlsize = str(dlsize)
|
||||||
buildtime = str(buildtime)
|
buildtime = str(buildtime)
|
||||||
install_time = str(install_time) if install_time else ''
|
install_time = str(install_time) if install_time else ''
|
||||||
# TODO: Escape newlines in description?
|
if replace_newline:
|
||||||
|
description = description.replace('\n', '|')
|
||||||
output.append((name, epoch, version, release, reponame,
|
output.append((name, epoch, version, release, reponame,
|
||||||
dlsize, buildtime, install_time, licence, url, summary,
|
dlsize, buildtime, install_time, licence, url, summary,
|
||||||
description))
|
description))
|
||||||
|
Loading…
Reference in New Issue
Block a user