def vm_attach(name, kwargs=None, call=None):
 if (call != 'action'):
  raise SaltCloudSystemExit('The vm_attach action must be called with -a or --action.')
 if (kwargs is None):
  kwargs = {}
 path = kwargs.get('path', None)
 data = kwargs.get('data', None)
 if data:
  if path:
   log.warning("Both the 'data' and 'path' arguments were provided. 'data' will take precedence.")
 elif path:
  data = salt.utils.fopen(path, mode='r').read()
 else:
  raise SaltCloudSystemExit("The vm_attach function requires either 'data' or a file 'path' to be provided.")
 (server, user, password) = _get_xml_rpc()
 auth = ':'.join([user, password])
 vm_id = int(get_vm_id(kwargs={'name': name}))
 response = server.one.vm.attach(auth, vm_id, data)
 ret = {'action': 'vm.attach', 'attached': response[0], 'vm_id': response[1], 'error_code': response[2]}
 return ret

def vm_attach ( name , kwargs = None , call = None ) : if ( call != 'action' ) : raise SaltCloudSystemExit ( 'The vm_attach action must be called with -a or --action.' ) if ( kwargs is None ) : kwargs = { } path = kwargs . get ( 'path' , None ) data = kwargs . get ( 'data' , None ) if data : if path : log . warning ( "Both the 'data' and 'path' arguments were provided. 'data' will take precedence." ) elif path : data = salt . utils . fopen ( path , mode = 'r' ) . read ( ) else : raise SaltCloudSystemExit ( "The vm_attach function requires either 'data' or a file 'path' to be provided." ) ( server , user , password ) = _get_xml_rpc ( ) auth = ':' . join ( [ user , password ] ) vm_id = int ( get_vm_id ( kwargs = { 'name' : name } ) ) response = server . one . vm . attach ( auth , vm_id , data ) ret = { 'action' : 'vm.attach' , 'attached' : response [ 0 ] , 'vm_id' : response [ 1 ] , 'error_code' : response [ 2 ] } return ret
attaches a new disk to the given virtual machine .