[chef] Re: Re: Re: Re: Re: How to test a bash code snippet


Chronological Thread 
  • From: Daniel DeLeo < >
  • To:
  • Subject: [chef] Re: Re: Re: Re: Re: How to test a bash code snippet
  • Date: Mon, 8 Jul 2013 16:51:05 -0700


On Monday, July 8, 2013 at 3:47 PM, Rudi wrote:

Very nice! Thanks man.


On Tue, Jul 9, 2013 at 6:46 AM, John Dewey < " target="_blank"> > wrote:
Right, thats why you want to source the rvm script, before calling rvm.

code <<-EOH.gsub(/^\s+/, '')
  source ~/.rvm/scripts/rvm
  rvm use ruby-1.9.2-p290
  bundle --verbose
EOH

command = <<-EOH.gsub(/^\s+/, '')
  source ~/.rvm/scripts/rvm
  rvm use ruby-1.9.2-p290
  bundle --verbose
EOH

expect(chef_run).to execute_command(command)

On Monday, July 8, 2013 at 3:39 PM, Rudi wrote:

Hey John,

 can probably switch back to execute

The reason I left was I needed to pass in the "--login" flag. Without this it erred not being able to see rvm (non apt package).

The fact that an execute resource runs bin/sh as an intermediate step is an implementation detail (admittedly, one we're unlikely to change), so adding the `--login` flag to the bash resource is better chef code, in my opinion.

I'd encourage you to submit a patch to chefspec to support script/bash resources if you're able.


-- 
Daniel DeLeo




Archive powered by MHonArc 2.6.16.

§