def vm_absent(name, archive=False):
 name = name.lower()
 ret = {'name': name, 'changes': {}, 'result': None, 'comment': ''}
 if (name not in __salt__['vmadm.list'](order='hostname')):
  ret['result'] = True
  ret['comment'] = 'vm {0} is absent'.format(name)
 else:
  if (not __opts__['test']):
   if archive:
    __salt__['vmadm.update'](vm=name, key='hostname', archive_on_delete=True)
   ret['result'] = __salt__['vmadm.delete'](name, key='hostname')
  else:
   ret['result'] = True
  if ((not isinstance(ret['result'], bool)) and ret['result'].get('Error')):
   ret['result'] = False
   ret['comment'] = 'failed to delete vm {0}'.format(name)
  else:
   ret['comment'] = 'vm {0} deleted'.format(name)
   ret['changes'][name] = None
 return ret

def vm_absent ( name , archive = False ) : name = name . lower ( ) ret = { 'name' : name , 'changes' : { } , 'result' : None , 'comment' : '' } if ( name not in __salt__ [ 'vmadm.list' ] ( order = 'hostname' ) ) : ret [ 'result' ] = True ret [ 'comment' ] = 'vm {0} is absent' . format ( name ) else : if ( not __opts__ [ 'test' ] ) : if archive : __salt__ [ 'vmadm.update' ] ( vm = name , key = 'hostname' , archive_on_delete = True ) ret [ 'result' ] = __salt__ [ 'vmadm.delete' ] ( name , key = 'hostname' ) else : ret [ 'result' ] = True if ( ( not isinstance ( ret [ 'result' ] , bool ) ) and ret [ 'result' ] . get ( 'Error' ) ) : ret [ 'result' ] = False ret [ 'comment' ] = 'failed to delete vm {0}' . format ( name ) else : ret [ 'comment' ] = 'vm {0} deleted' . format ( name ) ret [ 'changes' ] [ name ] = None return ret
ensure vm is absent on the computenode name : string hostname of vm archive : boolean toggle archiving of vm on removal .