[Kimchi-devel] [PATCH 07/16] Move all resources related to debug reports to control/debugreports.py

Sheldon shaohef at linux.vnet.ibm.com
Tue Dec 24 11:09:56 UTC 2013


On 12/24/2013 02:41 AM, Aline Manera wrote:
> From: Aline Manera <alinefm at br.ibm.com>
>
> DebugReports(Collection), DebugReport(Resource) and DebugReportContent(Resource)
> were moved to a new - control/debugreports.py
> That way we can easily know where debug report resource is implemented.
>
> Signed-off-by: Aline Manera <alinefm at br.ibm.com>
> ---
>   Makefile.am                        |    1 +
>   src/kimchi/control/debugreports.py |   52 ++++++++++++++++++++++++++++++++++++
>   2 files changed, 53 insertions(+)
>   create mode 100644 src/kimchi/control/debugreports.py
>
> diff --git a/Makefile.am b/Makefile.am
> index f510e11..a16cd2a 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -46,6 +46,7 @@ PEP8_WHITELIST = \
>   	src/kimchi/root.py \
>   	src/kimchi/server.py \
>   	src/kimchi/control/base.py \
> +	src/kimchi/control/debugreports.py \
>   	src/kimchi/control/templates.py \
>   	src/kimchi/control/utils.py \
>   	src/kimchi/control/vms.py \
> diff --git a/src/kimchi/control/debugreports.py b/src/kimchi/control/debugreports.py
> new file mode 100644
> index 0000000..e36aa75
> --- /dev/null
> +++ b/src/kimchi/control/debugreports.py
> @@ -0,0 +1,52 @@
> +#
> +# Project Kimchi
> +#
> +# Copyright IBM, Corp. 2013
> +#
> +# Authors:
> +#  Adam Litke <agl at linux.vnet.ibm.com>
$ git show bb59b46c
# Authors:
# Shu Ming <shuming at linux.vnet.ibm.com>
# Aline Manera <alinefm at linux.vnet.ibm.com>

> +#  Aline Manera <alinefm at linux.vnet.ibm.com>
> +#
> +# This library is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU Lesser General Public
> +# License as published by the Free Software Foundation; either
> +# version 2.1 of the License, or (at your option) any later version.
> +#
> +# This library is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +# Lesser General Public License for more details.
> +#
> +# You should have received a copy of the GNU Lesser General Public
> +# License along with this library; if not, write to the Free Software
> +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
> +
> +from kimchi.control.base import AsyncCollection, Resource
> +from kimchi.control.utils import internal_redirect
> +
> +
> +class DebugReports(AsyncCollection):
> +    def __init__(self, model):
> +        super(DebugReports, self).__init__(model)
> +        self.resource = DebugReport
> +
> +
> +class DebugReport(Resource):
> +    def __init__(self, model, ident):
> +        super(DebugReport, self).__init__(model, ident)
> +        self.content = DebugReportContent(model, ident)
> +
> +    @property
> +    def data(self):
> +        return {'name': self.ident,
> +                'file': self.info['file'],
> +                'time': self.info['ctime']}
> +
> +
> +class DebugReportContent(Resource):
> +    def __init__(self, model, ident):
> +        super(DebugReportContent, self).__init__(model, ident)
> +
> +    def get(self):
> +        self.lookup()
> +        raise internal_redirect(self.info['file'])


-- 
Sheldon Feng(冯少合)<shaohef at linux.vnet.ibm.com>
IBM Linux Technology Center




More information about the Kimchi-devel mailing list