Skip to content

Instantly share code, notes, and snippets.

@enriclluelles
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save enriclluelles/86e474e890408dfb2f38 to your computer and use it in GitHub Desktop.
Save enriclluelles/86e474e890408dfb2f38 to your computer and use it in GitHub Desktop.
patch vagrant digitalocean so it sends user_data
From c89f4d9c261fd005258ac551f23dddc835ac719b Mon Sep 17 00:00:00 2001
From: Enric Lluelles <enric@lluell.es>
Date: Sat, 6 Sep 2014 02:06:02 +0200
Subject: [PATCH] Add user data as a provider param
---
lib/vagrant-digitalocean/actions/create.rb | 3 ++-
lib/vagrant-digitalocean/config.rb | 3 +++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/lib/vagrant-digitalocean/actions/create.rb b/lib/vagrant-digitalocean/actions/create.rb
index 908ee3e..3e212be 100644
--- a/lib/vagrant-digitalocean/actions/create.rb
+++ b/lib/vagrant-digitalocean/actions/create.rb
@@ -30,7 +30,8 @@ module VagrantPlugins
:ssh_keys => ssh_key_id,
:private_networking => @machine.provider_config.private_networking,
:backups => @machine.provider_config.backups_enabled,
- :ipv6 => @machine.provider_config.ipv6
+ :ipv6 => @machine.provider_config.ipv6,
+ :user_data => @machine.provider_config.user_data
})
# wait for request to complete
diff --git a/lib/vagrant-digitalocean/config.rb b/lib/vagrant-digitalocean/config.rb
index f83709b..c999844 100644
--- a/lib/vagrant-digitalocean/config.rb
+++ b/lib/vagrant-digitalocean/config.rb
@@ -11,6 +11,7 @@ module VagrantPlugins
attr_accessor :ca_path
attr_accessor :ssh_key_name
attr_accessor :setup
+ attr_accessor :user_data
alias_method :setup?, :setup
@@ -25,6 +26,7 @@ module VagrantPlugins
@ca_path = UNSET_VALUE
@ssh_key_name = UNSET_VALUE
@setup = UNSET_VALUE
+ @user_data = UNSET_VALUE
end
def finalize!
@@ -38,6 +40,7 @@ module VagrantPlugins
@ca_path = nil if @ca_path == UNSET_VALUE
@ssh_key_name = 'Vagrant' if @ssh_key_name == UNSET_VALUE
@setup = true if @setup == UNSET_VALUE
+ @user_data = nil if @user_data == UNSET_VALUE
end
def validate(machine)
--
1.8.5.2 (Apple Git-48)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment