From b3693651020548dc322b189a9f3512732f080f48 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20Sachse?= <joerg.sachse@slub-dresden.de>
Date: Thu, 2 Mar 2023 15:32:20 +0100
Subject: [PATCH] fix: specify failure modes when editing Oracle DB user

---
 tasks/oracle/create_db_users.yml | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tasks/oracle/create_db_users.yml b/tasks/oracle/create_db_users.yml
index 8655c90..71879e5 100644
--- a/tasks/oracle/create_db_users.yml
+++ b/tasks/oracle/create_db_users.yml
@@ -15,6 +15,12 @@
     password_lock: true
     shell: "/bin/tcsh"
     state: present
+  register: db_user
+  failed_when:
+    - "db_user.rc != 0"
+    # Ignore this error, because usually, the Oracle DB user has running pro-
+    # cesses and cannot be changed while the DB is running.
+    - "'is currently used by process' not in db_user.msg"
 
 # The DB user doesn't actually use this dir, but it's nice for admins to put
 # stuff there.
-- 
GitLab