Sha256: dff0a616b8afa323decdf189f09cbd083f115612fa4d42413929c90cf800767d
Contents?: true
Size: 1.39 KB
Versions: 1
Compression:
Stored size: 1.39 KB
Contents
module Catfish class CLI::Provision attr_reader :options def initialize(options) @options = options end def run puts 'Provisioning to servers using Catfishfile.lock' vagrant_version begin # Connect to the servers. The --provider=managed is the key here. system("vagrant up /managed/ --provider=#{options[:provider]}") # Confirm the connectivity status = `vagrant status /managed/ --machine-readable` if status.include? 'not reachable' abort 'ERROR DEPLOYING: One or more servers could not be connected to' end provision status ensure # Disconnect from all of the servers system 'vagrant destroy -f /managed/' end end private def vagrant_version #vagrant_version = 'Vagrant 1.6' #fail "#{vagrant_version} or greater is a prerequisite" unless `vagrant --version`.include? vagrant_version end def provision(status) if options[:parallel] machines = status.split("\n").collect do |line| line.split(',')[1] end threads = [] machines.uniq!.each do |machine| threads << Thread.new do system "vagrant provision #{machine}" end end threads.each(&:join) else command = 'vagrant provision /managed/' system command end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
catfish-0.0.8 | lib/catfish/cli/provision.rb |