def load_data(self, data): if data.get("replacements"): data["replaces"] = data[ "replacements"] # TODO remove when field is deprecated if data.get("csr"): csr_sans = cert_utils.get_sans_from_csr(data["csr"]) if not data.get("extensions"): data["extensions"] = {"subAltNames": {"names": []}} elif not data["extensions"].get("subAltNames"): data["extensions"]["subAltNames"] = {"names": []} elif not data["extensions"]["subAltNames"].get("names"): data["extensions"]["subAltNames"]["names"] = [] data["extensions"]["subAltNames"]["names"] = csr_sans common_name = cert_utils.get_cn_from_csr(data["csr"]) if common_name: data["common_name"] = common_name key_type = cert_utils.get_key_type_from_csr(data["csr"]) if key_type: data["key_type"] = key_type # This code will be exercised for certificate import (without CSR) if data.get("key_type") is None: if data.get("body"): data["key_type"] = utils.get_key_type_from_certificate( data["body"]) else: data["key_type"] = "RSA2048" # default value return missing.convert_validity_years(data)
def load_data(self, data): if data.get('replacements'): data['replaces'] = data[ 'replacements'] # TODO remove when field is deprecated if data.get('csr'): csr_sans = cert_utils.get_sans_from_csr(data['csr']) if not data.get('extensions'): data['extensions'] = {'subAltNames': {'names': []}} elif not data['extensions'].get('subAltNames'): data['extensions']['subAltNames'] = {'names': []} elif not data['extensions']['subAltNames'].get('names'): data['extensions']['subAltNames']['names'] = [] data['extensions']['subAltNames']['names'] += csr_sans return missing.convert_validity_years(data)
def load_data(self, data): if data.get("replacements"): data["replaces"] = data[ "replacements"] # TODO remove when field is deprecated if data.get("csr"): csr_sans = cert_utils.get_sans_from_csr(data["csr"]) if not data.get("extensions"): data["extensions"] = {"subAltNames": {"names": []}} elif not data["extensions"].get("subAltNames"): data["extensions"]["subAltNames"] = {"names": []} elif not data["extensions"]["subAltNames"].get("names"): data["extensions"]["subAltNames"]["names"] = [] data["extensions"]["subAltNames"]["names"] += csr_sans return missing.convert_validity_years(data)
def load_data(self, data): if data.get('replacements'): data['replaces'] = data['replacements'] # TODO remove when field is deprecated if data.get('csr'): csr_sans = cert_utils.get_sans_from_csr(data['csr']) if not data.get('extensions'): data['extensions'] = { 'subAltNames': { 'names': [] } } elif not data['extensions'].get('subAltNames'): data['extensions']['subAltNames'] = { 'names': [] } elif not data['extensions']['subAltNames'].get('names'): data['extensions']['subAltNames']['names'] = [] data['extensions']['subAltNames']['names'] += csr_sans return missing.convert_validity_years(data)