Revision a6e6fe48 snf-cyclades-app/synnefo/logic/management/commands/backend-modify.py
b/snf-cyclades-app/synnefo/logic/management/commands/backend-modify.py | ||
---|---|---|
1 |
# Copyright 2012 GRNET S.A. All rights reserved. |
|
1 |
# Copyright 2012-2014 GRNET S.A. All rights reserved.
|
|
2 | 2 |
# |
3 | 3 |
# Redistribution and use in source and binary forms, with or |
4 | 4 |
# without modification, are permitted provided that the following |
... | ... | |
35 | 35 |
from django.core.management.base import BaseCommand, CommandError |
36 | 36 |
from synnefo.db.models import Backend |
37 | 37 |
from snf_django.management.utils import parse_bool |
38 |
from synnefo.management.common import (get_backend, check_backend_credentials)
|
|
38 |
from synnefo.management import common
|
|
39 | 39 |
|
40 | 40 |
HYPERVISORS = [h[0] for h in Backend.HYPERVISORS] |
41 | 41 |
|
... | ... | |
82 | 82 |
if len(args) != 1: |
83 | 83 |
raise CommandError("Please provide a backend ID") |
84 | 84 |
|
85 |
backend = get_backend(args[0])
|
|
85 |
backend = common.get_resource("backend", args[0], for_update=True)
|
|
86 | 86 |
|
87 | 87 |
# Ensure fields correspondence with options and Backend model |
88 | 88 |
credentials_changed = False |
... | ... | |
95 | 95 |
|
96 | 96 |
if credentials_changed: |
97 | 97 |
# check credentials, if any of them changed! |
98 |
check_backend_credentials(backend.clustername, backend.port, |
|
99 |
backend.username, backend.password) |
|
98 |
common.check_backend_credentials(backend.clustername, |
|
99 |
backend.port, |
|
100 |
backend.username, |
|
101 |
backend.password) |
|
100 | 102 |
if options['drained']: |
101 | 103 |
backend.drained = parse_bool(options['drained'], strict=True) |
102 | 104 |
if options['offline']: |
Also available in: Unified diff