def vm_action(name, kwargs=None, call=None):
 if (call != 'action'):
  raise SaltCloudSystemExit('The vm_action function must be called with -a or --action.')
 if (kwargs is None):
  kwargs = {}
 action = kwargs.get('action', None)
 if (action is None):
  raise SaltCloudSystemExit("The vm_action function must have an 'action' provided.")
 (server, user, password) = _get_xml_rpc()
 auth = ':'.join([user, password])
 vm_id = int(get_vm_id(kwargs={'name': name}))
 response = server.one.vm.action(auth, action, vm_id)
 data = {'action': ('vm.action.' + str(action)), 'actioned': response[0], 'vm_id': response[1], 'error_code': response[2]}
 return data

def vm_action ( name , kwargs = None , call = None ) : if ( call != 'action' ) : raise SaltCloudSystemExit ( 'The vm_action function must be called with -a or --action.' ) if ( kwargs is None ) : kwargs = { } action = kwargs . get ( 'action' , None ) if ( action is None ) : raise SaltCloudSystemExit ( "The vm_action function must have an 'action' provided." ) ( server , user , password ) = _get_xml_rpc ( ) auth = ':' . join ( [ user , password ] ) vm_id = int ( get_vm_id ( kwargs = { 'name' : name } ) ) response = server . one . vm . action ( auth , action , vm_id ) data = { 'action' : ( 'vm.action.' + str ( action ) ) , 'actioned' : response [ 0 ] , 'vm_id' : response [ 1 ] , 'error_code' : response [ 2 ] } return data
submits an action to be performed on a given virtual machine .