27 lines
773 B
Python
27 lines
773 B
Python
import argparse
|
|
from uuid import uuid4
|
|
|
|
from SWSCloudCore.controllers import ControllerManageServer
|
|
|
|
__author__ = 'vanzhiganov'
|
|
|
|
|
|
parser = argparse.ArgumentParser(description='')
|
|
parser.add_argument('--dc', dest="datacenter")
|
|
parser.add_argument('--secret', dest="secret")
|
|
parser.add_argument('--status', dest="status")
|
|
parser.add_argument('--ip', dest="ip")
|
|
parser.add_argument('--hostname', dest="hostname")
|
|
|
|
args = parser.parse_args()
|
|
|
|
server_id = uuid4()
|
|
|
|
if not ControllerManageServer().check_exists(args.ip, None, args.hostname):
|
|
ControllerManageServer().item_create(
|
|
args.datacenter, server_id, args.secret, args.hostname,
|
|
args.ip, None, args.status
|
|
)
|
|
else:
|
|
print 'fail'
|
|
# print "Admin account with email '%s' already exists." % args
|