Revision e41977e2 snf-cyclades-app/synnefo/logic/management/commands/backend_add.py
b/snf-cyclades-app/synnefo/logic/management/commands/backend_add.py | ||
---|---|---|
31 | 31 |
from optparse import make_option |
32 | 32 |
from django.core.management.base import BaseCommand, CommandError |
33 | 33 |
|
34 |
from synnefo.db.models import Backend, Network |
|
34 |
from synnefo.db.models import Backend, Network, BackendNetwork
|
|
35 | 35 |
from django.db.utils import IntegrityError |
36 | 36 |
from synnefo.logic.backend import (get_physical_resources, |
37 | 37 |
update_resources, |
... | ... | |
65 | 65 |
def handle(self, **options): |
66 | 66 |
clustername = options['clustername'] |
67 | 67 |
port = options['port'] |
68 |
username = options['user'] |
|
69 |
password = options['pass'] |
|
68 |
username = options['username']
|
|
69 |
password = options['password']
|
|
70 | 70 |
drained = options['drained'] |
71 | 71 |
|
72 | 72 |
if not (clustername and username and password): |
... | ... | |
132 | 132 |
self.stdout.write(sep + '\n\n') |
133 | 133 |
|
134 | 134 |
for net in networks: |
135 |
BackendNetwork.objects.create(network=net, backend=backend) |
|
135 | 136 |
result = create_network_synced(net, backend) |
136 | 137 |
if result[0] != "success": |
137 | 138 |
self.stdout.write('\nError Creating Network %s: %s\n' %\ |
138 |
(net.backend_id, result[1]) |
|
139 |
(net.backend_id, result[1])) |
Also available in: Unified diff