Revision 8b178e6b snf-cyclades-app/synnefo/api/management/commands/server-create.py
b/snf-cyclades-app/synnefo/api/management/commands/server-create.py | ||
---|---|---|
34 | 34 |
from optparse import make_option |
35 | 35 |
|
36 | 36 |
from django.core.management.base import BaseCommand, CommandError |
37 |
from synnefo.management import common |
|
37 |
from synnefo.management import common, pprint |
|
38 |
from snf_django.management.utils import parse_bool |
|
38 | 39 |
|
39 | 40 |
from synnefo.logic import servers |
40 | 41 |
|
... | ... | |
67 | 68 |
" Use snf-manage flavor-list to find out" |
68 | 69 |
" available flavors."), |
69 | 70 |
make_option("--password", dest="password", |
70 |
help="Password for the new server") |
|
71 |
help="Password for the new server"), |
|
72 |
make_option( |
|
73 |
'--wait', |
|
74 |
dest='wait', |
|
75 |
default="True", |
|
76 |
choices=["True", "False"], |
|
77 |
metavar="True|False", |
|
78 |
help="Wait for Ganeti job to complete."), |
|
79 |
|
|
71 | 80 |
) |
72 | 81 |
|
73 | 82 |
@common.convert_api_faults |
... | ... | |
100 | 109 |
else: |
101 | 110 |
backend = None |
102 | 111 |
|
103 |
servers.create(user_id, name, password, flavor, image, |
|
104 |
use_backend=backend) |
|
112 |
server = servers.create(user_id, name, password, flavor, image, |
|
113 |
use_backend=backend) |
|
114 |
pprint.pprint_server(server, stdout=self.stdout) |
|
115 |
|
|
116 |
wait = parse_bool(options["wait"]) |
|
117 |
common.wait_server_task(server, wait, self.stdout) |
Also available in: Unified diff