Return True if tenant exists.
544738
def tenant_exists(self, keystone, tenant):
        """"""
        self.log.debug('Checking if tenant exists ({})...'.format(tenant))
        return tenant in [t.name for t in keystone.tenants.list()]
136985
def resource_exists(self, name):
        """"""
        if name not in self.available:
            try:
                get_zoneinfo().getinfo('zoneinfo/' + name)
                self.available[name] = True
            except KeyError:
                self.available[name] = False

        return self.available[name]
818225
def exists(self):
        """"""
        try:
            self.cc.sql_client.send(
                'EXPLAIN SELECT * FROM "{table_name}"'.format(
                    table_name=self.table_name),
                do_post=False)
            return True
        except CartoException as err:
            # If table doesn't exist, we get an error from the SQL API
            self.cc._debug_print(err=err)
            return False
781313
def _bucket_exists(self):
        """"""
        try:
            self.s3client.get_bucket_location(Bucket=self.bucket)
            return True
        except ClientError as error:
            LOG.error(error)
            return False
633022
public boolean isOwnedBy(String possibleOwner) {
        boolean retval = false;
        if (this.owner != null) {
            retval = (this.owner.compareTo(possibleOwner) == 0);
        }
        return retval;
    }
1277403
def tenant_absent(name, profile=None, **connection_args):
    '''
    
    '''
    ret = {'name': name,
           'changes': {},
           'result': True,
           'comment': 'Tenant / project "{0}" is already absent'.format(name)}

    # Check if tenant is present
    tenant = __salt__['keystone.tenant_get'](name=name,
                                             profile=profile,
                                             **connection_args)
    if 'Error' not in tenant:
        if __opts__.get('test'):
            ret['result'] = None
            ret['comment'] = 'Tenant / project "{0}" will be deleted'.format(name)
            return ret
        # Delete tenant
        __salt__['keystone.tenant_delete'](name=name, profile=profile,
                                           **connection_args)
        ret['comment'] = 'Tenant / project "{0}" has been deleted'.format(name)
        ret['changes']['Tenant/Project'] = 'Deleted'

    return ret
819782
private void checkTenantApps(Tenant tenant) {
        m_logger.info("   Tenant: {}", tenant.getName());
        try {
            Iterator<DRow> rowIter =
                DBService.instance(tenant).getAllRows(SchemaService.APPS_STORE_NAME).iterator();
            if (!rowIter.hasNext()) {
                m_logger.info("      <no applications>");
            }
            while (rowIter.hasNext()) {
                DRow row = rowIter.next();
                ApplicationDefinition appDef = loadAppRow(tenant, getColumnMap(row.getAllColumns(1024).iterator()));
                if (appDef != null) {
                    String appName = appDef.getAppName();
                    String ssName = getStorageServiceOption(appDef);
                    m_logger.info("      Application '{}': StorageService={}; keyspace={}",
                                  new Object[]{appName, ssName, tenant.getName()});
                    if (DoradusServer.instance().findStorageService(ssName) == null) {
                        m_logger.warn("      >>>Application '{}' uses storage service '{}' which has not been " +
                                        "initialized; application will not be accessible via this server",
                                        appDef.getAppName(), ssName);
                    }
                }
            }
        } catch (Exception e) {
            m_logger.warn("Could not check tenant '" + tenant.getName() +
                          "'. Applications may be unavailable.", e);
        }
    }
813501
def exists(provider, config_location=DEFAULT_CONFIG_DIR):
    

    config_dir = os.path.join(config_location, NOIPY_CONFIG)
    auth_file = os.path.join(config_dir, provider)
    return os.path.exists(auth_file)
1115106
def exists(self):
        
        try:
            self.instance_admin_client.get_app_profile(self.name)
            return True
        # NOTE: There could be other exceptions that are returned to the user.
        except NotFound:
            return False
1001636
def get_user_tenants(user, group):
    """"""
    if user.is_active and user.is_authenticated():
        if user.is_superuser or is_group_manager(user, group.pk):
            return Tenant.objects.filter(group=group)
        else:
            return Tenant.objects.filter(group=group, tenantrole__user=user).distinct()
    else:
        return Tenant.objects.none()
524168
def user_exists(username):
    """"""
    try:
        pwd.getpwnam(username)
        user_exists = True
    except KeyError:
        user_exists = False
    return user_exists
644646
def has_instance(name, provider=None):
    '''
    
    '''
    data = get_instance(name, provider)
    if data is None:
        return False
    return True
1327333
def exists(self, filepath):
        """"""
        if self.is_ssh(filepath):
            self._check_ftp()
            remotepath = self._get_remote(filepath)
            try:
                self.ftp.stat(remotepath)
            except IOError as e:
                if e.errno == errno.ENOENT:
                    return False
            else:
                return True
        else:
            return os.path.exists(filepath)
203836
def relation_exists(self, parent, child, relation_type):
        """"""
        return PIDRelation.query.filter_by(
            child_pid_id=child.id,
            parent_pid_id=parent.id,
            relation_type=relation_type).count() > 0
5489
def _check_exists(database: Database, table: LdapObjectClass, key: str, value: str):
    
    try:
        get_one(table, Q(**{key: value}), database=database)
        return True
    except ObjectDoesNotExist:
        return False
167594
def where_exists(self, query, boolean="and", negate=False):
        
        if isinstance(query, Builder):
            query = query.get_query()

        self.get_query().where_exists(query, boolean, negate)

        return self
929590
def exists(self, qname):
        '''
        
        '''
        try:
            # First if not exists() -> exit
            if self.conn.queue_exists(qname):
                return True
            return False
        except pyrax.exceptions as err_msg:
            log.error('RackSpace API got some problems during '
                      'existing queue check: %s',
                      err_msg)
        return False