Created
          April 14, 2015 18:25 
        
      - 
      
- 
        Save Hounddog/11bce9f6f41e4cebe109 to your computer and use it in GitHub Desktop. 
    Vagrant Proxy
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | # -*- mode: ruby -*- | |
| # vi: set ft=ruby : | |
| require 'yaml' | |
| # Read YAML file with box details | |
| servers = YAML.load_file('servers.yml') | |
| #ARGV | |
| skip = 0 | |
| while skip < ARGV.length | |
| if ARGV[skip].start_with?(arg='--vagrant-namespace=') | |
| v = ARGV.delete_at(skip).dup | |
| v.slice! arg | |
| namespacefilter = v.to_s # set namespace | |
| else # skip over "official" vagrant args | |
| skip = skip + 1 | |
| end | |
| end | |
| servers.each do |servers, i| | |
| count = servers['count'] | |
| (1..count).each do |i| | |
| h = "#{servers['namespace']}-#{i}" | |
| if namespacefilter == servers['namespace'] | |
| ARGV << h; | |
| end | |
| end | |
| end | |
| myargs = ARGV.join(" "); | |
| exec 'vagrant ' << myargs | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment