Try deleting the resource group. This will fail if it exists and raise an exception.
187248
def _checkIfClusterExists(self):
        
        ansibleArgs = {
            'resgrp': self.clusterName,
            'region': self._zone
        }
        try:
            self.callPlaybook(self.playbook['check-cluster'], ansibleArgs, wait=True)
        except RuntimeError:
            logger.info("The cluster could not be created. Try deleting the cluster if it already exits.")
            raise
1399
def group_remove(name, **kwargs):
    
    ctx = Context(**kwargs)
    ctx.execute_action('group:remove', **{
        'storage': ctx.repo.create_secure_service('storage'),
        'name': name,
    })
620923
@Override
    public void deleteGroup(ILockableEntityGroup group) throws GroupsException {
        throwExceptionIfNotInternallyManaged();
        try {
            if (group.getLock().isValid()) {
                removeDeletedGroupFromParentGroups(group);
                deleteGroup((IEntityGroup) group);
            } else {
                throw new GroupsException(
                        "Could not delete group " + group.getKey() + " has invalid lock.");
            }
        } catch (LockingException le) {
            throw new GroupsException("Could not delete group " + group.getKey(), le);
        } finally {
            try {
                group.getLock().release();
            } catch (LockingException le) {
            }
        }
    }
482971
def delete(self, cluster):
        
        if cluster.name not in self.clusters:
            raise ClusterNotFound(
                "Unable to delete non-existent cluster %s" % cluster.name)
        del self.clusters[cluster.name]
1280785
function deleteGroup(group) {
  if (!runningAsRoot()) return;
  if (!group) throw new Error('You must provide a group to delete');
  if (!groupExists(group)) {
    return;
  }
  const groupdelBin = _safeLocateBinary('groupdel');
  const delgroupBin = _safeLocateBinary('delgroup');

  if (isPlatform('linux')) {
    if (groupdelBin !== null) { // most modern systems
      runProgram(groupdelBin, [group]);
    } else {
      if (_isBusyboxBinary(delgroupBin)) { // busybox-based systems
        runProgram(delgroupBin, [group]);
      } else {
        throw new Error(`Don't know how to delete group ${group} on this strange linux`);
      }
    }
  } else if (isPlatform('osx')) {
    runProgram('dscl', ['.', '-delete', `/Groups/${group}`]);
  } else if (isPlatform('windows')) {
    throw new Error(`Don't know how to delete group ${group} on Windows`);
  } else {
    throw new Error(`Don't know how to delete group ${group} on the current platformp`);
  }
}
899328
async def delete_group_memory(self, memory_id):
        """"""
        act = self.service.action("X_DeleteGroupMemory")
        res = await act.async_call(MemoryID=memory_id)
247773
def _delete_resource(name, name_param, desc, res_type, wait=0, status_param=None,
                     status_gone='deleted', region=None, key=None, keyid=None, profile=None,
                     **args):
    '''
    
    '''
    try:
        wait = int(wait)
    except Exception:
        raise SaltInvocationError("Bad value ('{0}') passed for 'wait' param - must be an "
                                  "int or boolean.".format(wait))
    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
    if name_param in args:
        log.info(
            "'name: %s' param being overridden by explicitly provided '%s: %s'",
            name, name_param, args[name_param]
        )
        name = args[name_param]
    else:
        args[name_param] = name
    args = dict([(k, v) for k, v in args.items() if not k.startswith('_')])
    try:
        func = 'delete_'+res_type
        f = getattr(conn, func)
        if wait:
            func = 'describe_'+res_type+'s'
            s = globals()[func]
    except (AttributeError, KeyError) as e:
        raise SaltInvocationError("No function '{0}()' found: {1}".format(func, e.message))
    try:

        f(**args)
        if not wait:
            log.info('%s %s deletion requested.', desc.title(), name)
            return True
        log.info('Waiting up to %s seconds for %s %s to be deleted.', wait, desc, name)
        orig_wait = wait
        while wait > 0:
            r = s(name=name, conn=conn)
            if not r or r[0].get(status_param) == status_gone:
                log.info('%s %s deleted.', desc.title(), name)
                return True
            sleep = wait if wait % 60 == wait else 60
            log.info('Sleeping %s seconds for %s %s to be deleted.',
                     sleep, desc, name)
            time.sleep(sleep)
            wait -= sleep
        log.error('%s %s not deleted after %s seconds!', desc.title(), name, orig_wait)

        return False
    except botocore.exceptions.ClientError as e:
        log.error('Failed to delete %s %s: %s', desc, name, e)
        return False
107486
def delete_group(group_name, region=None, key=None,
                        keyid=None, profile=None):
    '''
    
    '''
    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
    if not conn:
        return False
    _group = get_group(
        group_name, region, key, keyid, profile
    )
    if not _group:
        return True
    try:
        conn.delete_group(group_name)
        log.info('Successfully deleted IAM group %s.', group_name)
        return True
    except boto.exception.BotoServerError as e:
        log.debug(e)
        log.error('Failed to delete IAM group %s.', group_name)
        return False
