Verify that each PTR record has corresponding SRV, TXT, and either A or AAAA records.
Request any that are missing.
343832
private void fetchMissingRecords() throws IOException {
        logger.debug("Records includes:");
        records.forEach(r -> logger.debug("{}", r));
        for (PtrRecord ptr : records.stream().filter(r -> r instanceof PtrRecord).map(r -> (PtrRecord) r).collect(Collectors.toList())) {
            fetchMissingSrvRecordsFor(ptr);
            fetchMissingTxtRecordsFor(ptr);
        }
        for (SrvRecord srv : records.stream().filter(r -> r instanceof SrvRecord).map(r -> (SrvRecord) r).collect(Collectors.toList())) {
            fetchMissingAddressRecordsFor(srv);
        }
    }
336316
def update_ptr_record(self, device, record, domain_name, data=None,
            ttl=None, comment=None):
        
        device_type = self._resolve_device_type(device)
        href, svc_name = self._get_ptr_details(device, device_type)
        try:
            rec_id = record.id
        except AttributeError:
            rec_id = record
        rec = {"name": domain_name,
              "id": rec_id,
              "type": "PTR",
              "data": data,
            }
        if ttl is not None:
            # Minimum TTL is 300 seconds
            rec["ttl"] = max(300, ttl)
        if comment is not None:
            # Maximum comment length is 160 chars
            rec["comment"] = comment[:160]
        body = {"recordsList": {
                    "records": [rec]},
                "link": {
                    "content": "",
                    "href": href,
                    "rel": svc_name,
                }}
        uri = "/rdns"
        try:
            resp, resp_body = self._async_call(uri, body=body, method="PUT",
                    has_response=False, error_class=exc.PTRRecordUpdateFailed)
        except exc.EndpointNotFound as e:
            raise exc.InvalidPTRRecord("The record domain/IP address "
                    "information is not valid for this device.")
        return resp_body.get("status") == "COMPLETED"
684204
def action_verify_checksum(self, ids):
        """"""
        try:
            count = 0
            for file_id in ids:
                f = FileInstance.query.filter_by(
                    id=uuid.UUID(file_id)).one_or_none()
                if f is None:
                    raise ValueError(_("Cannot find file instance."))
                verify_checksum.delay(file_id)
                count += 1
            if count > 0:
                flash(_('Fixity check(s) sent to queue.'), 'success')
        except Exception as exc:
            if not self.handle_view_exception(exc):
                raise
            current_app.logger.exception(str(exc))  # pragma: no cover
            flash(_('Failed to run fixity checks.'),
                  'error')
755404
def _list_records(self, rtype=None, name=None, content=None):
        """"""
        if self.protocol == 'rpc':
            return self.rpc_helper.list_records(rtype, name, content)

        try:
            if name is not None:
                if rtype is not None:
                    query_results = [self._get(
                        '/domains/{0}/records/{1}/{2}'
                        .format(self.domain_id, self._relative_name(name), rtype))]
                else:
                    query_results = self._get('/domains/{0}/records/{1}'
                                              .format(self.domain_id, self._relative_name(name)))
            else:
                query_results = self._get(
                    '/domains/{0}/records'.format(self.domain_id))
                if rtype is not None:
                    query_results = [
                        item for item in query_results if item['rrset_type'] == rtype]
        except requests.exceptions.HTTPError as error:
            if error.response.status_code == 404:
                query_results = []
            else:
                raise

        # convert records with multiple values into single-value records
        records = []
        for query_result in query_results:
            for value in query_result['rrset_values']:
                record = {
                    'type': query_result['rrset_type'],
                    'name': self._full_name(query_result['rrset_name']),
                    'ttl': query_result['rrset_ttl'],
                    'content': value,
                    'id': query_result['rrset_name'],
                }
                # cleanup potential quoting if suitable
                self._clean_TXT_record(record)
                records.append(record)
        # filter for content, if requested
        if content is not None:
            records = [
                record for record in records if record['content'] == content]
        LOGGER.debug('list_records: %s', records)
        return records
466748
def _verify_attachments(self):
        '''
        '''
        if self.attachments is None:
            return
        keys = ('Name', 'Content', 'ContentType')
        self._verify_dict_list(self.attachments, keys, 'Attachment')
459367
def checkConsistency(self):
        
        for referenceName, (dataUrl, indexFile) in self._chromFileMap.items():
            varFile = pysam.VariantFile(dataUrl, index_filename=indexFile)
            try:
                for chrom in varFile.index:
                    chrom, _, _ = self.sanitizeVariantFileFetch(chrom)
                    if not isEmptyIter(varFile.fetch(chrom)):
                        self._checkMetadata(varFile)
                        self._checkCallSetIds(varFile)
            finally:
                varFile.close()
