Statistics
| Branch: | Tag: | Revision:

root / snf-webproject / synnefo / webproject / management / commands / service-export.py @ d63a86d6

History | View | Annotate | Download (2 kB)

1 c2c4af89 Georgios D. Tsoukalas
# Copyright 2013 GRNET S.A. All rights reserved.
2 c2c4af89 Georgios D. Tsoukalas
#
3 c2c4af89 Georgios D. Tsoukalas
# Redistribution and use in source and binary forms, with or
4 c2c4af89 Georgios D. Tsoukalas
# without modification, are permitted provided that the following
5 c2c4af89 Georgios D. Tsoukalas
# conditions are met:
6 c2c4af89 Georgios D. Tsoukalas
#
7 c2c4af89 Georgios D. Tsoukalas
#   1. Redistributions of source code must retain the above
8 c2c4af89 Georgios D. Tsoukalas
#      copyright notice, this list of conditions and the following
9 c2c4af89 Georgios D. Tsoukalas
#      disclaimer.
10 c2c4af89 Georgios D. Tsoukalas
#
11 c2c4af89 Georgios D. Tsoukalas
#   2. Redistributions in binary form must reproduce the above
12 c2c4af89 Georgios D. Tsoukalas
#      copyright notice, this list of conditions and the following
13 c2c4af89 Georgios D. Tsoukalas
#      disclaimer in the documentation and/or other materials
14 c2c4af89 Georgios D. Tsoukalas
#      provided with the distribution.
15 c2c4af89 Georgios D. Tsoukalas
#
16 c2c4af89 Georgios D. Tsoukalas
# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
17 c2c4af89 Georgios D. Tsoukalas
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 c2c4af89 Georgios D. Tsoukalas
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 c2c4af89 Georgios D. Tsoukalas
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
20 c2c4af89 Georgios D. Tsoukalas
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 c2c4af89 Georgios D. Tsoukalas
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 c2c4af89 Georgios D. Tsoukalas
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23 c2c4af89 Georgios D. Tsoukalas
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
24 c2c4af89 Georgios D. Tsoukalas
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 c2c4af89 Georgios D. Tsoukalas
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
26 c2c4af89 Georgios D. Tsoukalas
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 c2c4af89 Georgios D. Tsoukalas
# POSSIBILITY OF SUCH DAMAGE.
28 c2c4af89 Georgios D. Tsoukalas
#
29 c2c4af89 Georgios D. Tsoukalas
# The views and conclusions contained in the software and
30 c2c4af89 Georgios D. Tsoukalas
# documentation are those of the authors and should not be
31 c2c4af89 Georgios D. Tsoukalas
# interpreted as representing official policies, either expressed
32 c2c4af89 Georgios D. Tsoukalas
# or implied, of GRNET S.A.
33 c2c4af89 Georgios D. Tsoukalas
34 c2c4af89 Georgios D. Tsoukalas
from django.utils import simplejson as json
35 c2c4af89 Georgios D. Tsoukalas
from django.core.management.base import NoArgsCommand
36 c2c4af89 Georgios D. Tsoukalas
from django.conf import settings
37 c2c4af89 Georgios D. Tsoukalas
from synnefo.lib.services import filter_public
38 c2c4af89 Georgios D. Tsoukalas
39 c2c4af89 Georgios D. Tsoukalas
40 c2c4af89 Georgios D. Tsoukalas
class Command(NoArgsCommand):
41 c2c4af89 Georgios D. Tsoukalas
    help = "Export currently installed synnefo services in JSON format."
42 c2c4af89 Georgios D. Tsoukalas
43 c2c4af89 Georgios D. Tsoukalas
    def handle(self, *args, **options):
44 c2c4af89 Georgios D. Tsoukalas
        synnefo_services = settings.SYNNEFO_SERVICES
45 c2c4af89 Georgios D. Tsoukalas
        output = json.dumps(filter_public(synnefo_services), indent=4)
46 c2c4af89 Georgios D. Tsoukalas
        self.stdout.write(output + "\n")