Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

dispatcher returns bad status code with sudo adapter

#502

Inline shows to example command lines. 1st is direct ssh, 2nd is via rundeck dispatch where we execute remotely on the same single node and same user. We get a bad status code via dispatch and stderr where via ssh (using -tt for pseudoterminal) we do not get bad status code. In both invocations the results are the same (minus bad status code)

When I do this via ssh ensuring tty is used it works:

-shell-3.2$ ssh -tt imageuser@pbdevrk1v sudo -u tomcat /var/tmp/rerun.bin  frontend: install-package --installRoot /tmp/1 --url https://snapshotrepo.wsgc.com:443/simple/snapshotrepo/com/wsgc/ecommerce/wsgc-ecommerce-configuration-devint/1.0-SNAPSHOT/wsgc-ecommerce-configuration-devint-1.0-20120110.172730-4-pb-Q1.zip
Verifying archive integrity... All good.
Uncompressing desc..........................................................................
DEBUG:
INSTALLROOT: /tmp/10
URL: https://snapshotrepo.wsgc.com:443/simple/snapshotrepo/com/wsgc/ecommerce/wsgc-ecommerce-configuration-devint/1.0-SNAPSHOT/wsgc-ecommerce-configuration-devint-1.0-20120110.172730-4-pb-Q1.zip
SUDOUSER: tomcat
/tmp/tmp.bfmsFq2669 /tmp/selfgz259629437
/tmp/selfgz259629437
Archive:  /tmp/tmp.bfmsFq2669/package.zip
   creating: apps/
   creating: apps/tomcat/
   creating: apps/tomcat/bin/
   creating: apps/tomcat/apps/
   creating: apps/tomcat/apps/pb/
   creating: apps/tomcat/lib/
   creating: apps/tomcat/conf/
   creating: apps/tomcat/conf/Catalina/
   creating: apps/tomcat/conf/Catalina/localhost/
   creating: etc/
   creating: etc/httpd/
   creating: etc/httpd/conf.d/
   creating: etc/httpd/conf/
  inflating: apps/tomcat/bin/catalina.sh  
  inflating: apps/tomcat/bin/startup.sh  
  inflating: apps/tomcat/bin/setenv.sh  
  inflating: apps/tomcat/apps/pb/app-specification.properties  
  inflating: apps/tomcat/lib/settings-override.properties  
  inflating: apps/tomcat/lib/log4j.properties  
  inflating: apps/tomcat/conf/Catalina/localhost/ROOT.xml  
  inflating: apps/tomcat/conf/logging.properties  
  inflating: apps/tomcat/conf/keystore_public.jks  
  inflating: etc/httpd/conf.d/ssl.conf  
  inflating: etc/httpd/conf/httpd.conf  
  inflating: etc/httpd/conf/workers.properties  
Connection to pbdevrk1v closed.
-shell-3.2$ echo $?
0

Using rundeck dispatcher I get failure after it appears to successfully do the same thing , a socket issue seems to appear

-shell-3.2$ dispatch -L -p wsgc -I tags=pb+devint -- id -nu \; hostname
imageuser
pbdevrk1v
-shell-3.2$ dispatch -L -p wsgc -I tags=pb+devint --  sudo -u tomcat /var/tmp/rerun.bin  frontend: install-package --installRoot /tmp/2 --url https://snapshotrepo.wsgc.com:443/simple/snapshotrepo/com/wsgc/ecommerce/wsgc-ecommerce-configuration-devint/1.0-SNAPSHOT/wsgc-ecommerce-configuration-devint-1.0-20120110.172730-4-pb-Q1.zip
Verifying archive integrity... All good.
Uncompressing desc..........................................................................
DEBUG:
INSTALLROOT: /tmp/2
URL: https://snapshotrepo.wsgc.com:443/simple/snapshotrepo/com/wsgc/ecommerce/wsgc-ecommerce-configuration-devint/1.0-SNAPSHOT/wsgc-ecommerce-configuration-devint-1.0-20120110.172730-4-pb-Q1.zip
SUDOUSER: tomcat
/tmp/tmp.RWXiep2506 /tmp/selfgz24214391
/tmp/selfgz24214391
Archive:  /tmp/tmp.RWXiep2506/package.zip
   creating: apps/
   creating: apps/tomcat/
   creating: apps/tomcat/bin/
   creating: apps/tomcat/apps/
   creating: apps/tomcat/apps/pb/
   creating: apps/tomcat/lib/
   creating: apps/tomcat/conf/
   creating: apps/tomcat/conf/Catalina/
   creating: apps/tomcat/conf/Catalina/localhost/
   creating: etc/
   creating: etc/httpd/
   creating: etc/httpd/conf.d/
   creating: etc/httpd/conf/
  inflating: apps/tomcat/bin/catalina.sh  
  inflating: apps/tomcat/bin/startup.sh  
  inflating: apps/tomcat/bin/setenv.sh  
error: Remote command failed with exit status -1
error: DispatcherResult{status=false, results={pbdevrk1v=[jsch-ssh] result was failure, resultcode: -1: Remote command failed with exit status -1}}
error: DispatcherResult{status=false, results={pbdevrk1v=[jsch-ssh] result was failure, resultcode: -1: Remote command failed with exit status -1}}

When -v for verbosity is used,

heres some stack strace info:

...
...
  inflating: apps/tomcat/apps/pb/app-specification.properties  Disconnecting from pbdevrk1v port 22
Caught an exception, leaving main loop due to Socket closed
error: Remote command failed with exit status -1
error: DispatcherResult{status=false, results={pbdevrk1v=[jsch-ssh] result was failure, resultcode: -1: Remote command failed with exit status -1}}
DispatcherResult{status=false, results={pbdevrk1v=[jsch-ssh] result was failure, resultcode: -1: Remote command failed with exit status -1}}
        at com.dtolabs.rundeck.core.cli.ExecTool.runAction(ExecTool.java:619)
        at com.dtolabs.rundeck.core.cli.ExecTool.run(ExecTool.java:414)
        at com.dtolabs.rundeck.core.cli.ExecTool.main(ExecTool.java:722)
error: DispatcherResult{status=false, results={pbdevrk1v=[jsch-ssh] result was failure, resultcode: -1: Remote command failed with exit status -1}}

Reported by Charles Scott · January 11th, 2012 @ 09:44 AM

State: new
Milestone: none
Assigned to: nobody

Activity

  1. Greg Schueler
    Greg Schueler
    • Milestone set to Rundeck 1.4.2
    • Tag set to sudo responder, bug
    • Assigned user set to Greg Schueler
    • Milestone order changed from 120 to 0

    I was able to reproduce this.

    the bug is that the responder thread finishes while the stream is still being written to, it needs to continue reading the output otherwise the connection is closed prematurely.

    January 11th, 2012 @ 05:16 PM

  2. Greg Schueler
    Greg Schueler

    (from [7b443e8224df355d8b44db35bb2bce4f33bfe915]) Fix premature disconnect due to outputstream error

    Add LeadPipeOutputStream to not fail after reader thread
    ends, and use it for responder

    [#502 dispatcher returns bad status code with sudo adapter] https://github.com/dtolabs/rundeck/commit/7b443e8224df355d8b44db35b...

    January 12th, 2012 @ 11:38 AM

  3. Greg Schueler
    Greg Schueler
    • State changed from new to needs_verification

    January 12th, 2012 @ 11:43 AM

  4. Greg Schueler
    Greg Schueler
    • State changed from needs_verification to resolved

    February 10th, 2012 @ 09:26 AM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.