Beispiel #1
0
 def _prepare_path_json(self,
                        organization_id,
                        container_id,
                        common_name,
                        validity_years,
                        csr,
                        bug,
                        sans=None,
                        whois_check=False,
                        renewal_of_order_id=None):
     app.logger.debug(fmt('_prepare_path_json:\n{locals}'))
     domains_to_check = self._domains_to_check(common_name, sans)
     self._validate_domains(organization_id, container_id, domains_to_check,
                            whois_check)
     path = 'order/certificate/ssl_plus'
     json = merge(
         self.cfg.template,
         dict(validity_years=validity_years,
              certificate=dict(common_name=common_name, csr=csr),
              organization=dict(id=organization_id),
              comments=bug))
     if common_name.startswith('*.'):
         path = 'order/certificate/ssl_wildcard'
     elif sans:
         path = 'order/certificate/ssl_multi_domain'
         json = merge(json, dict(certificate=dict(dns_names=sans)))
     if renewal_of_order_id:
         json = merge(json, dict(renewal_of_order_id=renewal_of_order_id))
     return path, json
def load_combined_dicts():
    f_word_to_index, f_index_to_word, \
    f_tri_to_index, f_index_to_tri, \
    f_act_to_index, f_index_to_act, \
    f_slot_to_index, f_index_to_slot = frames_load_dicts()

    m_word_to_index, m_index_to_word, \
    m_tri_to_index, m_index_to_tri, \
    m_act_to_index, m_index_to_act, \
    m_slot_to_index, m_index_to_slot = multiwoz_load_dicts()

    word_to_index, index_to_word = merge(
        f_word_to_index, f_index_to_word,
        m_word_to_index, m_index_to_word)
    tri_to_index, index_to_tri = merge(
        f_tri_to_index, f_index_to_tri,
        m_tri_to_index, m_index_to_tri)
    act_to_index, index_to_act = merge(
        f_act_to_index, f_index_to_act,
        m_act_to_index, m_index_to_act)
    slot_to_index, index_to_slot = merge(
        f_slot_to_index, f_index_to_slot,
        m_slot_to_index, m_index_to_slot)

    return word_to_index, index_to_word, \
           tri_to_index, index_to_tri, \
           act_to_index, index_to_act, \
           slot_to_index, index_to_slot
Beispiel #3
0
 def _order_certificate(self, common_name, csr, sans=None):
     app.logger.info(fmt('_order_certificate:\n{locals}'))
     path = 'order/certificate/ssl_plus'
     json = merge(self.cfg.template,
                  dict(certificate=dict(common_name=common_name, csr=csr)))
     if sans:
         path = 'order/certificate/ssl_multi_domain'
         json = merge(json, dict(certificate=dict(dns_names=sans)))
     app.logger.debug(
         fmt('calling digicert api with path={path} and json={json}'))
     call = self.post(path=path, json=json)
     if call.recv.status == 201:
         return call.recv.json.id, call.recv.json.requests[0].id
     raise OrderCertificateError(call)
Beispiel #4
0
def certify(common_name,
            timestamp,
            expiry,
            order_id,
            csr=None,
            crt=None,
            cert=None):
    if cert == None:
        cert = {}
    cert_name = create_cert_name(common_name, timestamp)
    #    digicert = dict(
    #        order_id=order_id,
    #        expiry=expiry)
    digicert = dict(order_id=order_id)
    if csr:
        digicert['csr'] = csr
    if crt:
        digicert['crt'] = crt
    return merge(
        cert, {
            cert_name:
            dict(common_name=common_name,
                 timestamp=timestamp,
                 expiry=expiry,
                 authority=dict(digicert=digicert))
        })
Beispiel #5
0
async def contribute_json():
    '''
    async contribute.json route
    '''
    json = merge(
        CONTRIBUTE_JSON,
        dict(repository=dict(version=CFG.APP_VERSION,
                             revision=CFG.APP_REVISION)))
    response = await jsonify(**json), 200
    return response
Beispiel #6
0
def add_argument(parser, *sig, **overrides):
    parser.add_argument(
        *sig,
        **merge(ARGS[sig], overrides))