MCPcopy Create free account
hub / github.com/apache/httpd / save

Method save

test/modules/md/md_certs.py:178–197  ·  view source on GitHub ↗
(self, creds: Credentials, name: str = None,
             chain: List[Credentials] = None,
             single_file: bool = False)

Source from the content-addressed store, hash-verified

176 return self._store_dir
177
178 def save(self, creds: Credentials, name: str = None,
179 chain: List[Credentials] = None,
180 single_file: bool = False) -> None:
181 name = name if name is not None else creds.name
182 cert_file = self.get_cert_file(name=name, key_type=creds.key_type)
183 pkey_file = self.get_pkey_file(name=name, key_type=creds.key_type)
184 if single_file:
185 pkey_file = None
186 with open(cert_file, "wb") as fd:
187 fd.write(creds.cert_pem)
188 if chain:
189 for c in chain:
190 fd.write(c.cert_pem)
191 if pkey_file is None:
192 fd.write(creds.pkey_pem)
193 if pkey_file is not None:
194 with open(pkey_file, "wb") as fd:
195 fd.write(creds.pkey_pem)
196 creds.set_files(cert_file, pkey_file)
197 self._add_credentials(name, creds)
198
199 def _add_credentials(self, name: str, creds: Credentials):
200 if name not in self._creds_by_name:

Callers 2

create_rootMethod · 0.95
issue_certMethod · 0.45

Calls 4

get_cert_fileMethod · 0.95
get_pkey_fileMethod · 0.95
_add_credentialsMethod · 0.95
set_filesMethod · 0.45

Tested by

no test coverage detected