Does StackStorm works on KSH shell

(Deepchandna) #1
[user@server1 ~]$ st2 run core.remote cmd=whoami hosts=solaris.xyz.deep.com
.
id: 5c5483933648f824856bf69a
status: failed
parameters:
  cmd: whoami
  hosts: solaris.xyz.deep.com
result:
  solaris.xyz.deep.com:
    failed: true
    return_code: 127
    stderr: 'ksh: whoami:  not found'
    stdout: ''
    succeeded: false
	
[user@server1 ~]$ st2 run core.remote cmd=whoami hosts=linux.xyz.deep.com
.
id: 5c5483e13648f824856bf69d
status: succeeded
parameters:
  cmd: whoami
  hosts: linux.xyz.deep.com
result:
  linux.xyz.deep.com:
    failed: false
    return_code: 0
    stderr: ''
    stdout: x1234
    succeeded: true

Please suggest the solution

(Lindsay Hill) #2
(Tomaz Muraus) #3

As per the Github issue (to sum it up here), at the moment StackStorm only supports bash.

(Deepchandna) #4

thanks. I implemented a solution.

(Deepchandna) #5

One of my server return shell - “sh” and other one “bash” . The one returning “sh” is not able to create file in “/tmp” directory. As StackStorm works on bash so how can i change shell in StackStorm. Please suggest.

[admin@deep1 var]$ st2 run core.local cmd='echo $SHELL'
.
id: 5c74875518daf31facc9ea72
status: succeeded
parameters:
  cmd: echo $SHELL
result:
  failed: false
  return_code: 0
  stderr: ''
  stdout: /bin/sh
  succeeded: true

[admin@deep2 var]$ st2 run core.local cmd='echo $SHELL'
.
id: 5c74875cb152977e9f87ccc5
status: succeeded
parameters:
  cmd: echo $SHELL
result:
  failed: false
  return_code: 0
  stderr: ''
  stdout: /bin/bash
  succeeded: true

  
[admin@deep1 var]$ st2 run core.local cmd='echo "success" > /tmp/hello.txt'
id: 5c74880d18daf31facc9ea75
status: failed
parameters:
  cmd: echo "success" > /tmp/hello.txt
result:
  failed: true
  return_code: 1
  stderr: 'bash: /tmp/hello.txt: No such file or directory'
  stdout: ''
  succeeded: false
(Lindsay Hill) #6

Change that user’s shell using chsh, or edit /etc/passwd. You can’t do this from StackStorm. You need to change that user account on the remote server.

(Lindsay Hill) #7

Actually…your issue is probably privateTmp. Don’t use /tmp. Read more about systemd + privateTmp to understand why /tmp doesn’t work the way you think it does.

(Deepchandna) #8

I manually checked in /etc/passwd file. shell on Both the servers is “/bin/ksh” but stackstorm return “sh” on one and “bash” on another .

(Lindsay Hill) #9

Stop trying to use ksh. Use bash. Ask your local sysadmins to change config if needed.

(Deepchandna) #10

Sure, but is there any way i can investigate why stackstorm is returning different - “sh” on one and “bash” on another. and the one with bash is working fine.