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