coderanger / kitchen-sync

Test Kitchen transport plugin to speed up tests.
Apache License 2.0
81 stars 24 forks source link

Using hardcoded ruby path that may not exist for SFTP upload #12

Open ghost opened 8 years ago

ghost commented 8 years ago

We are using test-kitchen 1.4.2 to test puppet code so we have no need to install Chef, instead using a custom Ruby install for the verifier:

provisioner:
  name: puppet_apply
  require_chef_for_busser: false

verifier:
  ruby_bindir: '/opt/ruby-2.1/bin'

This means we don't have the ruby coming with chef. Since the SFTP transport is using a hardcoded path to ruby it is failing to get the checksums because that path doesn't exist. Please see: https://github.com/coderanger/kitchen-sync/blob/master/lib/kitchen/transport/sftp.rb#L78

The error message we see is:

Message: Failed to complete #verify action: [757: unexpected token at 'bash: /opt/chef/embedded/bin/ruby: No such file or directory
']

We only see this happen on the verify step. converge seems unaffected (goes through the "fast path" logic each time).

rhass-r7 commented 8 years ago

This is due to the way the checksums on the remote files was implemented:

https://github.com/coderanger/kitchen-sync/blob/master/lib/kitchen-sync/sftp.rb#L27 https://github.com/coderanger/kitchen-sync/blob/master/lib/kitchen-sync/sftp.rb#L47

I am not very familiar with puppet, but I am assuming it ships with an embedded version of ruby -- if so it should be possible to make this use the kitchen config value for ruby_bindir

ytsarev commented 8 years ago

https://github.com/coderanger/kitchen-sync/pull/11