def exit_maintenance_mode(kwargs=None, call=None):
 if (call != 'function'):
  raise SaltCloudSystemExit('The exit_maintenance_mode function must be called with -f or --function.')
 host_name = (kwargs.get('host') if (kwargs and ('host' in kwargs)) else None)
 host_ref = salt.utils.vmware.get_mor_by_property(_get_si(), vim.HostSystem, host_name)
 if ((not host_name) or (not host_ref)):
  raise SaltCloudSystemExit('You must specify a valid name of the host system.')
 if (not host_ref.runtime.inMaintenanceMode):
  return {host_name: 'already not in maintenance mode'}
 try:
  task = host_ref.ExitMaintenanceMode(timeout=0)
  salt.utils.vmware.wait_for_task(task, host_name, 'exit maintenance mode')
 except Exception as exc:
  log.error('Error while moving host system {0} out of maintenance mode: {1}'.format(host_name, exc), exc_info_on_loglevel=logging.DEBUG)
  return {host_name: 'failed to exit maintenance mode'}
 return {host_name: 'exited maintenance mode'}

def exit_maintenance_mode ( kwargs = None , call = None ) : if ( call != 'function' ) : raise SaltCloudSystemExit ( 'The exit_maintenance_mode function must be called with -f or --function.' ) host_name = ( kwargs . get ( 'host' ) if ( kwargs and ( 'host' in kwargs ) ) else None ) host_ref = salt . utils . vmware . get_mor_by_property ( _get_si ( ) , vim . HostSystem , host_name ) if ( ( not host_name ) or ( not host_ref ) ) : raise SaltCloudSystemExit ( 'You must specify a valid name of the host system.' ) if ( not host_ref . runtime . inMaintenanceMode ) : return { host_name : 'already not in maintenance mode' } try : task = host_ref . ExitMaintenanceMode ( timeout = 0 ) salt . utils . vmware . wait_for_task ( task , host_name , 'exit maintenance mode' ) except Exception as exc : log . error ( 'Error while moving host system {0} out of maintenance mode: {1}' . format ( host_name , exc ) , exc_info_on_loglevel = logging . DEBUG ) return { host_name : 'failed to exit maintenance mode' } return { host_name : 'exited maintenance mode' }
to take the specified host system out of maintenance mode in this vmware environment cli example: .