e3c68b
From 562283ad34021bbf4fc540127ee7072d5152d34d Mon Sep 17 00:00:00 2001
e3c68b
From: Yuval Turgeman <yturgema@redhat.com>
e3c68b
Date: Wed, 24 Jul 2019 16:42:22 +0300
e3c68b
Subject: [PATCH 336/336] spec: check and return exit code in rpm scripts
e3c68b
e3c68b
lua's error() call expects a value as its second argument, and this is
e3c68b
taken from the `val` variable, while the `ok` is boolean.  This causes
e3c68b
the rpm scripts to fail on:
e3c68b
e3c68b
bad argument #2 to 'error' (number expected, got boolean)
e3c68b
e3c68b
Label: DOWNSTREAM ONLY
e3c68b
BUG: 1768786
e3c68b
Change-Id: I9c6b1f62ebf15dbc93196d018bc1fd628b36fc33
e3c68b
>Signed-off-by: Yuval Turgeman <yturgema@redhat.com>
e3c68b
Reviewed-on: https://code.engineering.redhat.com/gerrit/186405
e3c68b
Reviewed-by: Mohit Agrawal <moagrawa@redhat.com>
e3c68b
Tested-by: RHGS Build Bot <nigelb@redhat.com>
e3c68b
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
e3c68b
---
e3c68b
 glusterfs.spec.in | 55 +++++++++++++++++++++++++++++++++----------------------
e3c68b
 1 file changed, 33 insertions(+), 22 deletions(-)
e3c68b
e3c68b
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
e3c68b
index 91180db..1b975b2 100644
e3c68b
--- a/glusterfs.spec.in
e3c68b
+++ b/glusterfs.spec.in
e3c68b
@@ -1572,8 +1572,9 @@ fi
e3c68b
 ]]
e3c68b
 
e3c68b
 ok, how, val = os.execute(script)
e3c68b
-if not (ok == 0) then
e3c68b
-   error("Detected running glusterfs processes", ok)
e3c68b
+rc = val or ok
e3c68b
+if not (rc == 0) then
e3c68b
+   error("Detected running glusterfs processes", rc)
e3c68b
 end
e3c68b
 
e3c68b
 
e3c68b
@@ -1606,8 +1607,9 @@ fi
e3c68b
 ]]
e3c68b
 
e3c68b
 ok, how, val = os.execute(script)
e3c68b
-if not (ok == 0) then
e3c68b
-   error("Detected running glusterfs processes", ok)
e3c68b
+rc = val or ok
e3c68b
+if not (rc == 0) then
e3c68b
+   error("Detected running glusterfs processes", rc)
e3c68b
 end
e3c68b
 
e3c68b
 
e3c68b
@@ -1640,8 +1642,9 @@ fi
e3c68b
 ]]
e3c68b
 
e3c68b
 ok, how, val = os.execute(script)
e3c68b
-if not (ok == 0) then
e3c68b
-   error("Detected running glusterfs processes", ok)
e3c68b
+rc = val or ok
e3c68b
+if not (rc == 0) then
e3c68b
+   error("Detected running glusterfs processes", rc)
e3c68b
 end
e3c68b
 
e3c68b
 
e3c68b
@@ -1674,8 +1677,9 @@ fi
e3c68b
 ]]
e3c68b
 
e3c68b
 ok, how, val = os.execute(script)
e3c68b
-if not (ok == 0) then
e3c68b
-   error("Detected running glusterfs processes", ok)
e3c68b
+rc = val or ok
e3c68b
+if not (rc == 0) then
e3c68b
+   error("Detected running glusterfs processes", rc)
e3c68b
 end
e3c68b
 
e3c68b
 
e3c68b
@@ -1707,8 +1711,9 @@ fi
e3c68b
 ]]
e3c68b
 
e3c68b
 ok, how, val = os.execute(script)
e3c68b
-if not (ok == 0) then
e3c68b
-   error("Detected running glusterfs processes", ok)
e3c68b
+rc = val or ok
e3c68b
+if not (rc == 0) then
e3c68b
+   error("Detected running glusterfs processes", rc)
e3c68b
 end
e3c68b
 
e3c68b
 
e3c68b
@@ -1740,8 +1745,9 @@ fi
e3c68b
 ]]
e3c68b
 
e3c68b
 ok, how, val = os.execute(script)
e3c68b
-if not (ok == 0) then
e3c68b
-   error("Detected running glusterfs processes", ok)
e3c68b
+rc = val or ok
e3c68b
+if not (rc == 0) then
e3c68b
+   error("Detected running glusterfs processes", rc)
e3c68b
 end
e3c68b
 
e3c68b
 
e3c68b
@@ -1775,8 +1781,9 @@ fi
e3c68b
 ]]
e3c68b
 
e3c68b
 ok, how, val = os.execute(script)
e3c68b
-if not (ok == 0) then
e3c68b
-   error("Detected running glusterfs processes", ok)
e3c68b
+rc = val or ok
e3c68b
+if not (rc == 0) then
e3c68b
+   error("Detected running glusterfs processes", rc)
e3c68b
 end
e3c68b
 %endif
e3c68b
 
e3c68b
@@ -1810,8 +1817,9 @@ fi
e3c68b
 ]]
e3c68b
 
e3c68b
 ok, how, val = os.execute(script)
e3c68b
-if not (ok == 0) then
e3c68b
-   error("Detected running glusterfs processes", ok)
e3c68b
+rc = val or ok
e3c68b
+if not (rc == 0) then
e3c68b
+   error("Detected running glusterfs processes", rc)
e3c68b
 end
e3c68b
 
e3c68b
 
e3c68b
@@ -1845,8 +1853,9 @@ fi
e3c68b
 ]]
e3c68b
 
e3c68b
 ok, how, val = os.execute(script)
e3c68b
-if not (ok == 0) then
e3c68b
-   error("Detected running glusterfs processes", ok)
e3c68b
+rc = val or ok
e3c68b
+if not (rc == 0) then
e3c68b
+   error("Detected running glusterfs processes", rc)
e3c68b
 end
e3c68b
 %endif
e3c68b
 
e3c68b
@@ -1881,8 +1890,9 @@ fi
e3c68b
 ]]
e3c68b
 
e3c68b
 ok, how, val = os.execute(script)
e3c68b
-if not (ok == 0) then
e3c68b
-   error("Detected running glusterfs processes", ok)
e3c68b
+rc = val or ok
e3c68b
+if not (rc == 0) then
e3c68b
+   error("Detected running glusterfs processes", rc)
e3c68b
 end
e3c68b
 %endif
e3c68b
 
e3c68b
@@ -1916,8 +1926,9 @@ fi
e3c68b
 ]]
e3c68b
 
e3c68b
 ok, how, val = os.execute(script)
e3c68b
-if not (ok == 0) then
e3c68b
-   error("Detected running glusterfs processes", ok)
e3c68b
+rc = val or ok
e3c68b
+if not (rc == 0) then
e3c68b
+   error("Detected running glusterfs processes", rc)
e3c68b
 end
e3c68b
 
e3c68b
 %posttrans server
e3c68b
-- 
e3c68b
1.8.3.1
e3c68b