Unable to execute chef client command "knife". Command environment issue?

Hi guys,
  I've written a lot of custom plugins using knife to start/stop our test clusters.  I've moved these into a build task for our integration testing target on the build server.  Here is the information on the build agent.

OS: Ubuntu 10.10
Java: 1.6.0_26
User: teamcity


When I execute the command below in my build configuration it fails with the log below.

directory: /home/teamcity
command: /usr/bin/knife
args: st test start


Error from agent log

[2012-01-12 08:17:16,767] out -
[2012-01-12 08:17:16,767] out - Process exited with code 100
[2012-01-12 08:26:37,954] out - ----------------------------------------- [ Operations::Start Test2 #3 (buildId = 4280) ] -----------------------------------------
[2012-01-12 08:26:37,980] out - Starting: /usr/bin/knife st test start
[2012-01-12 08:26:37,980] out - in directory: /home/teamcity
[2012-01-12 08:26:37,982] err - /usr/bin/knife st test start
[2012-01-12 08:26:38,522] err - ERROR: Errno::EACCES: Permission denied - /root/.ssh/known_hosts
[2012-01-12 08:26:38,523] out - ERROR: Errno::EACCES: Permission denied - /root/.ssh/known_hosts
[2012-01-12 08:26:38,529] err -
[2012-01-12 08:26:38,529] err -
[2012-01-12 08:26:38,530] out -
[2012-01-12 08:26:38,530] out - Process exited with code 100


Part of this command uses SSH keys to connect to the instances that are started on ec2.  Given that my agent runs as the user "teamcity", I expected the process to inherit the teamcity user's shell environment.  However this isn't the case, it appears to be running as root.  If I run these commands after logging in as root ans switching to the teamcity user, everything works as expected.

su -l teamcity
cd ~
/usr/bin/knife st test start


This succeeds.  I know the command works when in the shell as the teamcity user.  Any ideas why the process does not seem to be running in the teamcity user's environment?

1 comment

Hi Todd

We'll continue troubleshooting in your original thread

0

Please sign in to leave a comment.