Revision 2333a2c4 snf-cyclades-app/synnefo/logic/management/commands/backend-modify.py

b/snf-cyclades-app/synnefo/logic/management/commands/backend-modify.py
33 33

  
34 34
from optparse import make_option
35 35
from django.core.management.base import BaseCommand, CommandError
36
from synnefo.management.common import get_backend
36
from synnefo.management.common import get_backend, check_backend_credentials
37 37

  
38 38

  
39 39
class Command(BaseCommand):
40
    output_transaction = True
40 41
    args = "<backend ID>"
41 42
    help = "Modify a backend"
42 43

  
......
87 88
            if value is not None:
88 89
                backend.__setattr__(field, value)
89 90

  
91
        credentials = ('clustername', 'port', 'username', 'password')
92
        for field in credentials:
93
            if options.get(field):
94
                # check credentials, if any of them changed!
95
                check_backend_credentials(backend.clustername, backend.port,
96
                                          backend.username, backend.password)
97
                return
98

  
90 99
        backend.save()

Also available in: Unified diff