[Kimchi-devel] [PATCH 1/2] MockModel: Can't Generate Report if Name is not Given
Aline Manera
alinefm at linux.vnet.ibm.com
Sun Jul 13 14:52:57 UTC 2014
Reviewed-by: Aline Manera <alinefm at linux.vnet.ibm.com>
On 07/10/2014 12:31 PM, Hongliang Wang wrote:
> We'll generate a report name if name field is left blank in real case,
> though not in mock model. Added it in mock model to keep consistent.
>
> Signed-off-by: Hongliang Wang <hlwang at linux.vnet.ibm.com>
> ---
> src/kimchi/mockmodel.py | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/src/kimchi/mockmodel.py b/src/kimchi/mockmodel.py
> index a0920e0..be78ce8 100644
> --- a/src/kimchi/mockmodel.py
> +++ b/src/kimchi/mockmodel.py
> @@ -346,7 +346,13 @@ class MockModel(object):
> os.remove(file_target)
>
> def debugreports_create(self, params):
> - ident = params['name']
> + ident = params.get('name').strip()
> + # Generate a name with time and millisec precision, if necessary
> + if ident is None or ident == "":
> + ident = 'report-' + str(int(time.time() * 1000))
> + else:
> + if ident in self.debugreports_get_list():
> + raise InvalidParameter("KCHDR0008E", {"name": ident})
> taskid = self._gen_debugreport_file(ident)
> return self.task_lookup(taskid)
>
More information about the Kimchi-devel
mailing list