Fix for when requiretty is disabled with a ! 33/41433/1
authoragardner <agardner@linuxfoundation.org>
Fri, 8 Sep 2017 20:22:08 +0000 (16:22 -0400)
committeragardner <agardner@linuxfoundation.org>
Fri, 8 Sep 2017 20:22:08 +0000 (16:22 -0400)
you can disable requiretty by !requiretty or #requiretty
so catch both of those cases

Change-Id: Ic7fb1cf97849258b1e4db34be82794918bf722e0
Signed-off-by: agardner <agardner@linuxfoundation.org>
utils/jenkins-jnlp-connect.sh

index c46ca89..13cb025 100755 (executable)
@@ -52,7 +52,7 @@ main () {
     fi
 
     if [[ $(whoami) != "root" ]]; then
-      if sudo -l | grep "requiretty"; then
+      if sudo -l | grep "requiretty  | grep -v "\!requiretty"; then
         echo "please comment out Defaults requiretty from /etc/sudoers"
         exit 1
       fi