[Kimchi-devel] [PATCH v2] Report debug report's file path instead of uri path.
Aline Manera
alinefm at linux.vnet.ibm.com
Thu Mar 13 13:18:20 UTC 2014
On 03/13/2014 06:27 AM, Mark Wu wrote:
> Now the file path displayed on UI is "/data/debugreports/<reportname>/",
> It's misleading because people could assume it's path on file system,
> but it's the uri path in fact. We don't need expose the URI path because
> the download button can help user to get the file.
This is that way because we don't like to expose host file system
structure to the user.
> ---
> docs/API.md | 3 ++-
> src/kimchi/control/debugreports.py | 1 +
> src/kimchi/model/debugreports.py | 6 ++++--
> ui/js/src/kimchi.host.js | 2 +-
> 4 files changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/docs/API.md b/docs/API.md
> index b3b6c49..6f4f03a 100644
> --- a/docs/API.md
> +++ b/docs/API.md
> @@ -668,7 +668,8 @@ specific to the low level collection tool being used.
>
> * **GET**: Retrieve the full description of Debug Report
> * name: The debug report name used to identify the report
> - * file: The debug report file name used to identify the report
> + * file: The debug report's file path on kimchi host
> + * uri: The URI path to download this debug report
> * time: The time when the debug report is created
>
> * **DELETE**: Remove the Debug Report
> diff --git a/src/kimchi/control/debugreports.py b/src/kimchi/control/debugreports.py
> index 9922cfa..d6ca620 100644
> --- a/src/kimchi/control/debugreports.py
> +++ b/src/kimchi/control/debugreports.py
> @@ -38,6 +38,7 @@ class DebugReport(Resource):
> def data(self):
> return {'name': self.ident,
> 'file': self.info['file'],
> + 'uri': self.info['uri'],
> 'time': self.info['ctime']}
>
>
> diff --git a/src/kimchi/model/debugreports.py b/src/kimchi/model/debugreports.py
> index c6e698b..b144496 100644
> --- a/src/kimchi/model/debugreports.py
> +++ b/src/kimchi/model/debugreports.py
> @@ -161,8 +161,10 @@ class DebugReportModel(object):
> ctime = os.stat(file_target).st_ctime
> ctime = time.strftime("%Y-%m-%d-%H:%M:%S", time.localtime(ctime))
> file_target = os.path.split(file_target)[-1]
> - file_target = os.path.join("/data/debugreports", file_target)
> - return {'file': file_target,
> + file_path = os.path.join(path, file_target)
> + uri_path = os.path.join("/data/debugreports", file_target)
> + return {'file': file_path,
> + 'uri': uri_path,
> 'ctime': ctime}
>
> def delete(self, name):
> diff --git a/ui/js/src/kimchi.host.js b/ui/js/src/kimchi.host.js
> index 7974054..0aaf2f0 100644
> --- a/ui/js/src/kimchi.host.js
> +++ b/ui/js/src/kimchi.host.js
> @@ -87,7 +87,7 @@ kimchi.host_main = function() {
> }
>
> kimchi.downloadReport({
> - file: report['file']
> + file: report['uri']
> });
> }
> }],
More information about the Kimchi-devel
mailing list