Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verifier dir cleaned after busser install #16

Closed
joerg opened this issue Jun 22, 2015 · 4 comments
Closed

Verifier dir cleaned after busser install #16

joerg opened this issue Jun 22, 2015 · 4 comments

Comments

@joerg
Copy link

joerg commented Jun 22, 2015

It seems that /tmp/verifier is cleaned after busser is installed which of course leads to an error. Here my logs:

% kitchen verify centos-7 -l debug                                       :(
-----> Starting Kitchen (v1.4.0)
D      Berksfile found at /Users/joerg/Documents/Projects/ChefByteSource/bs-auth/Berksfile, loading Berkshelf
D      Berkshelf 3.2.4 library loaded
D      Berksfile found at /Users/joerg/Documents/Projects/ChefByteSource/bs-auth/Berksfile, loading Berkshelf
D      Berkshelf 3.2.4 previously loaded
-----> Verifying <default-centos-7>...
       Preparing files for transfer
D      Creating local sandbox in /var/folders/pd/d2kngqn52nq9wpy1y7nst5nr0000gn/T/default-centos-7-sandbox-20150622-64905-7m10vt
D      [local command] BEGIN (docker exec -t 9b7794df4b36a70ea89ac78d23a8eb0fe25150311cc37376c5e0b949abbe47d4 sh -c '

BUSSER_ROOT="/tmp/verifier"; export BUSSER_ROOT
GEM_HOME="/tmp/verifier/gems"; export GEM_HOME
GEM_PATH="/tmp/verifier/gems"; export GEM_PATH
GEM_CACHE="/tmp/verifier/gems/cache"; export GEM_CACHE
ruby="/opt/chef/embedded/bin/ruby"
gem="/opt/chef/embedded/bin/gem"
version="busser"
gem_install_args="busser --no-rdoc --no-ri"
busser="sudo -E /tmp/verifier/bin/busser"
plugins="busser-serverspec"

$gem list busser -i 2>&1 >/dev/null
if test $? -ne 0; then
  echo "-----> Installing Busser ($version)"
  $gem install $gem_install_args
else
  echo "-----> Busser installation detected ($version)"
fi

if test ! -f "$BUSSER_ROOT/bin/busser"; then
  gem_bindir=`$ruby -rrubygems -e "puts Gem.bindir"`
  $gem_bindir/busser setup
fi

echo "       Installing Busser plugins: $plugins"
$busser plugin install $plugins
')
-----> Installing Busser (busser)
Fetching: thor-0.19.0.gem (100%)
       Successfully installed thor-0.19.0
Fetching: busser-0.7.1.gem (100%)
       Successfully installed busser-0.7.1
       2 gems installed
-----> Setting up Busser
       Creating BUSSER_ROOT in /tmp/verifier

       Installing Busser plugins: busser-serverspec
       Plugin serverspec installed (version 0.5.7)
-----> Running postinstall for serverspec plugin
D      [local command] END (0m12.75s)
D      [local command] BEGIN (docker exec -t 9b7794df4b36a70ea89ac78d23a8eb0fe25150311cc37376c5e0b949abbe47d4 sh -c '

BUSSER_ROOT="/tmp/verifier"; export BUSSER_ROOT
GEM_HOME="/tmp/verifier/gems"; export GEM_HOME
GEM_PATH="/tmp/verifier/gems"; export GEM_PATH
GEM_CACHE="/tmp/verifier/gems/cache"; export GEM_CACHE

sudo -E /tmp/verifier/bin/busser suite cleanup
')
       Removing /tmp/verifier/suites/serverspec
D      [local command] END (0m0.46s)
       Transferring files to <default-centos-7>
D      [local command] BEGIN (docker exec -t 9b7794df4b36a70ea89ac78d23a8eb0fe25150311cc37376c5e0b949abbe47d4 sh -c '
mkdir -p /tmp/verifier && rm -rf /tmp/verifier/*
')
D      [local command] END (0m0.28s)
D      [local command] BEGIN (cd /var/folders/pd/d2kngqn52nq9wpy1y7nst5nr0000gn/T/default-centos-7-sandbox-20150622-64905-7m10vt && tar cf - ./suites | docker ex
ec -i 9b7794df4b36a70ea89ac78d23a8eb0fe25150311cc37376c5e0b949abbe47d4 sh -c '
tar x -C /tmp/verifier
')
D      [local command] END (0m0.29s)
D      Transfer complete
D      [local command] BEGIN (docker exec -t 9b7794df4b36a70ea89ac78d23a8eb0fe25150311cc37376c5e0b949abbe47d4 sh -c '

BUSSER_ROOT="/tmp/verifier"; export BUSSER_ROOT
GEM_HOME="/tmp/verifier/gems"; export GEM_HOME
GEM_PATH="/tmp/verifier/gems"; export GEM_PATH
GEM_CACHE="/tmp/verifier/gems/cache"; export GEM_CACHE

sudo -E /tmp/verifier/bin/busser test
')
       sudo: /tmp/verifier/bin/busser: command not found
D      [local command] END (0m0.26s)
D      Cleaning up local sandbox in /var/folders/pd/d2kngqn52nq9wpy1y7nst5nr0000gn/T/default-centos-7-sandbox-20150622-64905-7m10vt
<exception output omitted>

This happens using the latest 0.11.1 release. Using 0.9.1 everything works fine.
I think thats actually more or less a bug in the older versions where this line got executed

D      [local command] BEGIN (docker exec -t 9b7794df4b36a70ea89ac78d23a8eb0fe25150311cc37376c5e0b949abbe47d4 mkdir -p /tmp/verifier && rm -rf /tmp/verifier/*)

Compared to the above an "sh -c" is missing which I think makes this command execute incorrectly and thus does not delete all the gems and binstubs installed in /tmp/verifier. ;)
If I am corrent then "Hail to the old and buggy version which works."

@marcy-terui
Copy link
Owner

Thanks for your reporting.

To begin with, we should not execute rm -rf /tmp/verifier 😰

I fixed this and released in v0.11.2
Please check the version.

@joerg
Copy link
Author

joerg commented Jun 23, 2015

Thanks, it works now. But I am not sure if removing the rm at all is a good idea. That way and old test files will remain if they are renamed/moved in the cookbook. And since busser will just execute every .rb it finds that may will lead to nasty errors that are a pain to debug.
I don't know how they solve this with vagrant or so, but my guess is that the just "rm -rf /tmp/verififies/suites". Whats your though about this?

@marcy-terui
Copy link
Owner

@joerg I think so too.
So, rm -rf had been placed.

But, the other trasport methods are not happening any problems.
And they haven't delete /tmp/verifier
https://github.com/test-kitchen/test-kitchen/blob/master/lib/kitchen/transport/ssh.rb#L127-L137

Therefore, I decided to remove the rm at all.

@joerg
Copy link
Author

joerg commented Jun 24, 2015

Well I guess, if anyone ever had any problems they just destroy and converge and marked the incident as "stange but not worth investing". I am happy with the bug fixed, thanks.

@joerg joerg closed this as completed Jun 24, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants