ceph update - unset cluster flags in case of error

Related-Prod: PROD-35063
Change-Id: I0de4c578d0be51ad9775aa6b8650d1f046c776b0
diff --git a/update-ceph.groovy b/update-ceph.groovy
index accd8f8..41eceb6 100644
--- a/update-ceph.groovy
+++ b/update-ceph.groovy
@@ -88,6 +88,13 @@
 
         } catch (Throwable e) {
             // If there was an error or exception thrown, the build failed
+            if (flags.size() > 0) {
+                stage('Unset cluster flags') {
+                    for (flag in flags) {
+                        salt.cmdRun(pepperEnv, "I@ceph:mon and I@ceph:common:keyring:admin", 'ceph osd unset ' + flag)
+                    }
+                }
+            }
             currentBuild.result = "FAILURE"
             currentBuild.description = currentBuild.description ? e.message + " " + currentBuild.description : e.message
             throw e