383152
private void postDelete(Group group) throws Exception
   {
      for (GroupEventListener listener : listeners)
      {
         listener.postDelete(group);
      }
   }
963546
async def delete(self, request, resource=None, **kwargs):
        
        if resource:
            resources = [resource]
        else:
            data = await self.parse(request)
            if data:
                resources = list(self.collection.where(self.meta.model_pk << data))

        if not resources:
            raise RESTNotFound(reason='Resource not found')

        for resource in resources:
            resource.delete_instance()
1008124
@Override
    protected void doDelete(HttpServletRequest req, HttpServletResponse resp) throws IOException {

        // Get the path to delete
        String path = getRelativePath(req);

        // Check if webdav is set to read only
        if (m_readOnly) {

            resp.setStatus(CmsWebdavStatus.SC_FORBIDDEN);

            if (LOG.isDebugEnabled()) {
                LOG.debug(Messages.get().getBundle().key(Messages.LOG_WEBDAV_READ_ONLY_0));
            }

            return;
        }

        // Check if path exists
        boolean exists = m_session.exists(path);
        if (!exists) {

            resp.setStatus(CmsWebdavStatus.SC_NOT_FOUND);

            if (LOG.isDebugEnabled()) {
                LOG.debug(Messages.get().getBundle().key(Messages.LOG_ITEM_NOT_FOUND_1, path));
            }

            return;
        }

        // Check if resource is locked
        if (isLocked(req)) {

            resp.setStatus(CmsWebdavStatus.SC_LOCKED);

            if (LOG.isDebugEnabled()) {
                LOG.debug(Messages.get().getBundle().key(Messages.LOG_ITEM_LOCKED_1, path));
            }

            return;
        }

        // Check if resources found in the tree of the path are locked
        Hashtable<String, Integer> errorList = new Hashtable<String, Integer>();

        checkChildLocks(req, path, errorList);
        if (!errorList.isEmpty()) {
            sendReport(req, resp, errorList);

            if (LOG.isDebugEnabled()) {
                Iterator<String> iter = errorList.keySet().iterator();
                while (iter.hasNext()) {
                    String errorPath = iter.next();
                    LOG.debug(Messages.get().getBundle().key(Messages.LOG_CHILD_LOCKED_1, errorPath));
                }
            }

            return;
        }

        // Delete the resource
        try {

            if (LOG.isDebugEnabled()) {
                LOG.debug(Messages.get().getBundle().key(Messages.LOG_DELETE_ITEM_0));
            }

            m_session.delete(path);
        } catch (CmsVfsResourceNotFoundException rnfex) {

            // should never happen
            resp.setStatus(CmsWebdavStatus.SC_NOT_FOUND);
            return;
        } catch (CmsSecurityException sex) {
            resp.setStatus(CmsWebdavStatus.SC_FORBIDDEN);

            if (LOG.isDebugEnabled()) {
                LOG.debug(Messages.get().getBundle().key(Messages.LOG_NO_PERMISSION_0));
            }

            return;
        } catch (CmsException ex) {
            resp.setStatus(CmsWebdavStatus.SC_INTERNAL_SERVER_ERROR);

            if (LOG.isErrorEnabled()) {
                LOG.error(Messages.get().getBundle().key(Messages.LOG_REPOSITORY_ERROR_2, "DELETE", path), ex);
            }

            return;
        }

        if (LOG.isDebugEnabled()) {
            LOG.debug(Messages.get().getBundle().key(Messages.LOG_DELETE_SUCCESS_0));
        }

        resp.setStatus(CmsWebdavStatus.SC_NO_CONTENT);
    }
257172
public void deleteGroup(Object groupIdOrPath) throws GitLabApiException {
        Response.Status expectedStatus = (isApiVersion(ApiVersion.V3) ? Response.Status.OK : Response.Status.NO_CONTENT);
        delete(expectedStatus, null, "groups", getGroupIdOrPath(groupIdOrPath));
    }
1212998
def _cleanup_resourceprovider(self):
        
        # Disable too broad exception warning
        # pylint: disable=W0703
        self.resourceprovider = ResourceProvider(self.args)
        try:
            self.resourceprovider.cleanup()
            self.logger.info("Cleanup done.")
        except Exception as error:
            self.logger.error("Cleanup failed! %s", error)
474691
def delete_resource_group(access_token, subscription_id, rgname):
    '''
    '''
    endpoint = ''.join([get_rm_endpoint(),
                        '/subscriptions/', subscription_id,
                        '/resourcegroups/', rgname,
                        '?api-version=', RESOURCE_API])
    return do_delete(endpoint, access_token)
897380
def teardown(exceptions=[])
      stop

      (vm_groups.keys.to_set - exceptions.to_set).each do |group_name|
        deprovision_group(group_name) # clean this after everything finishes
      end
    end
1119666
def delete_group(group_id, tasks=False, cached=Conf.CACHED):
    
    if cached:
        return delete_group_cached(group_id)
    return Task.delete_group(group_id, tasks)
829090
def begin_delete(resource_group_name, image_name, custom_headers:nil)
      response = begin_delete_async(resource_group_name, image_name, custom_headers:custom_headers).value!
      nil
    end