"RuntimeError"
"RuntimeError"?!!!!!
I hate people.
/usr/lib/ruby/vendor_ruby/net/scp.rb:385:in `await_response_state': scp: /tmp/vagrant-chef-1/validation.pem: Permission denied (RuntimeError)
"RuntimeError"
"RuntimeError"?!!!!!
I hate people.
/usr/lib/ruby/vendor_ruby/net/scp.rb:385:in `await_response_state': scp: /tmp/vagrant-chef-1/validation.pem: Permission denied (RuntimeError)
# Just throw this in a Vagrant 1.1 Vagrantfile and you get the | |
# `vagrant fab` command that does what you expect. The command | |
# to run in fab should go after "--" in the command line, example: | |
# | |
# vagrant fab -- deploy:production | |
# vagrant fab -- -l | |
# | |
# Easy plugins. The future. | |
class Plugin < Vagrant.plugin("1") | |
name "fab" |
Thanks to @vStone for pointing out the performance issue.
Since plugins were introduced, Vagrant has allowed plugins packaged as gems to autoload themselves by creating a file named "vagrant_init.rb" somewhere on their load path. This was intended as a way for gem authors to make installation ridiculously simple, and it worked!
However, this involved a significant impact on performance and this has been removed for a more manual approach in Vagrant 1.1. In Vagrant 1.1, users will be expected to have a ~/.vagrantrc
file which manually includes plugins they've installed via vagrant gem
. Gems can also, as always, be loaded in any Vagrantfile
as well.
For more information, read on...
#!/bin/bash | |
cat <<EOF | erl_call -s -name foo@localhost -c foo -e | |
erlv8:stop(), | |
erlv8:start(). | |
EOF |
Vagrant plugins currently expose the FULL POWER of Vagrant. Unfortunately, as is often the case, "full power" means "complicated" (relatively), especially for those not familiar with Ruby.
Instead, I'd like to introduce an alternative "simple" API to plugins as well that people can confidently use. Below are some examples of this. I'm not even going to describe what each plugin does because it should be simple enough from the code, that's how simple they are!
The end goal is that it should be much more common to see Vagrant projects ship with custom commands like vagrant run-tests
or vagrant start-server
, to perform common tasks that previously required SSH.
These "easy" plugins can't do everything but they will be able to do the common things. If you want more power, full (non-easy) plugins should be used.
# A method for configuration based on partial convergence in Chef. | |
# | |
# Assuming you have knowledge that Chef is two-phased (compilation then convergence), | |
# then this solves the problem where you need to pass data into a resource where the | |
# data comes from a place that requires some convergence to have occurred. Most often | |
# this happens for me in templates. | |
# | |
# Below is a general pattern I use when this is necessary (it is rare). Basically, I | |
# use an OpenStruct to assign some data to it via `ruby_block` (which is processed at | |
# convergence), and then I use that data in the resource that depends on it. Then in the |
# Get the directory where this script is. This will also resolve | |
# any symlinks in the directory/script, so it will be the fully | |
# resolved path. | |
SOURCE="${BASH_SOURCE[0]}" | |
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done | |
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" | |
# Useful variables | |
EMBEDDED_DIR=${DIR}/../embedded |
veewee
with Vagrant gives the end-user the expectation that Vagrant will also support VeeWee, which isn't true (more on this in a sec).veewee
with Vagrant requires I make sure it works with Vagrant at all times (or at least at that point I package). I'm not willing to do this. Again, more on this in a sec.veewee
but the functionality will be the same and I've talked to @patrickdebois about this already.vm.channel.execute("tail -f /some/growing/fail") do |type, data| | |
# type is one of [:stdout, :stderr, :exit_status] | |
# data is a string for stdout/stderr and an int for exit status | |
end |
#!/usr/bin/env ruby | |
require 'set' | |
def knife_list(type) | |
Set.new(`knife #{type} list`.split("\n").map { |a| a.strip.chomp }) | |
end | |
nodes = knife_list(:node) | |
clients = knife_list(:client) |