CDist completely broken - __explorer=/var/lib/cdist/conf/explorer: Command not found. #171
Labels
No labels
bugfix
cleanup
discussion
documentation
doing
done
feature
improvement
packaging
Stale
testing
TODO
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ungleich-public/cdist#171
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Created by: zilti
I always get that error when running
bin/cdist config servername. Why is it even trying to get anything in /var/lib? The documentation says that no local install is necessary. Symlinking the cdist directory doesn't solve anything as well,/var/lib/cdist/conf/exploreris a directory anyway. So, not even the most basic task is possible. Sometimes, the error is alternatively__target_host=somehostname: Command not found.Created by: zilti
I'll just change the default root shell on my machines. I was somewhat surprised that it wasn't
sh, since it's the default user shell.Created by: asteven
Daniel Ziltener wrote on 03/16/16 13:27:
Hi Daniel
Really sorry you're having problems :-(
Unfortunately I don't use/have FreeBSD, so can't be of much help here.
Cheers,
Steven
Created by: telmich
I think you are right, we should use /bin/sh instead of defaulting to the user shell, because in some (rare, knowadays ;-)
@asteven fine with you?
Created by: darko-poljak
@zilti This is because ssh invokes commands using user's shell.
The command
ERROR: 192.168.1.2: Command failed: ssh -o User=root -q 192.168.1.2 __target_host=192.168.1.2 __explorer=/var/lib/cdist/conf/explorer /bin/sh -e /var/lib/cdist/conf/explorer/os/is equivalent to the
ssh -o User=root -q 192.168.1.2 a=b /bin/sh -e /path/to/script.This means that the command to execute at remote is
a=b /bin/sh -e /path/to/scriptand this whole script is executed using user's shell. Fortcsha=b isn't an assignment, it tries to execute it as a command. And this results in an error.@telmich cdist assumes posix/bourne/bourne again shell at the remote, right?
Perhaps the generated command should be something like this?
ssh -o User=root -q 192.168.1.2 /bin/sh -c '__target_host=192.168.1.2 __explorer=/var/lib/cdist/conf/explorer /bin/sh -e /var/lib/cdist/conf/explorer/os'.Or
ssh -o User=root -q 192.168.1.2 /bin/sh -c '__target_host=192.168.1.2 __explorer=/var/lib/cdist/conf/explorer; export __target_host __explorer; . /var/lib/cdist/conf/explorer/os'which will not execute one more shell subprocess.In this way whole command passed to ssh would be executed using /bin/sh. All the user's shell would execute is /bin/sh. This way cdist will not fail for non posix/bourne shells.
Look at this short test:
**$ cat test.sh
echo $a
$ tcsh
darko@icosahedron:
/Desktop/test % a=b c=d /bin/sh -e test.sh/Desktop/test % exita=b: Command not found.
darko@icosahedron:
$ echo $SHELL
/bin/sh
$ a=b c=d /bin/sh -e test.sh
b
$ tcsh
darko@icosahedron:
/Desktop/test % a=b c=d /bin/sh -e test.sh/Desktop/test % tcsh -c 'a=b c=d /bin/sh -e test.sh'darko@icosahedron:
a=b: Command not found.
darko@icosahedron:
/Desktop/test % /bin/sh -c 'a=b c=d /bin/sh -e test.sh'/Desktop/test % exitb
darko@icosahedron:
darko@icosahedron:~/Desktop/test % exit
Created by: zilti
A-ha, I found the solution. FreeBSD uses
tcsh, a modifiedcsh, as default shell for root. But this doesn't work. After changing the root's default shell usingchshto/bin/sh, it now works the way it is intended to.Looking at the failed command it seems cdist also noticed the wrong shell, but placed
/bin/shat the wrong spot?Created by: zilti
Ok I found out something new. I think the problem is that the target server is running FreeBSD. Are there any known incompatibilities? Because I now tried it with localhost (which is a linux machine), and that works.
Created by: zilti
Ah, so here's the other. Taken on
tags/3.1.13:Created by: zilti
Ah, I see. I've pasted it below. Weirdly enough, this seems to happen in any version, so now I really think it's something I did wrong, but I have no clue what, since I followed the manpages exactly. Though this here is from
master. I'll also try to again trigger the other of the two errors.Created by: telmich
Can you run cdist -d servername and output the error in here so we can see what exactly triggered this (very unusual) error? Btw, /var/lib is being used on the target host, not locally.