Tuesday, May 10, 2016

Touchy DNS in Kitchen/Vagrant VM's?

TL; DR

Add to your drive section in .kitchen.yml

1
2
  customize:
    natdnshostresolver1: "on"

Symptom

I often work remotely. It's a beautiful thing; however, "Thar be dragons!" Does your cookbook need private DNS? Resources behind the firewall? Well, let's connect to VPN. WooHoo... Wait... The chef-client install failed. It can't get to the internet? WHAT? 

Solution

My VPN client has split tunneling DNS and split tunnel networking. So... How do you working around it? Tell kitchen to tell vagrant to use your host workstation as the DNS server.





Git Pull request Kung Fu

TL;DR

Merging via command line

If you do not want to use the merge button or an automatic merge cannot be performed, you can perform a manual merge on the command line.
Step 1: From your project repository, bring in the changes and test.
git fetch origin
git checkout -b tscalf-unit_tests origin/tscalf-unit_tests
git merge master
Step 2: Merge the changes and update.
git checkout master
git merge --no-ff tscalf-unit_tests
git push origin master

Monday, May 9, 2016

CoffeeScript Substrings

TL;DR


1
2
3
4
5
run_list = [ 'role[flexo]','role[bender]','role[roberto]']

run_list.forEach (result) ->
  role = result.match /\[(\S*)\]/i
  alert(role[1]) # Should yield a message box with "flexo" then "bender" then "roberto"

What I was looking for:

Given a Chef run_list, I needed the name of each role via CoffeeScript. I am working at having hubot tell our deployment processor to run a release. I wanted to help the user find the application they were looking for.

Helpful Links:

Try CoffeeScript - Paste your coffeescript and test it in browser