neillturner / kitchen-verifier-serverspec

A Test Kitchen Serverspec Verifer without having to transit the Busser layer
Other
39 stars 19 forks source link

Overwriting Gemfile when setting remote_exec false #7

Closed alexharv074 closed 7 years ago

alexharv074 commented 8 years ago

Given the following .kitchen.yml:


---
driver:
  name: docker

provisioner:
  name: ansible_playbook
  hosts: test-kitchen
  ansible_verbose: false
  ansible_verbosity: 2
  require_ansible_repo: false
  require_ansible_omnibus: true
  require_chef_for_busser: false

verifier:
  name: serverspec
  remote_exec: false
  bundler_path: '/usr/local/bin'
  rspec_path: '/usr/local/bin'
  patterns:
    - test/integration/default/serverspec/default_spec.rb

platforms:
  - name: centos-7.2

suites:
  - name: default

looks like the code here is overwriting my project's Gemfile, which I'd have to assume is a bug.

neillturner commented 8 years ago

i think we need to be doing sudo -H or something to get the correct location for the gems.

neillturner commented 8 years ago

has the -H option i now have as default made any difference?

neillturner commented 8 years ago

you should specify gemfile: Gemfile and then it will not generate.

danielkza commented 7 years ago

I just hit this, and it's really unexpected behavior. Source-controlled files like a Gemfile almost always is should not be overwritten by default.

neillturner commented 7 years ago

fair enough. I guess the cause is the lines: File.open(gemfile, 'w') do |f| f.write("source 'https://rubygems.org'\ngem 'net-ssh','~> 2.9.4'\ngem 'serverspec'") end so i can wrap a unless File.exist?(gemfile) around this so i won't create unless file doesn't exist.

danielkza commented 7 years ago

@neillturner That would work well enough, thank you!