chef-boneyard / delivery-sugar

DEPRECATED: Library cookbook that adds sugar to build cookbooks for Chef Delivery
Apache License 2.0
12 stars 26 forks source link

Add ability to pass arbitrary environment variables via `envionment` attribute in delivery_test_kitchen block #39

Closed qubitrenegade closed 6 years ago

qubitrenegade commented 6 years ago

Hello,

This PR is in reference to #38 .

Basically, this is the monkey-patch that I'm using to enable to me to pass Environment variables to test kitchen runs/our .kitchen.yml . The framework was already there, and everywhere it seems like it was assumed that env vars might be passed in, but the facilities to actually pass env vars was not there.

This PR enables the ability to pass environment settings a la:

env_vars = {
  'TK_EC2_REGION' => 'us-west-1'
  'foo' => 'bar',
  'CODE' => '0451',
  ...
}

  delivery_test_kitchen "kitchen_run" do
    environment env_vars
  end

If I'm being totally honest, this PR exists mostly because it reduces the monkey patching I have to do... but also if I'm trying to pass env vars, who else has a similar use case?

Thanks,

irvingpop commented 6 years ago

This seems quite sane and useful to me. One nit: kitchen-ec2 already has an established environment variable for setting the region, so let's use that in examples rather than inventing new ones 😄

https://github.com/test-kitchen/kitchen-ec2/blob/master/lib/kitchen/driver/ec2.rb#L56

qubitrenegade commented 6 years ago

HAHA... omg... you're totally right... I mean, I don't care about AWS... I was just trying to make the PR relevant to AWS folk in an effort to make it more appealing... two sec...