From 3a06e32e2724bcc349bbbfa93c08c23a7c732ad4 Mon Sep 17 00:00:00 2001 From: Elizabeth Alexander Hunt Date: Sat, 10 May 2025 17:31:06 -0700 Subject: Flesh out ansible playbook job. --- utils/secret.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'utils') diff --git a/utils/secret.ts b/utils/secret.ts index 9847aa6..8860998 100644 --- a/utils/secret.ts +++ b/utils/secret.ts @@ -15,7 +15,7 @@ export class BitwardenSession { public async getItem( secretName: string, - ): Promise { + ): Promise { return await this.sessionInitializer.then((session) => getStdout(`bw list items`, { env: { @@ -24,7 +24,10 @@ export class BitwardenSession { }) ).then((items) => JSON.parse(items)).then((items) => items.find(({ name }: { name: string }) => name === secretName) - ); + ).then((item) => { + if (!item) throw new Error("Could not find bitwarden item " + secretName); + return item; + }); } async close(): Promise { -- cgit v1.2.3-70-g09d2