Revision b6426ead
b/snf-astakos-app/astakos/im/management/commands/authpolicy-add.py | ||
---|---|---|
35 | 35 |
|
36 | 36 |
from optparse import make_option |
37 | 37 |
|
38 |
from django.core.management.base import BaseCommand, CommandError
|
|
38 |
from django.core.management.base import CommandError |
|
39 | 39 |
|
40 | 40 |
from astakos.im.models import AuthProviderPolicyProfile as Profile |
41 |
from snf_django.management.commands import SynnefoCommand |
|
41 | 42 |
|
42 |
option_list = list(BaseCommand.option_list) + [
|
|
43 |
option_list = list(SynnefoCommand.option_list) + [
|
|
43 | 44 |
make_option('--update', |
44 | 45 |
action='store_true', |
45 | 46 |
dest='update', |
... | ... | |
68 | 69 |
help="%s policy" % p.title())) |
69 | 70 |
|
70 | 71 |
|
71 |
class Command(BaseCommand):
|
|
72 |
class Command(SynnefoCommand):
|
|
72 | 73 |
args = "<name> <provider_name>" |
73 | 74 |
help = "Create a new authentication provider policy profile" |
74 | 75 |
option_list = option_list |
b/snf-astakos-app/astakos/im/management/commands/authpolicy-remove.py | ||
---|---|---|
31 | 31 |
# interpreted as representing official policies, either expressed |
32 | 32 |
# or implied, of GRNET S.A. |
33 | 33 |
|
34 |
from django.core.management.base import BaseCommand, CommandError
|
|
34 |
from django.core.management.base import CommandError |
|
35 | 35 |
|
36 | 36 |
from astakos.im.models import AuthProviderPolicyProfile as Profile |
37 |
from snf_django.management.commands import SynnefoCommand |
|
37 | 38 |
|
38 | 39 |
|
39 |
class Command(BaseCommand):
|
|
40 |
class Command(SynnefoCommand):
|
|
40 | 41 |
args = "<profile_name>" |
41 | 42 |
help = "Remove an authentication provider policy" |
42 | 43 |
|
43 |
option_list = BaseCommand.option_list + ()
|
|
44 |
option_list = SynnefoCommand.option_list + ()
|
|
44 | 45 |
|
45 | 46 |
def handle(self, *args, **options): |
46 | 47 |
if len(args) != 1: |
b/snf-astakos-app/astakos/im/management/commands/authpolicy-set.py | ||
---|---|---|
34 | 34 |
from optparse import make_option |
35 | 35 |
|
36 | 36 |
from django.db import transaction |
37 |
from django.core.management.base import BaseCommand, CommandError
|
|
37 |
from django.core.management.base import CommandError |
|
38 | 38 |
|
39 |
from snf_django.management.commands import SynnefoCommand |
|
39 | 40 |
from astakos.im.models import AuthProviderPolicyProfile as Profile |
40 | 41 |
from astakos.im.models import AstakosUser, Group |
41 | 42 |
|
42 |
option_list = BaseCommand.option_list + (
|
|
43 |
option_list = SynnefoCommand.option_list + (
|
|
43 | 44 |
make_option('--group', |
44 | 45 |
action='append', |
45 | 46 |
dest='groups', |
... | ... | |
63 | 64 |
profile.users.add(*users) |
64 | 65 |
|
65 | 66 |
|
66 |
class Command(BaseCommand):
|
|
67 |
class Command(SynnefoCommand):
|
|
67 | 68 |
args = "<name> <provider_name>" |
68 | 69 |
help = "Assign an existing authentication provider policy profile to " + \ |
69 | 70 |
"a user or group. All previously set " |
b/snf-astakos-app/astakos/im/management/commands/cleanup-full.py | ||
---|---|---|
32 | 32 |
# or implied, of GRNET S.A. |
33 | 33 |
|
34 | 34 |
|
35 |
from django.core.management.base import NoArgsCommand |
|
36 | 35 |
from django.core.management import call_command |
37 | 36 |
from django.utils.importlib import import_module |
38 | 37 |
from django.conf import settings |
39 | 38 |
|
40 | 39 |
from astakos.im.models import SessionCatalog |
40 |
from snf_django.management.commands import SynnefoCommand |
|
41 | 41 |
|
42 | 42 |
|
43 |
class Command(NoArgsCommand):
|
|
43 |
class Command(SynnefoCommand):
|
|
44 | 44 |
help = "Cleanup sessions and session catalog" |
45 | 45 |
|
46 | 46 |
def handle_noargs(self, **options): |
b/snf-astakos-app/astakos/im/management/commands/component-add.py | ||
---|---|---|
32 | 32 |
# or implied, of GRNET S.A. |
33 | 33 |
|
34 | 34 |
from optparse import make_option |
35 |
from django.core.management.base import BaseCommand, CommandError |
|
35 |
from django.core.management.base import CommandError |
|
36 |
|
|
36 | 37 |
from astakos.im.models import Component |
38 |
from snf_django.management.commands import SynnefoCommand |
|
37 | 39 |
|
38 | 40 |
|
39 |
class Command(BaseCommand):
|
|
41 |
class Command(SynnefoCommand):
|
|
40 | 42 |
args = "<name>" |
41 | 43 |
help = "Register a component" |
42 | 44 |
|
43 |
option_list = BaseCommand.option_list + (
|
|
45 |
option_list = SynnefoCommand.option_list + (
|
|
44 | 46 |
make_option('--ui-url', |
45 | 47 |
dest='ui_url', |
46 | 48 |
default=None, |
b/snf-astakos-app/astakos/im/management/commands/component-modify.py | ||
---|---|---|
33 | 33 |
|
34 | 34 |
from optparse import make_option |
35 | 35 |
|
36 |
from django.core.management.base import BaseCommand, CommandError
|
|
36 |
from django.core.management.base import CommandError |
|
37 | 37 |
|
38 | 38 |
from astakos.im.models import Component |
39 |
from snf_django.management.commands import SynnefoCommand |
|
39 | 40 |
|
40 | 41 |
|
41 |
class Command(BaseCommand):
|
|
42 |
class Command(SynnefoCommand):
|
|
42 | 43 |
args = "<component ID or name>" |
43 | 44 |
help = "Modify component attributes" |
44 | 45 |
|
45 |
option_list = BaseCommand.option_list + (
|
|
46 |
option_list = SynnefoCommand.option_list + (
|
|
46 | 47 |
make_option('--ui-url', |
47 | 48 |
dest='ui_url', |
48 | 49 |
default=None, |
b/snf-astakos-app/astakos/im/management/commands/component-remove.py | ||
---|---|---|
31 | 31 |
# interpreted as representing official policies, either expressed |
32 | 32 |
# or implied, of GRNET S.A. |
33 | 33 |
|
34 |
from django.core.management.base import BaseCommand, CommandError
|
|
34 |
from django.core.management.base import CommandError |
|
35 | 35 |
from django.db import transaction |
36 |
|
|
36 | 37 |
from astakos.im.models import Component |
38 |
from snf_django.management.commands import SynnefoCommand |
|
37 | 39 |
|
38 | 40 |
|
39 |
class Command(BaseCommand):
|
|
41 |
class Command(SynnefoCommand):
|
|
40 | 42 |
args = "<component ID or name>" |
41 | 43 |
help = "Remove a component along with its registered services" |
42 | 44 |
|
b/snf-astakos-app/astakos/im/management/commands/fix-superusers.py | ||
---|---|---|
31 | 31 |
# interpreted as representing official policies, either expressed |
32 | 32 |
# or implied, of GRNET S.A. |
33 | 33 |
|
34 |
from optparse import make_option |
|
35 |
from datetime import datetime |
|
36 |
|
|
37 | 34 |
from django.db import transaction |
38 |
from django.core.management.base import NoArgsCommand, CommandError
|
|
35 |
from django.core.management.base import CommandError |
|
39 | 36 |
|
40 | 37 |
from astakos.im.auth import fix_superusers |
38 |
from snf_django.management.commands import SynnefoCommand |
|
41 | 39 |
|
42 | 40 |
|
43 |
class Command(NoArgsCommand):
|
|
41 |
class Command(SynnefoCommand):
|
|
44 | 42 |
help = "Transform superusers created by syncdb into AstakosUser instances" |
45 | 43 |
|
46 | 44 |
@transaction.commit_on_success |
b/snf-astakos-app/astakos/im/management/commands/group-add.py | ||
---|---|---|
31 | 31 |
# interpreted as representing official policies, either expressed |
32 | 32 |
# or implied, of GRNET S.A. |
33 | 33 |
|
34 |
from django.core.management.base import BaseCommand, CommandError
|
|
34 |
from django.core.management.base import CommandError |
|
35 | 35 |
|
36 | 36 |
from astakos.im.models import Group |
37 |
from snf_django.management.commands import SynnefoCommand |
|
37 | 38 |
|
38 | 39 |
|
39 |
class Command(BaseCommand):
|
|
40 |
class Command(SynnefoCommand):
|
|
40 | 41 |
args = "<group name>" |
41 | 42 |
help = "Create a group with the given name" |
42 | 43 |
|
43 |
option_list = BaseCommand.option_list + ()
|
|
44 |
option_list = SynnefoCommand.option_list + ()
|
|
44 | 45 |
|
45 | 46 |
def handle(self, *args, **options): |
46 | 47 |
if len(args) != 1: |
b/snf-astakos-app/astakos/im/management/commands/project-control.py | ||
---|---|---|
34 | 34 |
from optparse import make_option |
35 | 35 |
|
36 | 36 |
from django.db import transaction |
37 |
from django.core.management.base import BaseCommand, CommandError |
|
37 |
from django.core.management.base import CommandError |
|
38 |
|
|
38 | 39 |
from astakos.im.functions import (terminate, suspend, unsuspend, |
39 | 40 |
reinstate, check_expiration, |
40 | 41 |
approve_application, deny_application) |
42 |
from snf_django.management.commands import SynnefoCommand |
|
41 | 43 |
|
42 | 44 |
|
43 |
class Command(BaseCommand):
|
|
45 |
class Command(SynnefoCommand):
|
|
44 | 46 |
help = "Manage projects and applications" |
45 | 47 |
|
46 |
option_list = BaseCommand.option_list + (
|
|
48 |
option_list = SynnefoCommand.option_list + (
|
|
47 | 49 |
make_option('--approve', |
48 | 50 |
dest='approve', |
49 | 51 |
metavar='<application id>', |
b/snf-astakos-app/astakos/im/management/commands/project-modify.py | ||
---|---|---|
34 | 34 |
from optparse import make_option |
35 | 35 |
|
36 | 36 |
from django.db.models import Q |
37 |
from django.core.management.base import BaseCommand, CommandError
|
|
37 |
from django.core.management.base import CommandError |
|
38 | 38 |
from django.db import transaction |
39 | 39 |
from synnefo.util import units |
40 | 40 |
from astakos.im import functions |
... | ... | |
43 | 43 |
import synnefo.util.date as date_util |
44 | 44 |
from snf_django.management import utils |
45 | 45 |
from astakos.im.management.commands import _common |
46 |
from snf_django.management.commands import SynnefoCommand |
|
46 | 47 |
|
47 | 48 |
|
48 | 49 |
def make_policies(limits): |
... | ... | |
112 | 113 |
return tuple(options) |
113 | 114 |
|
114 | 115 |
|
115 |
class Command(BaseCommand):
|
|
116 |
class Command(SynnefoCommand):
|
|
116 | 117 |
args = "<project id> (or --all-base-projects)" |
117 | 118 |
help = "Modify an already initialized project" |
118 |
option_list = BaseCommand.option_list + make_options() + (
|
|
119 |
option_list = SynnefoCommand.option_list + make_options() + (
|
|
119 | 120 |
make_option('--all-base-projects', |
120 | 121 |
action='store_true', |
121 | 122 |
default=False, |
b/snf-astakos-app/astakos/im/management/commands/reconcile-resources-astakos.py | ||
---|---|---|
34 | 34 |
from optparse import make_option |
35 | 35 |
from datetime import datetime |
36 | 36 |
|
37 |
from django.core.management.base import BaseCommand, CommandError
|
|
37 |
from django.core.management.base import CommandError |
|
38 | 38 |
from django.db import transaction |
39 | 39 |
|
40 | 40 |
from snf_django.utils import reconcile |
... | ... | |
44 | 44 |
from astakos.im.functions import count_pending_app |
45 | 45 |
import astakos.quotaholder_app.callpoint as qh |
46 | 46 |
import astakos.quotaholder_app.exception as qh_exception |
47 |
from snf_django.management.commands import SynnefoCommand |
|
47 | 48 |
|
48 | 49 |
|
49 |
class Command(BaseCommand):
|
|
50 |
class Command(SynnefoCommand):
|
|
50 | 51 |
help = """Reconcile resource usage of Quotaholder with Astakos DB. |
51 | 52 |
|
52 | 53 |
Detect unsynchronized usage between Quotaholder and Astakos DB resources |
... | ... | |
54 | 55 |
|
55 | 56 |
""" |
56 | 57 |
|
57 |
option_list = BaseCommand.option_list + (
|
|
58 |
option_list = SynnefoCommand.option_list + (
|
|
58 | 59 |
make_option("--userid", dest="userid", |
59 | 60 |
default=None, |
60 | 61 |
help="Reconcile resources only for this user"), |
... | ... | |
78 | 79 |
userid = options['userid'] |
79 | 80 |
project = options['project'] |
80 | 81 |
|
81 |
RESOURCES = [quotas.PENDING_APP_RESOURCE]
|
|
82 |
resources = [quotas.PENDING_APP_RESOURCE]
|
|
82 | 83 |
|
83 | 84 |
try: |
84 | 85 |
astakos = Component.objects.get(name="astakos") |
... | ... | |
109 | 110 |
db_project_holdings.update(user_holdings) |
110 | 111 |
|
111 | 112 |
unsynced_users, users_pending, users_unknown =\ |
112 |
reconcile.check_users(self.stderr, RESOURCES,
|
|
113 |
reconcile.check_users(self.stderr, resources,
|
|
113 | 114 |
db_holdings, qh_holdings) |
114 | 115 |
|
115 | 116 |
unsynced_projects, projects_pending, projects_unknown =\ |
116 |
reconcile.check_projects(self.stderr, RESOURCES,
|
|
117 |
reconcile.check_projects(self.stderr, resources,
|
|
117 | 118 |
db_project_holdings, qh_project_holdings) |
118 | 119 |
pending_exists = users_pending or projects_pending |
119 | 120 |
unknown_exists = users_unknown or projects_unknown |
b/snf-astakos-app/astakos/im/management/commands/resource-modify.py | ||
---|---|---|
32 | 32 |
# or implied, of GRNET S.A. |
33 | 33 |
|
34 | 34 |
from optparse import make_option |
35 |
from django.core.management.base import BaseCommand, CommandError
|
|
35 |
from django.core.management.base import CommandError |
|
36 | 36 |
|
37 | 37 |
from snf_django.management import utils |
38 | 38 |
from astakos.im.models import Resource |
39 | 39 |
from astakos.im import register |
40 | 40 |
from ._common import style_options, check_style, units |
41 |
from snf_django.management.commands import SynnefoCommand |
|
41 | 42 |
|
42 | 43 |
|
43 |
class Command(BaseCommand):
|
|
44 |
class Command(SynnefoCommand):
|
|
44 | 45 |
args = "<resource name>" |
45 | 46 |
help = "Modify a resource's quota defaults and boolean flags." |
46 | 47 |
|
47 |
option_list = BaseCommand.option_list + (
|
|
48 |
option_list = SynnefoCommand.option_list + (
|
|
48 | 49 |
make_option('--base-default', |
49 | 50 |
metavar='<limit>', |
50 | 51 |
help="Specify default quota for base projects"), |
b/snf-astakos-app/astakos/im/management/commands/service-export-astakos.py | ||
---|---|---|
32 | 32 |
# or implied, of GRNET S.A. |
33 | 33 |
|
34 | 34 |
from django.utils import simplejson as json |
35 |
from django.core.management.base import NoArgsCommand |
|
36 | 35 |
# import from settings, after any post-processing |
36 |
|
|
37 | 37 |
from astakos.im.settings import astakos_services |
38 | 38 |
from synnefo.lib.services import filter_public |
39 |
from snf_django.management.commands import SynnefoCommand |
|
39 | 40 |
|
40 | 41 |
|
41 |
class Command(NoArgsCommand):
|
|
42 |
class Command(SynnefoCommand):
|
|
42 | 43 |
help = "Export Astakos services in JSON format." |
43 | 44 |
|
44 | 45 |
def handle(self, *args, **options): |
b/snf-astakos-app/astakos/im/management/commands/service-import.py | ||
---|---|---|
34 | 34 |
from optparse import make_option |
35 | 35 |
|
36 | 36 |
from django.db import transaction |
37 |
from django.core.management.base import BaseCommand, CommandError
|
|
37 |
from django.core.management.base import CommandError |
|
38 | 38 |
from django.utils import simplejson as json |
39 | 39 |
|
40 | 40 |
from astakos.im.register import add_service, add_resource, RegisterException |
41 |
from snf_django.management.commands import SynnefoCommand |
|
41 | 42 |
from astakos.im.models import Component |
42 | 43 |
from ._common import read_from_file |
43 | 44 |
|
44 | 45 |
|
45 |
class Command(BaseCommand):
|
|
46 |
class Command(SynnefoCommand):
|
|
46 | 47 |
help = "Register services" |
47 | 48 |
|
48 |
option_list = BaseCommand.option_list + (
|
|
49 |
option_list = SynnefoCommand.option_list + (
|
|
49 | 50 |
make_option('--json', |
50 | 51 |
dest='json', |
51 | 52 |
metavar='<json.file>', |
b/snf-astakos-app/astakos/im/management/commands/term-add.py | ||
---|---|---|
33 | 33 |
|
34 | 34 |
from os.path import abspath |
35 | 35 |
|
36 |
from django.core.management.base import BaseCommand, CommandError
|
|
36 |
from django.core.management.base import CommandError |
|
37 | 37 |
from django.db import transaction |
38 | 38 |
|
39 | 39 |
from astakos.im.models import ApprovalTerms, AstakosUser |
40 |
from snf_django.management.commands import SynnefoCommand |
|
40 | 41 |
|
41 | 42 |
|
42 |
class Command(BaseCommand):
|
|
43 |
class Command(SynnefoCommand):
|
|
43 | 44 |
args = "<location>" |
44 | 45 |
help = "Insert approval terms" |
45 | 46 |
|
b/snf-astakos-app/astakos/im/management/commands/user-activation-send.py | ||
---|---|---|
31 | 31 |
# interpreted as representing official policies, either expressed |
32 | 32 |
# or implied, of GRNET S.A. |
33 | 33 |
|
34 |
from django.core.management.base import BaseCommand, CommandError
|
|
34 |
from django.core.management.base import CommandError |
|
35 | 35 |
|
36 | 36 |
from astakos.im import activation_backends |
37 | 37 |
activation_backend = activation_backends.get_backend() |
38 | 38 |
|
39 | 39 |
from ._common import get_user |
40 |
from snf_django.management.commands import SynnefoCommand |
|
40 | 41 |
|
41 | 42 |
|
42 |
class Command(BaseCommand):
|
|
43 |
class Command(SynnefoCommand):
|
|
43 | 44 |
args = "<user ID or email> [user ID or email] ..." |
44 | 45 |
help = "Sends an activation email to one or more users" |
45 | 46 |
|
b/snf-astakos-app/astakos/im/management/commands/user-add.py | ||
---|---|---|
32 | 32 |
# or implied, of GRNET S.A. |
33 | 33 |
|
34 | 34 |
from optparse import make_option |
35 |
from datetime import datetime |
|
36 | 35 |
|
37 | 36 |
from django.db import transaction |
38 |
from django.core.management.base import BaseCommand, CommandError
|
|
37 |
from django.core.management.base import CommandError |
|
39 | 38 |
from django.core.validators import validate_email |
40 | 39 |
from django.core.exceptions import ValidationError |
41 | 40 |
|
42 | 41 |
from astakos.im.models import AstakosUser, get_latest_terms |
42 |
from snf_django.management.commands import SynnefoCommand |
|
43 | 43 |
from astakos.im.auth import make_local_user |
44 | 44 |
|
45 | 45 |
|
46 |
class Command(BaseCommand):
|
|
46 |
class Command(SynnefoCommand):
|
|
47 | 47 |
args = "<email> <first name> <last name>" |
48 | 48 |
help = "Create a user" |
49 | 49 |
|
50 |
option_list = BaseCommand.option_list + (
|
|
50 |
option_list = SynnefoCommand.option_list + (
|
|
51 | 51 |
make_option('--password', |
52 | 52 |
dest='password', |
53 | 53 |
metavar='PASSWORD', |
b/snf-astakos-app/astakos/im/management/commands/user-modify.py | ||
---|---|---|
38 | 38 |
|
39 | 39 |
from django.core import management |
40 | 40 |
from django.db import transaction |
41 |
from django.core.management.base import BaseCommand, CommandError
|
|
41 |
from django.core.management.base import CommandError |
|
42 | 42 |
from django.contrib.auth.models import Group |
43 | 43 |
from django.core.exceptions import ValidationError |
44 | 44 |
from django.core.validators import validate_email |
45 | 45 |
|
46 | 46 |
from astakos.im.models import AstakosUser |
47 | 47 |
from astakos.im import activation_backends |
48 |
from snf_django.management.commands import SynnefoCommand |
|
48 | 49 |
from ._common import (remove_user_permission, add_user_permission, is_uuid) |
49 | 50 |
|
50 | 51 |
activation_backend = activation_backends.get_backend() |
51 | 52 |
|
52 | 53 |
|
53 |
class Command(BaseCommand):
|
|
54 |
class Command(SynnefoCommand):
|
|
54 | 55 |
args = "<user ID> (or --all)" |
55 | 56 |
help = "Modify a user's attributes" |
56 | 57 |
|
57 |
option_list = BaseCommand.option_list + (
|
|
58 |
option_list = SynnefoCommand.option_list + (
|
|
58 | 59 |
make_option('--all', |
59 | 60 |
action='store_true', |
60 | 61 |
default=False, |
b/snf-astakos-app/astakos/oa2/management/commands/oauth2-client-remove.py | ||
---|---|---|
31 | 31 |
# interpreted as representing official policies, either expressed |
32 | 32 |
# or implied, of GRNET S.A. |
33 | 33 |
|
34 |
from django.core.management.base import BaseCommand, CommandError
|
|
34 |
from django.core.management.base import CommandError |
|
35 | 35 |
from django.db import transaction |
36 |
|
|
37 |
from snf_django.management.commands import SynnefoCommand |
|
36 | 38 |
from astakos.oa2.models import Client |
37 | 39 |
|
38 | 40 |
|
39 |
class Command(BaseCommand):
|
|
41 |
class Command(SynnefoCommand):
|
|
40 | 42 |
args = "<client ID or identifier>" |
41 | 43 |
help = "Remove an oauth2 client along with its registered redirect urls" |
42 | 44 |
|
b/snf-cyclades-app/synnefo/logic/management/commands/backend-add.py | ||
---|---|---|
28 | 28 |
# policies, either expressed or implied, of GRNET S.A. |
29 | 29 |
# |
30 | 30 |
from optparse import make_option |
31 |
from django.core.management.base import BaseCommand, CommandError
|
|
31 |
from django.core.management.base import CommandError |
|
32 | 32 |
|
33 | 33 |
from synnefo.db.models import Backend, Network |
34 | 34 |
from django.db.utils import IntegrityError |
35 | 35 |
from synnefo.logic import backend as backend_mod |
36 |
from snf_django.management.commands import SynnefoCommand |
|
36 | 37 |
from synnefo.management.common import check_backend_credentials |
37 | 38 |
from snf_django.management.utils import pprint_table |
38 | 39 |
|
... | ... | |
40 | 41 |
HYPERVISORS = [h[0] for h in Backend.HYPERVISORS] |
41 | 42 |
|
42 | 43 |
|
43 |
class Command(BaseCommand):
|
|
44 |
class Command(SynnefoCommand):
|
|
44 | 45 |
can_import_settings = True |
45 | 46 |
|
46 | 47 |
help = 'Create a new backend.' |
47 |
option_list = BaseCommand.option_list + (
|
|
48 |
option_list = SynnefoCommand.option_list + (
|
|
48 | 49 |
make_option('--clustername', dest='clustername'), |
49 | 50 |
make_option('--port', dest='port', default=5080), |
50 | 51 |
make_option('--user', dest='username'), |
b/snf-cyclades-app/synnefo/logic/management/commands/backend-modify.py | ||
---|---|---|
32 | 32 |
# or implied, of GRNET S.A. |
33 | 33 |
|
34 | 34 |
from optparse import make_option |
35 |
from django.core.management.base import BaseCommand, CommandError |
|
35 |
from django.core.management.base import CommandError |
|
36 |
|
|
37 |
from snf_django.management.commands import SynnefoCommand |
|
36 | 38 |
from synnefo.db.models import Backend |
37 | 39 |
from snf_django.management.utils import parse_bool |
38 | 40 |
from synnefo.management import common |
... | ... | |
40 | 42 |
HYPERVISORS = [h[0] for h in Backend.HYPERVISORS] |
41 | 43 |
|
42 | 44 |
|
43 |
class Command(BaseCommand):
|
|
45 |
class Command(SynnefoCommand):
|
|
44 | 46 |
output_transaction = True |
45 | 47 |
args = "<backend ID>" |
46 | 48 |
help = "Modify a backend" |
47 | 49 |
|
48 |
option_list = BaseCommand.option_list + (
|
|
50 |
option_list = SynnefoCommand.option_list + (
|
|
49 | 51 |
make_option('--clustername', |
50 | 52 |
dest='clustername', |
51 | 53 |
help="Set backend's clustername"), |
b/snf-cyclades-app/synnefo/logic/management/commands/backend-remove.py | ||
---|---|---|
28 | 28 |
# policies, either expressed or implied, of GRNET S.A. |
29 | 29 |
# |
30 | 30 |
|
31 |
from django.core.management.base import BaseCommand, CommandError |
|
31 |
from django.core.management.base import CommandError |
|
32 |
|
|
33 |
from snf_django.management.commands import SynnefoCommand |
|
32 | 34 |
from synnefo.management import common |
33 | 35 |
from synnefo.logic import backend as backend_mod |
34 | 36 |
from synnefo.db.models import Backend |
... | ... | |
42 | 44 |
non-deleted instances.""" |
43 | 45 |
|
44 | 46 |
|
45 |
class Command(BaseCommand):
|
|
47 |
class Command(SynnefoCommand):
|
|
46 | 48 |
help = HELP_MSG |
47 | 49 |
|
48 | 50 |
def handle(self, *args, **options): |
b/snf-cyclades-app/synnefo/logic/management/commands/backend-update-status.py | ||
---|---|---|
27 | 27 |
# those of the authors and should not be interpreted as representing official |
28 | 28 |
# policies, either expressed or implied, of GRNET S.A. |
29 | 29 |
# |
30 |
from django.core.management.base import BaseCommand |
|
31 |
|
|
30 |
from snf_django.management.commands import SynnefoCommand |
|
32 | 31 |
from synnefo.db.models import Backend |
33 | 32 |
from synnefo.logic import backend as backend_mod |
34 | 33 |
|
... | ... | |
41 | 40 |
""" |
42 | 41 |
|
43 | 42 |
|
44 |
class Command(BaseCommand):
|
|
43 |
class Command(SynnefoCommand):
|
|
45 | 44 |
help = HELP_MSG |
46 | 45 |
|
47 | 46 |
def handle(self, **options): |
b/snf-cyclades-app/synnefo/logic/management/commands/cyclades-astakos-migrate-013.py | ||
---|---|---|
36 | 36 |
|
37 | 37 |
from optparse import make_option |
38 | 38 |
|
39 |
from django.core.management.base import CommandError, BaseCommand
|
|
39 |
from django.core.management.base import CommandError |
|
40 | 40 |
from django.db import transaction |
41 | 41 |
from django.conf import settings |
42 | 42 |
|
43 |
from snf_django.management.commands import SynnefoCommand |
|
43 | 44 |
from synnefo.api.util import get_existing_users |
44 | 45 |
from synnefo.lib.utils import case_unique |
45 | 46 |
from synnefo.db.models import Network, VirtualMachine |
... | ... | |
90 | 91 |
key.save() |
91 | 92 |
|
92 | 93 |
|
93 |
class Command(BaseCommand):
|
|
94 |
class Command(SynnefoCommand):
|
|
94 | 95 |
help = "Quotas migration helper" |
95 | 96 |
|
96 |
option_list = BaseCommand.option_list + (
|
|
97 |
option_list = SynnefoCommand.option_list + (
|
|
97 | 98 |
make_option('--strict', |
98 | 99 |
dest='strict', |
99 | 100 |
action="store_false", |
b/snf-cyclades-app/synnefo/logic/management/commands/flavor-create.py | ||
---|---|---|
34 | 34 |
from itertools import product |
35 | 35 |
from optparse import make_option |
36 | 36 |
|
37 |
from django.core.management.base import BaseCommand, CommandError
|
|
37 |
from django.core.management.base import CommandError |
|
38 | 38 |
|
39 |
from snf_django.management.commands import SynnefoCommand |
|
39 | 40 |
from synnefo.db.models import Flavor |
40 | 41 |
|
41 | 42 |
|
42 |
class Command(BaseCommand):
|
|
43 |
class Command(SynnefoCommand):
|
|
43 | 44 |
output_transaction = True |
44 | 45 |
|
45 |
option_list = BaseCommand.option_list + (
|
|
46 |
option_list = SynnefoCommand.option_list + (
|
|
46 | 47 |
make_option("-n", "--dry-run", dest="dry_run", action="store_true"), |
47 | 48 |
) |
48 | 49 |
args = "<cpu>[,<cpu>,...] " \ |
... | ... | |
83 | 84 |
self.stdout.write("Flavor '%s' already exists\n" |
84 | 85 |
% flavor.name) |
85 | 86 |
if flavor.deleted: |
86 |
msg = "Flavor '%s' is marked as deleted. Use"\ |
|
87 |
" 'snf-manage flavor-modify' to restore this flavor\n"\ |
|
88 |
% flavor.name |
|
87 |
msg = "Flavor '%s' is marked as deleted." \ |
|
88 |
" Use 'snf-manage flavor-modify' to" \ |
|
89 |
" restore this flavor\n" \ |
|
90 |
% flavor.name |
|
89 | 91 |
self.stdout.write(msg) |
b/snf-cyclades-app/synnefo/logic/management/commands/flavor-modify.py | ||
---|---|---|
33 | 33 |
|
34 | 34 |
from optparse import make_option |
35 | 35 |
|
36 |
from django.core.management.base import BaseCommand, CommandError |
|
36 |
from django.core.management.base import CommandError |
|
37 |
|
|
38 |
from snf_django.management.commands import SynnefoCommand |
|
37 | 39 |
from synnefo.management.common import get_resource |
38 | 40 |
from snf_django.management.utils import parse_bool |
39 | 41 |
|
... | ... | |
42 | 44 |
log = getLogger(__name__) |
43 | 45 |
|
44 | 46 |
|
45 |
class Command(BaseCommand):
|
|
47 |
class Command(SynnefoCommand):
|
|
46 | 48 |
args = "<flavor id>" |
47 | 49 |
help = "Modify a flavor" |
48 | 50 |
|
49 |
option_list = BaseCommand.option_list + (
|
|
51 |
option_list = SynnefoCommand.option_list + (
|
|
50 | 52 |
make_option( |
51 | 53 |
"--deleted", |
52 | 54 |
dest="deleted", |
b/snf-cyclades-app/synnefo/logic/management/commands/floating-ip-attach.py | ||
---|---|---|
33 | 33 |
|
34 | 34 |
from optparse import make_option |
35 | 35 |
|
36 |
from django.core.management.base import BaseCommand, CommandError |
|
36 |
from django.core.management.base import CommandError |
|
37 |
|
|
38 |
from snf_django.management.commands import SynnefoCommand |
|
37 | 39 |
from synnefo.management import common |
38 | 40 |
from synnefo.logic import servers |
39 | 41 |
|
40 | 42 |
|
41 |
class Command(BaseCommand):
|
|
43 |
class Command(SynnefoCommand):
|
|
42 | 44 |
help = "Attach a floating IP to a VM or router" |
43 | 45 |
|
44 |
option_list = BaseCommand.option_list + (
|
|
46 |
option_list = SynnefoCommand.option_list + (
|
|
45 | 47 |
make_option( |
46 | 48 |
'--machine', |
47 | 49 |
dest='machine', |
b/snf-cyclades-app/synnefo/logic/management/commands/floating-ip-create.py | ||
---|---|---|
33 | 33 |
|
34 | 34 |
from optparse import make_option |
35 | 35 |
|
36 |
from django.core.management.base import BaseCommand, CommandError |
|
36 |
from django.core.management.base import CommandError |
|
37 |
|
|
38 |
from snf_django.management.commands import SynnefoCommand |
|
37 | 39 |
from synnefo.management.common import convert_api_faults |
38 | 40 |
from synnefo.logic import ips |
39 | 41 |
from synnefo.api import util |
40 | 42 |
|
41 | 43 |
|
42 |
class Command(BaseCommand):
|
|
44 |
class Command(SynnefoCommand):
|
|
43 | 45 |
help = "Allocate a new floating IP" |
44 | 46 |
|
45 |
option_list = BaseCommand.option_list + (
|
|
47 |
option_list = SynnefoCommand.option_list + (
|
|
46 | 48 |
make_option( |
47 | 49 |
'--network', |
48 | 50 |
dest='network_id', |
b/snf-cyclades-app/synnefo/logic/management/commands/floating-ip-detach.py | ||
---|---|---|
33 | 33 |
|
34 | 34 |
#from optparse import make_option |
35 | 35 |
|
36 |
from django.core.management.base import BaseCommand, CommandError |
|
36 |
from django.core.management.base import CommandError |
|
37 |
|
|
38 |
from snf_django.management.commands import SynnefoCommand |
|
37 | 39 |
from synnefo.management import common |
38 | 40 |
from synnefo.logic import servers |
39 | 41 |
|
40 | 42 |
|
41 |
class Command(BaseCommand):
|
|
43 |
class Command(SynnefoCommand):
|
|
42 | 44 |
help = "Detach a floating IP from a VM or router" |
43 | 45 |
|
44 | 46 |
@common.convert_api_faults |
b/snf-cyclades-app/synnefo/logic/management/commands/network-create.py | ||
---|---|---|
33 | 33 |
|
34 | 34 |
from optparse import make_option |
35 | 35 |
|
36 |
from django.core.management.base import BaseCommand, CommandError |
|
36 |
from django.core.management.base import CommandError |
|
37 |
|
|
38 |
from snf_django.management.commands import SynnefoCommand |
|
37 | 39 |
from synnefo.management.common import convert_api_faults |
38 | 40 |
from snf_django.management.utils import parse_bool |
39 | 41 |
|
... | ... | |
41 | 43 |
from synnefo.logic import networks, subnets |
42 | 44 |
from synnefo.management import pprint |
43 | 45 |
|
44 |
import ipaddr |
|
45 | 46 |
|
46 | 47 |
NETWORK_FLAVORS = Network.FLAVORS.keys() |
47 | 48 |
|
48 | 49 |
|
49 |
class Command(BaseCommand):
|
|
50 |
class Command(SynnefoCommand):
|
|
50 | 51 |
can_import_settings = True |
51 | 52 |
output_transaction = True |
52 | 53 |
|
53 | 54 |
help = "Create a new network" |
54 | 55 |
|
55 |
option_list = BaseCommand.option_list + (
|
|
56 |
option_list = SynnefoCommand.option_list + (
|
|
56 | 57 |
make_option( |
57 | 58 |
'--name', |
58 | 59 |
dest='name', |
b/snf-cyclades-app/synnefo/logic/management/commands/network-inspect.py | ||
---|---|---|
33 | 33 |
|
34 | 34 |
from optparse import make_option |
35 | 35 |
|
36 |
from django.core.management.base import BaseCommand, CommandError |
|
36 |
from django.core.management.base import CommandError |
|
37 |
|
|
38 |
from snf_django.management.commands import SynnefoCommand |
|
37 | 39 |
from synnefo.management import pprint, common |
38 | 40 |
|
39 | 41 |
|
40 |
class Command(BaseCommand):
|
|
42 |
class Command(SynnefoCommand):
|
|
41 | 43 |
help = "Inspect a network on DB and Ganeti." |
42 | 44 |
args = "<Network ID>" |
43 | 45 |
|
44 |
option_list = BaseCommand.option_list + (
|
|
46 |
option_list = SynnefoCommand.option_list + (
|
|
45 | 47 |
make_option( |
46 | 48 |
'--displayname', |
47 | 49 |
action='store_true', |
b/snf-cyclades-app/synnefo/logic/management/commands/network-modify.py | ||
---|---|---|
33 | 33 |
|
34 | 34 |
from optparse import make_option |
35 | 35 |
|
36 |
from django.core.management.base import BaseCommand, CommandError
|
|
36 |
from django.core.management.base import CommandError |
|
37 | 37 |
|
38 | 38 |
from synnefo.db.models import Backend |
39 | 39 |
from synnefo.management.common import get_resource |
40 |
from snf_django.management.commands import SynnefoCommand |
|
40 | 41 |
from snf_django.management.utils import parse_bool |
41 | 42 |
from synnefo.logic import networks, backend as backend_mod |
42 | 43 |
from django.db import transaction |
43 | 44 |
|
44 | 45 |
|
45 |
class Command(BaseCommand):
|
|
46 |
class Command(SynnefoCommand):
|
|
46 | 47 |
args = "<Network ID>" |
47 | 48 |
help = "Modify a network." |
48 | 49 |
|
49 |
option_list = BaseCommand.option_list + (
|
|
50 |
option_list = SynnefoCommand.option_list + (
|
|
50 | 51 |
make_option( |
51 | 52 |
'--name', |
52 | 53 |
dest='name', |
b/snf-cyclades-app/synnefo/logic/management/commands/pool-create.py | ||
---|---|---|
31 | 31 |
# interpreted as representing official policies, either expressed |
32 | 32 |
# or implied, of GRNET S.A. |
33 | 33 |
|
34 |
from django.core.management.base import BaseCommand, CommandError
|
|
34 |
from django.core.management.base import CommandError |
|
35 | 35 |
from optparse import make_option |
36 |
|
|
37 |
from snf_django.management.commands import SynnefoCommand |
|
36 | 38 |
from synnefo.db.utils import validate_mac |
37 | 39 |
from synnefo.management.common import pool_table_from_type |
38 | 40 |
|
39 | 41 |
POOL_CHOICES = ['bridge', 'mac-prefix'] |
40 | 42 |
|
41 | 43 |
|
42 |
class Command(BaseCommand):
|
|
44 |
class Command(SynnefoCommand):
|
|
43 | 45 |
help = "Create a new pool of resources." |
44 | 46 |
output_transaction = True |
45 |
option_list = BaseCommand.option_list + (
|
|
47 |
option_list = SynnefoCommand.option_list + (
|
|
46 | 48 |
make_option("--type", dest="type", |
47 | 49 |
choices=POOL_CHOICES, |
48 | 50 |
help="Type of pool. Choices:" |
b/snf-cyclades-app/synnefo/logic/management/commands/pool-list.py | ||
---|---|---|
30 | 30 |
# documentation are those of the authors and should not be |
31 | 31 |
# interpreted as representing official policies, either expressed |
32 | 32 |
# or implied, of GRNET S.A. |
33 |
|
|
34 |
from django.core.management.base import BaseCommand |
|
35 | 33 |
from optparse import make_option |
34 |
from snf_django.management.commands import SynnefoCommand |
|
36 | 35 |
from synnefo.management.common import pool_table_from_type |
37 | 36 |
|
38 | 37 |
POOL_CHOICES = ['bridge', 'mac-prefix'] |
39 | 38 |
|
40 | 39 |
|
41 |
class Command(BaseCommand):
|
|
40 |
class Command(SynnefoCommand):
|
|
42 | 41 |
help = "List available pools" |
43 | 42 |
output_transaction = True |
44 |
option_list = BaseCommand.option_list + (
|
|
43 |
option_list = SynnefoCommand.option_list + (
|
|
45 | 44 |
make_option('--type', dest='type', |
46 | 45 |
choices=POOL_CHOICES, |
47 | 46 |
help="Type of pool" |
b/snf-cyclades-app/synnefo/logic/management/commands/pool-modify.py | ||
---|---|---|
31 | 31 |
# interpreted as representing official policies, either expressed |
32 | 32 |
# or implied, of GRNET S.A. |
33 | 33 |
|
34 |
from django.core.management.base import BaseCommand, CommandError
|
|
34 |
from django.core.management.base import CommandError |
|
35 | 35 |
from optparse import make_option |
36 |
|
|
37 |
from snf_django.management.commands import SynnefoCommand |
|
36 | 38 |
from synnefo.management.common import pool_table_from_type |
37 | 39 |
|
38 | 40 |
POOL_CHOICES = ['bridge', 'mac-prefix'] |
39 | 41 |
|
40 | 42 |
|
41 |
class Command(BaseCommand):
|
|
43 |
class Command(SynnefoCommand):
|
|
42 | 44 |
args = "<pool ID>" |
43 | 45 |
help = "Modify a pool" |
44 | 46 |
output_transaction = True |
45 |
option_list = BaseCommand.option_list + (
|
|
47 |
option_list = SynnefoCommand.option_list + (
|
|
46 | 48 |
make_option('--type', dest='type', |
47 | 49 |
choices=POOL_CHOICES, |
48 | 50 |
help="Type of pool" |
b/snf-cyclades-app/synnefo/logic/management/commands/pool-show.py | ||
---|---|---|
31 | 31 |
# interpreted as representing official policies, either expressed |
32 | 32 |
# or implied, of GRNET S.A. |
33 | 33 |
|
34 |
from django.core.management.base import BaseCommand, CommandError
|
|
34 |
from django.core.management.base import CommandError |
|
35 | 35 |
from optparse import make_option |
36 | 36 |
|
37 | 37 |
from synnefo.db.pools import bitarray_to_map |
38 | 38 |
from synnefo.management import pprint, common |
39 |
from snf_django.management.commands import SynnefoCommand |
|
39 | 40 |
|
40 | 41 |
POOL_CHOICES = ['bridge', 'mac-prefix'] |
41 | 42 |
|
42 | 43 |
|
43 |
class Command(BaseCommand):
|
|
44 |
class Command(SynnefoCommand):
|
|
44 | 45 |
args = "<pool ID>" |
45 | 46 |
help = "Show a pool" |
46 | 47 |
output_transaction = True |
47 |
option_list = BaseCommand.option_list + (
|
|
48 |
option_list = SynnefoCommand.option_list + (
|
|
48 | 49 |
make_option('--type', dest='type', |
49 | 50 |
choices=POOL_CHOICES, |
50 | 51 |
help="Type of pool" |
b/snf-cyclades-app/synnefo/logic/management/commands/port-create.py | ||
---|---|---|
33 | 33 |
|
34 | 34 |
from optparse import make_option |
35 | 35 |
|
36 |
from django.core.management.base import BaseCommand, CommandError
|
|
36 |
from django.core.management.base import CommandError |
|
37 | 37 |
|
38 | 38 |
from synnefo.api import util |
39 | 39 |
from synnefo.management import common, pprint |
40 | 40 |
from snf_django.management.utils import parse_bool |
41 |
from snf_django.management.commands import SynnefoCommand |
|
41 | 42 |
from synnefo.logic import servers |
42 | 43 |
|
43 | 44 |
HELP_MSG = """Create a new port. |
... | ... | |
48 | 49 |
with the network.""" |
49 | 50 |
|
50 | 51 |
|
51 |
class Command(BaseCommand):
|
|
52 |
class Command(SynnefoCommand):
|
|
52 | 53 |
help = HELP_MSG |
53 | 54 |
|
54 |
option_list = BaseCommand.option_list + (
|
|
55 |
option_list = SynnefoCommand.option_list + (
|
|
55 | 56 |
make_option( |
56 | 57 |
"--name", |
57 | 58 |
dest="name", |
b/snf-cyclades-app/synnefo/logic/management/commands/port-inspect.py | ||
---|---|---|
32 | 32 |
# or implied, of GRNET S.A. |
33 | 33 |
|
34 | 34 |
from optparse import make_option |
35 |
from django.core.management.base import BaseCommand, CommandError
|
|
35 |
from django.core.management.base import CommandError |
|
36 | 36 |
|
37 |
from snf_django.management.commands import SynnefoCommand |
|
37 | 38 |
from synnefo.management.common import convert_api_faults |
38 | 39 |
from synnefo.management import pprint, common |
39 | 40 |
|
40 | 41 |
|
41 |
class Command(BaseCommand):
|
|
42 |
class Command(SynnefoCommand):
|
|
42 | 43 |
help = "Inspect a port on DB and Ganeti" |
43 | 44 |
args = "<port ID>" |
44 | 45 |
|
45 |
option_list = BaseCommand.option_list + (
|
|
46 |
option_list = SynnefoCommand.option_list + (
|
|
46 | 47 |
make_option( |
47 | 48 |
'--jobs', |
48 | 49 |
action='store_true', |
b/snf-cyclades-app/synnefo/logic/management/commands/queue-inspect.py | ||
---|---|---|
31 | 31 |
import pprint |
32 | 32 |
|
33 | 33 |
from optparse import make_option |
34 |
from django.core.management.base import BaseCommand, CommandError
|
|
34 |
from django.core.management.base import CommandError |
|
35 | 35 |
|
36 | 36 |
from synnefo.lib.amqp import AMQPClient |
37 |
from snf_django.management.commands import SynnefoCommand |
|
37 | 38 |
|
38 | 39 |
|
39 |
class Command(BaseCommand):
|
|
40 |
class Command(SynnefoCommand):
|
|
40 | 41 |
args = "<queue name>" |
41 | 42 |
help = "Inspect the messages of a queue. Close all other clients in "\ |
42 | 43 |
"order to be able to inspect unacknowledged messages." |
43 | 44 |
|
44 |
option_list = BaseCommand.option_list + (
|
|
45 |
option_list = SynnefoCommand.option_list + (
|
|
45 | 46 |
make_option('--no-requeue', action='store_false', dest='requeue', |
46 | 47 |
default=True, help="Do not requeue the messages"), |
47 | 48 |
make_option('-i', '--interactive', action='store_true', default=False, |
b/snf-cyclades-app/synnefo/logic/management/commands/queue-retry.py | ||
---|---|---|
27 | 27 |
# those of the authors and should not be interpreted as representing official |
28 | 28 |
# policies, either expressed or implied, of GRNET S.A. |
29 | 29 |
# |
30 |
from django.core.management.base import BaseCommand |
|
31 | 30 |
from optparse import make_option |
32 | 31 |
|
33 | 32 |
from synnefo.lib.amqp import AMQPClient |
33 |
from snf_django.management.commands import SynnefoCommand |
|
34 | 34 |
|
35 | 35 |
from synnefo.logic import queues |
36 | 36 |
|
... | ... | |
39 | 39 |
log = logging.getLogger("") |
40 | 40 |
|
41 | 41 |
|
42 |
class Command(BaseCommand):
|
|
42 |
class Command(SynnefoCommand):
|
|
43 | 43 |
help = "Resend messages from dead letter queues to original exchange""" |
44 | 44 |
|
45 |
option_list = BaseCommand.option_list + (
|
|
45 |
option_list = SynnefoCommand.option_list + (
|
|
46 | 46 |
make_option( |
47 | 47 |
'--keep-zombies', |
48 | 48 |
action='store_true', |
b/snf-cyclades-app/synnefo/logic/management/commands/reconcile-networks.py | ||
---|---|---|
36 | 36 |
""" |
37 | 37 |
import logging |
38 | 38 |
from optparse import make_option |
39 |
from django.core.management.base import BaseCommand |
|
39 |
|
|
40 | 40 |
from synnefo.logic import reconciliation |
41 |
from snf_django.management.commands import SynnefoCommand |
|
41 | 42 |
|
42 | 43 |
|
43 |
class Command(BaseCommand):
|
|
44 |
class Command(SynnefoCommand):
|
|
44 | 45 |
help = """Reconcile contents of Synnefo DB with state of Ganeti backend |
45 | 46 |
|
46 | 47 |
Network reconciliation can detect and fix the following cases: |
... | ... | |
53 | 54 |
""" |
54 | 55 |
|
55 | 56 |
can_import_settings = True |
56 |
option_list = BaseCommand.option_list + (
|
|
57 |
option_list = SynnefoCommand.option_list + (
|
|
57 | 58 |
make_option('--fix-all', action='store_true', |
58 | 59 |
dest='fix', default=False, |
59 | 60 |
help='Fix all issues.'), |
b/snf-cyclades-app/synnefo/logic/management/commands/reconcile-pools.py | ||
---|---|---|
29 | 29 |
# |
30 | 30 |
import logging |
31 | 31 |
from optparse import make_option |
32 |
from django.core.management.base import BaseCommand |
|
32 |
|
|
33 | 33 |
from synnefo.logic import reconciliation |
34 |
from snf_django.management.commands import SynnefoCommand |
|
34 | 35 |
|
35 | 36 |
|
36 | 37 |
HELP_MSG = """\ |
... | ... | |
46 | 47 |
* Pool of IPv4 addresses for each network""" |
47 | 48 |
|
48 | 49 |
|
49 |
class Command(BaseCommand):
|
|
50 |
class Command(SynnefoCommand):
|
|
50 | 51 |
help = HELP_MSG |
51 | 52 |
|
52 |
option_list = BaseCommand.option_list + (
|
|
53 |
option_list = SynnefoCommand.option_list + (
|
|
53 | 54 |
make_option("--fix", action="store_true", |
54 | 55 |
dest="fix", default=False, |
55 | 56 |
help='Fix all issues.'), |
b/snf-cyclades-app/synnefo/logic/management/commands/reconcile-servers.py | ||
---|---|---|
38 | 38 |
import logging |
39 | 39 |
import subprocess |
40 | 40 |
from optparse import make_option |
41 |
from django.core.management.base import BaseCommand |
|
41 |
|
|
42 |
from snf_django.management.commands import SynnefoCommand |
|
42 | 43 |
from synnefo.management.common import get_resource |
43 | 44 |
from synnefo.logic import reconciliation |
44 | 45 |
from snf_django.management.utils import parse_bool |
45 | 46 |
|
46 | 47 |
|
47 |
class Command(BaseCommand):
|
|
48 |
class Command(SynnefoCommand):
|
|
48 | 49 |
can_import_settings = True |
49 | 50 |
|
50 | 51 |
help = 'Reconcile contents of Synnefo DB with state of Ganeti backend' |
51 |
option_list = BaseCommand.option_list + (
|
|
52 |
option_list = SynnefoCommand.option_list + (
|
|
52 | 53 |
make_option('--backend-id', default=None, dest='backend-id', |
53 | 54 |
help='Reconcilie VMs only for this backend'), |
54 | 55 |
make_option("--parallel", |
b/snf-cyclades-app/synnefo/logic/management/commands/server-create.py | ||
---|---|---|
33 | 33 |
|
34 | 34 |
from optparse import make_option |
35 | 35 |
|
36 |
from django.core.management.base import BaseCommand, CommandError |
|
36 |
from django.core.management.base import CommandError |
|
37 |
|
|
37 | 38 |
from synnefo.management import common, pprint |
38 | 39 |
from snf_django.management.utils import parse_bool |
40 |
from snf_django.management.commands import SynnefoCommand |
|
39 | 41 |
|
40 | 42 |
from synnefo.logic import servers |
41 | 43 |
|
... | ... | |
47 | 49 |
""" |
48 | 50 |
|
49 | 51 |
|
50 |
class Command(BaseCommand):
|
|
52 |
class Command(SynnefoCommand):
|
|
51 | 53 |
help = "Create a new VM." + HELP_MSG |
52 | 54 |
|
53 |
option_list = BaseCommand.option_list + (
|
|
55 |
option_list = SynnefoCommand.option_list + (
|
|
54 | 56 |
make_option("--backend-id", dest="backend_id", |
55 | 57 |
help="Unique identifier of the Ganeti backend." |
56 | 58 |
" Use snf-manage backend-list to find out" |
b/snf-cyclades-app/synnefo/logic/management/commands/server-import.py | ||
---|---|---|
33 | 33 |
|
34 | 34 |
from optparse import make_option |
35 | 35 |
|
36 |
from django.core.management.base import BaseCommand, CommandError
|
|
36 |
from django.core.management.base import CommandError |
|
37 | 37 |
from synnefo.management import common |
38 | 38 |
|
39 | 39 |
from synnefo.db.models import VirtualMachine, Network, Flavor |
40 | 40 |
from synnefo.logic.utils import id_from_network_name, id_from_instance_name |
41 | 41 |
from synnefo.logic.backend import wait_for_job, connect_to_network |
42 |
from snf_django.management.commands import SynnefoCommand |
|
42 | 43 |
from synnefo.logic.rapi import GanetiApiError |
43 | 44 |
from synnefo.logic import servers |
44 | 45 |
from synnefo import quotas |
... | ... | |
58 | 59 |
""" |
59 | 60 |
|
60 | 61 |
|
61 |
class Command(BaseCommand):
|
|
62 |
class Command(SynnefoCommand):
|
|
62 | 63 |
help = "Import an existing Ganeti VM into Synnefo." + HELP_MSG |
63 | 64 |
args = "<ganeti_instance_name>" |
64 | 65 |
output_transaction = True |
65 | 66 |
|
66 |
option_list = BaseCommand.option_list + (
|
|
67 |
option_list = SynnefoCommand.option_list + (
|
|
67 | 68 |
make_option( |
68 | 69 |
"--backend-id", |
69 | 70 |
dest="backend_id", |
b/snf-cyclades-app/synnefo/logic/management/commands/server-inspect.py | ||
---|---|---|
32 | 32 |
# or implied, of GRNET S.A. |
33 | 33 |
|
34 | 34 |
from optparse import make_option |
35 |
from django.core.management.base import BaseCommand, CommandError
|
|
35 |
from django.core.management.base import CommandError |
|
36 | 36 |
|
37 |
from snf_django.management.commands import SynnefoCommand |
|
37 | 38 |
from synnefo.management import common |
38 | 39 |
from synnefo.management import pprint |
39 | 40 |
|
40 | 41 |
|
41 |
class Command(BaseCommand):
|
|
42 |
class Command(SynnefoCommand):
|
|
42 | 43 |
help = "Inspect a server on DB and Ganeti" |
43 | 44 |
args = "<server ID>" |
44 | 45 |
|
45 |
option_list = BaseCommand.option_list + (
|
|
46 |
option_list = SynnefoCommand.option_list + (
|
|
46 | 47 |
make_option( |
47 | 48 |
'--jobs', |
48 | 49 |
action='store_true', |
b/snf-cyclades-app/synnefo/logic/management/commands/server-modify.py | ||
---|---|---|
34 | 34 |
from optparse import make_option |
35 | 35 |
|
36 | 36 |
from django.db import transaction |
37 |
from django.core.management.base import BaseCommand, CommandError |
|
37 |
from django.core.management.base import CommandError |
|
38 |
|
|
38 | 39 |
from synnefo.management.common import (get_resource, convert_api_faults, |
39 | 40 |
wait_server_task) |
41 |
from snf_django.management.commands import SynnefoCommand |
|
40 | 42 |
from snf_django.management.utils import parse_bool |
41 | 43 |
from synnefo.logic import servers |
42 | 44 |
|
... | ... | |
44 | 46 |
ACTIONS = ["start", "stop", "reboot_hard", "reboot_soft"] |
45 | 47 |
|
46 | 48 |
|
47 |
class Command(BaseCommand):
|
|
49 |
class Command(SynnefoCommand):
|
|
48 | 50 |
args = "<server ID>" |
49 | 51 |
help = "Modify a server." |
50 | 52 |
|
51 |
option_list = BaseCommand.option_list + (
|
|
53 |
option_list = SynnefoCommand.option_list + (
|
|
52 | 54 |
make_option( |
53 | 55 |
'--name', |
54 | 56 |
dest='name', |
b/snf-cyclades-app/synnefo/logic/management/commands/service-export-cyclades.py | ||
---|---|---|
32 | 32 |
# or implied, of GRNET S.A. |
33 | 33 |
|
34 | 34 |
from django.utils import simplejson as json |
35 |
from django.core.management.base import NoArgsCommand |
|
35 |
|
|
36 |
from snf_django.management.commands import SynnefoCommand |
|
36 | 37 |
from synnefo.cyclades_settings import cyclades_services |
37 | 38 |
from synnefo.lib.services import filter_public |
38 | 39 |
|
39 | 40 |
|
40 |
class Command(NoArgsCommand):
|
|
41 |
class Command(SynnefoCommand):
|
|
41 | 42 |
help = "Export Cyclades services in JSON format." |
42 | 43 |
|
43 | 44 |
def handle(self, *args, **options): |
b/snf-cyclades-app/synnefo/logic/management/commands/subnet-create.py | ||
---|---|---|
33 | 33 |
|
34 | 34 |
from optparse import make_option |
35 | 35 |
|
36 |
from django.core.management.base import BaseCommand, CommandError |
|
36 |
from django.core.management.base import CommandError |
|
37 |
|
|
37 | 38 |
from synnefo.management import common |
39 |
from snf_django.management.commands import SynnefoCommand |
|
38 | 40 |
from snf_django.management.utils import parse_bool |
39 | 41 |
from synnefo.management import pprint |
40 | 42 |
from synnefo.logic import subnets |
... | ... | |
47 | 49 |
""" |
48 | 50 |
|
49 | 51 |
|
50 |
class Command(BaseCommand):
|
|
52 |
class Command(SynnefoCommand):
|
|
51 | 53 |
help = "Create a new Subnet." + HELP_MSG |
52 | 54 |
|
53 |
option_list = BaseCommand.option_list + (
|
|
55 |
option_list = SynnefoCommand.option_list + (
|
|
54 | 56 |
make_option("--network-id", dest="network_id", |
55 | 57 |
help="Specify the Network to attach the subnet. To get the" |
56 | 58 |
" networks of a user, use snf-manage network-list"), |
b/snf-cyclades-app/synnefo/logic/management/commands/subnet-inspect.py | ||
---|---|---|
33 | 33 |
|
34 | 34 |
#from optparse import make_option |
35 | 35 |
|
36 |
from django.core.management.base import BaseCommand, CommandError |
|
36 |
from django.core.management.base import CommandError |
|
37 |
|
|
38 |
from snf_django.management.commands import SynnefoCommand |
|
37 | 39 |
from synnefo.management import pprint, common |
38 | 40 |
|
39 | 41 |
|
40 |
class Command(BaseCommand):
|
|
42 |
class Command(SynnefoCommand):
|
|
41 | 43 |
help = "Inspect a subnet on DB and Ganeti." |
42 | 44 |
args = "<Subnet ID>" |
43 |
option_list = BaseCommand.option_list
|
|
45 |
option_list = SynnefoCommand.option_list
|
|
44 | 46 |
|
45 | 47 |
def handle(self, *args, **options): |
46 | 48 |
if len(args) != 1: |
b/snf-cyclades-app/synnefo/logic/management/commands/subnet-modify.py | ||
---|---|---|
33 | 33 |
|
34 | 34 |
from optparse import make_option |
35 | 35 |
|
36 |
from django.core.management.base import BaseCommand, CommandError |
|
36 |
from django.core.management.base import CommandError |
|
37 |
|
|
38 |
from snf_django.management.commands import SynnefoCommand |
|
37 | 39 |
from synnefo.management import common |
38 | 40 |
|
39 | 41 |
from synnefo.logic import subnets |
... | ... | |
45 | 47 |
""" |
46 | 48 |
|
47 | 49 |
|
48 |
class Command(BaseCommand):
|
|
50 |
class Command(SynnefoCommand):
|
|
49 | 51 |
help = "Update a Subnet." + HELP_MSG |
50 | 52 |
args = "<Subnet ID>" |
51 |
option_list = BaseCommand.option_list + (
|
|
53 |
option_list = SynnefoCommand.option_list + (
|
|
52 | 54 |
make_option("--name", dest="name", |
53 | 55 |
help="The new subnet name."), |
54 | 56 |
) |
b/snf-cyclades-app/synnefo/plankton/management/commands/image-list.py | ||
---|---|---|
27 | 27 |
# those of the authors and should not be interpreted as representing official |
28 | 28 |
# policies, either expressed or implied, of GRNET S.A. |
29 | 29 |
# |
30 |
|
|
31 |
from django.core.management.base import BaseCommand |
|
32 | 30 |
from optparse import make_option |
33 | 31 |
|
32 |
from snf_django.management.commands import SynnefoCommand |
|
34 | 33 |
from snf_django.management.utils import pprint_table |
35 | 34 |
from synnefo.plankton.backend import PlanktonBackend |
36 | 35 |
|
37 | 36 |
|
38 |
class Command(BaseCommand):
|
|
37 |
class Command(SynnefoCommand):
|
|
39 | 38 |
help = "List public images or images available to a user." |
40 |
option_list = BaseCommand.option_list + (
|
|
39 |
option_list = SynnefoCommand.option_list + (
|
|
41 | 40 |
make_option( |
42 | 41 |
'--user-id', |
43 | 42 |
dest='userid', |
b/snf-cyclades-app/synnefo/plankton/management/commands/image-show.py | ||
---|---|---|
28 | 28 |
# policies, either expressed or implied, of GRNET S.A. |
29 | 29 |
# |
30 | 30 |
|
31 |
from django.core.management.base import BaseCommand, CommandError
|
|
31 |
from django.core.management.base import CommandError |
|
32 | 32 |
|
33 |
from snf_django.management.commands import SynnefoCommand |
|
33 | 34 |
from synnefo.plankton.backend import PlanktonBackend |
34 | 35 |
from snf_django.management import utils |
35 | 36 |
|
36 | 37 |
|
37 |
class Command(BaseCommand):
|
|
38 |
class Command(SynnefoCommand):
|
|
38 | 39 |
args = "<image_id>" |
39 | 40 |
help = "Display available information about an image" |
40 | 41 |
|
b/snf-cyclades-app/synnefo/quotas/management/commands/reconcile-commissions-cyclades.py | ||
---|---|---|
31 | 31 |
# interpreted as representing official policies, either expressed |
Also available in: Unified diff