code: def _write_cert_to_database(ca_name, cert, cacert_path=None, status='V'):
      '''
      write out the index.txt database file in the appropriate directory to
      track certificates
  
      ca_name
          name of the CA
      cert
          certificate to be recorded
      '''
      set_ca_path(cacert_path)
      ca_dir = '{0}/{1}'.format(cert_base_path(), ca_name)
      index_file, expire_date, serial_number, subject = _get_basic_info(
          ca_name,
          cert,
          ca_dir)
  
      index_data = '{0}\t{1}\t\t{2}\tunknown\t{3}'.format(
          status,
          expire_date,
          serial_number,
          subject
      )
  
      with salt.utils.files.fopen(index_file, 'a+') as ofile:
          ofile.write(salt.utils.stringutils.to_str(index_data)f _write_cert_to_database(ca_name, cert, cacert_path=None, status='V'):
      '''
      write out the index.txt database file in the appropriate directory to
      track certificates
  
      ca_name
          name of the CA
      cert
          certificate to be recorded
      '''
      set_ca_path(cacert_path)
      ca_dir = '{0}/{1}'.format(cert_base_path(), ca_name)
      index_file, expire_date, serial_number, subject = _get_basic_info(
          ca_name,
          cert,
          ca_dir)
  
      index_data = '{0}\t{1}\t\t{2}\tunknown\t{3}'.format(
          status,
          expire_date,
          serial_number,
          subject
      )
  
      with salt.utils.files.fopen(index_file, 'a+') as ofile:
          ofile.write(salt.utils.stringutils.to_str(index_data))
docs: write out the index.txt database file in the appropriate directory to
      track certificates
  
      ca_name
          name of the CA
      cert
          certificate to be recorded