1267975
public function requireDefaultRecords()
	{
		parent::requireDefaultRecords();

		// Skip creation of default records
		if (!self::config()->create_default_pages) {
			return;
		}

		// Ensure that an assets path exists before we do any error page creation
		if (!file_exists(ASSETS_PATH)) {
			mkdir(ASSETS_PATH);
		}

		$code = self::$defaults['ErrorCode'];

        $page = UtilityPage::get()->filter('ErrorCode', $code)->first();
        $pageExists = !empty($page);
        if (!$pageExists) {

            $page = UtilityPage::get()->first();
		    $pageExists = ($page && $page->exists());

            //Only create a UtilityPage on dev/build if one does not already exist.

				$page = UtilityPage::create(array(
					'Title'      => _t('MaintenanceMode.TITLE', 'Undergoing Scheduled Maintenance'),
					'URLSegment' => _t('MaintenanceMode.URLSEGMENT', 'offline'),
					'MenuTitle'  => _t('MaintenanceMode.MENUTITLE', 'Utility Page'),
					'Content'    => _t('MaintenanceMode.CONTENT', '<h1>We&rsquo;ll be back soon!</h1>'
.'<p>Sorry for the inconvenience but '
.'our site is currently down for scheduled maintenance. '
.'If you need to you can always <a href="mailto:#">contact us</a>, '
.'otherwise we&rsquo;ll be back online shortly!</p>'
.'<p>&mdash; The Team</p>'),
					'ParentID'   => 0
				));
				$page->write();
                $page->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE);

        }

        // Ensure a static error page is created from latest Utility Page content

        // Check if static files are enabled
        if (!self::config()->enable_static_file) {
            return;
        }

        // Ensure this page has cached error content
        $success = true;
        if (!$page->hasStaticPage()) {
            // Update static content
            $success = $page->writeStaticPage();
        } elseif ($pageExists) {
            // If page exists and already has content, no alteration_message is displayed
            return;
        }

        if ($success) {
            DB::alteration_message(
                sprintf('%s error Utility Page created', $code),
                'created'
            );
        } else {
            DB::alteration_message(
                sprintf('%s error Utility page could not be created. Please check permissions', $code),
                'error'
            );
        }

	}
5735
def ensure_valid_associated_record(association)
      value = send(association)
      predicate = :"#{association}?"

      if !value.class.respond_to?(predicate) || !value.class.send(predicate)
        errors.add association, I18n.t(:invalid, scope: [:errors, :messages])
      end
    end
166984
def filterMapAttrs(records=getIndex(), **tags):
    """"""
    if len(tags) == 0: return records # otherwise if unspecified, all given records match
    ret = []
    for record in records: # attempt to match attributes
        if matchRecordAttrs(record, tags):
            ret.append(record)
    return ret
146648
def associated_records_to_validate_or_save(association,
                                               new_record,
                                               autosave)
      if new_record || autosave
        association && association.target
      else
        association.target.find_all(&:new_record?)
      end
    end
345756
def validate_data_files(problem, data_files, min_size):
  """"""
  # Check that all files are present
  data_dir = os.path.split(data_files[0])[0]
  out_filepaths = problem.out_filepaths(data_dir)
  missing_filepaths = set(out_filepaths) - set(data_files)
  if missing_filepaths:
    tf.logging.error("Missing %d data files", len(missing_filepaths))

  # Check that each file is at least 100M
  too_small = []
  for data_file in data_files:
    length = get_length(data_file)
    if length < min_size:
      too_small.append(data_file)
  if too_small:
    tf.logging.error("%d files too small", len(too_small))

  bad_files = too_small + list(missing_filepaths)
  return bad_files
983115
function isValidRecord(rec) {
  if (rec.v === null ||
      rec.level === null ||
      rec.name === null ||
      rec.hostname === null ||
      rec.pid === null ||
      rec.time === null ||
      rec.msg === null) {
    // Not valid Bunyan log.
    return false;
  } else {
    return true;
  }
}
435542
def namedb_find_missing_and_extra(cur, record, table_name):
    
    rec_missing = []
    rec_extra = []
    
    # sanity check: all fields must be defined
    name_fields_rows = db_query_execute(cur, 'PRAGMA table_info({})'.format(table_name), ())
    name_fields = []
    for row in name_fields_rows:
        name_fields.append( row['name'] )

    # make sure each column has a record field
    for f in name_fields:
        if f not in record.keys():
            rec_missing.append( f )

    # make sure each record field has a column
    for k in record.keys():
        if k not in name_fields:
            rec_extra.append( k )

    return rec_missing, rec_extra
417367
public function requireDefaultRecords()
    {
        parent::requireDefaultRecords();

        // Only run on ErrorPage class directly, not subclasses
        if (static::class !== self::class || !SiteTree::config()->create_default_pages) {
            return;
        }

        $defaultPages = $this->getDefaultRecords();

        foreach ($defaultPages as $defaultData) {
            $this->requireDefaultRecordFixture($defaultData);
        }
    }
848545
def _scan_pth_files(dir_paths):
    """"""
    for dir_path in dir_paths:
      if not os.path.exists(dir_path):
        continue

      pth_filenames = (f for f in os.listdir(dir_path) if f.endswith('.pth'))
      for pth_filename in pth_filenames:
        yield os.path.join(dir_path, pth_filename)
736517
def create_record_ptr(self, record, data, ttl=60):
        
        resource_record = self._generate_create_dict(record, 'PTR', data, ttl)

        return self.record.createObject(resource_record)
822722
def _VerifyRecord(self, pls_record):
    
    # Verify that the timestamp is no more than six years into the future.
    # Six years is an arbitrary time length just to evaluate the timestamp
    # against some value. There is no guarantee that this will catch everything.
    # TODO: Add a check for similarly valid value back in time. Maybe if it the
    # timestamp is before 1980 we are pretty sure it is invalid?
    # TODO: This is a very flaky assumption. Find a better one.
    future_timestamp = (
        timelib.Timestamp.GetNow() + self._SIX_YEARS_IN_MICRO_SECONDS)

    if pls_record.last_written_time > future_timestamp:
      return False

    # Take the first word from the query field and attempt to match that against
    # known query keywords.
    first_word, _, _ = pls_record.query.partition(' ')

    if first_word.lower() not in self._PLS_KEYWORD:
      return False

    return True