MCPcopy
hub / github.com/saltstack/salt / export_gpg_key

Function export_gpg_key

tools/utils/__init__.py:205–215  ·  view source on GitHub ↗
(ctx: Context, key_id: str, export_path: pathlib.Path)

Source from the content-addressed store, hash-verified

203
204
205def export_gpg_key(ctx: Context, key_id: str, export_path: pathlib.Path):
206 keyfile_gpg = export_path.joinpath(GPG_KEY_FILENAME).with_suffix(".gpg")
207 if keyfile_gpg.exists():
208 keyfile_gpg.unlink()
209 ctx.info(f"Exporting GnuPG Key '{key_id}' to {keyfile_gpg} ...")
210 ctx.run("gpg", "--output", str(keyfile_gpg), "--export", key_id)
211 keyfile_pub = export_path.joinpath(GPG_KEY_FILENAME).with_suffix(".pub")
212 if keyfile_pub.exists():
213 keyfile_pub.unlink()
214 ctx.info(f"Exporting GnuPG Key '{key_id}' to {keyfile_pub} ...")
215 ctx.run("gpg", "--armor", "--output", str(keyfile_pub), "--export", key_id)
216
217
218def gpg_sign(ctx: Context, key_id: str, path: pathlib.Path):

Callers

nothing calls this directly

Calls 5

unlinkMethod · 0.80
joinpathMethod · 0.45
existsMethod · 0.45
infoMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected