#NEWLINE# def ex_provision_node( self , **kwargs ) : #NEWLINE# #INDENT# '\n        Provision a server on a VR package and get it booted\n\n        :keyword node: node which should be used\n        :type    node: :class:`Node`\n\n        :keyword image: The distribution to deploy on your server (mandatory)\n        :type    image: :class:`NodeImage`\n\n        :keyword auth: an SSH key or root password (mandatory)\n        :type    auth: :class:`NodeAuthSSHKey` or :class:`NodeAuthPassword`\n\n        :keyword location: which datacenter to create the server in\n        :type    location: :class:`NodeLocation`\n\n        :return: Node representing the newly built server\n        :rtype: :class:`Node`\n        ' #NEWLINE# node = kwargs [ 'node' ] #NEWLINE# if ( 'image' in kwargs ) : #NEWLINE# #INDENT# image = kwargs [ 'image' ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# image = node . extra [ 'image' ] #NEWLINE# #UNINDENT# params = { #NEWLINE# #INDENT# 'mbpkgid' : node . id , #NEWLINE# 'image' : image , #NEWLINE# 'fqdn' : node . name , #NEWLINE# 'location' : node . extra [ 'location' ] , #NEWLINE# #UNINDENT# } #NEWLINE# auth = kwargs [ 'auth' ] #NEWLINE# ssh_key = None #NEWLINE# password = None #NEWLINE# if isinstance ( auth , NodeAuthSSHKey ) : #NEWLINE# #INDENT# ssh_key = auth . pubkey #NEWLINE# params [ 'ssh_key' ] = ssh_key #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( self , NodeAuthPassword ) : #NEWLINE# #INDENT# password = auth . password #NEWLINE# params [ 'password' ] = password #NEWLINE# #UNINDENT# #UNINDENT# if ( ( not ssh_key ) and ( not password ) ) : #NEWLINE# #INDENT# raise HostVirtualException ( 500 , 'SSH key or Root password is required' ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# result = self . connection . request ( ( API_ROOT + '/cloud/server/build' ) , data = json . dumps ( params ) , method = 'POST' ) . object #NEWLINE# return bool ( result ) #NEWLINE# #UNINDENT# except HostVirtualException : #NEWLINE# #INDENT# self . ex_cancel_package ( node )