mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-25 21:44:00 -07:00
[PR #9580/25a262bd backport][stable-10] Create onepassword_ssh_key plugin (#9632)
Create `onepassword_ssh_key` plugin (#9580) * add 1password_ssh_key lookup * refactor * Delete onepassword_ssh_key.py * Revert "Delete onepassword_ssh_key.py" This reverts commite17ff7e232. * Delete onepassword_ssh_key.py * add tests * add test license * cleanup * refactor * Apply suggestions from code review Co-authored-by: Felix Fontein <felix@fontein.de> * fix indentation * fix RETURN indentation * use get_option to get ssh_format * linting * update project year in copyright * add plugin to BOTMETA.yml * use OnePassCLIv2's get_raw and use OnePass's token --------- Co-authored-by: Felix Fontein <felix@fontein.de> (cherry picked from commit25a262bdcf) Co-authored-by: Mohammed Babelly <mohammed@nevercode.io>
This commit is contained in:
parent
8e2fa624e0
commit
04b68c296b
6 changed files with 252 additions and 0 deletions
|
|
@ -293,3 +293,39 @@ MOCK_ENTRIES = {
|
|||
},
|
||||
],
|
||||
}
|
||||
|
||||
SSH_KEY_MOCK_ENTRIES = [
|
||||
# loads private key in PKCS#8 format by default
|
||||
{
|
||||
"vault_name": "Personal",
|
||||
"queries": ["ssh key"],
|
||||
"expected": [
|
||||
"-----BEGIN PRIVATE KEY-----\n..........=\n-----END PRIVATE KEY-----\n"
|
||||
],
|
||||
"output": load_file("ssh_key_output.json"),
|
||||
},
|
||||
# loads private key in PKCS#8 format becasue ssh_format=false
|
||||
{
|
||||
"vault_name": "Personal",
|
||||
"queries": ["ssh key"],
|
||||
"kwargs": {
|
||||
"ssh_format": False,
|
||||
},
|
||||
"expected": [
|
||||
"-----BEGIN PRIVATE KEY-----\n..........=\n-----END PRIVATE KEY-----\n"
|
||||
],
|
||||
"output": load_file("ssh_key_output.json"),
|
||||
},
|
||||
# loads private key in ssh format
|
||||
{
|
||||
"vault_name": "Personal",
|
||||
"queries": ["ssh key"],
|
||||
"kwargs": {
|
||||
"ssh_format": True,
|
||||
},
|
||||
"expected": [
|
||||
"-----BEGIN OPENSSH PRIVATE KEY-----\r\n.....\r\n-----END OPENSSH PRIVATE KEY-----\r\n"
|
||||
],
|
||||
"output": load_file("ssh_key_output.json"),
|
||||
},
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue