Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Commit

Permalink
Merge branch 'master' of github.com:mitchellh/vagrant-rackspace
Browse files Browse the repository at this point in the history
Conflicts:
	lib/vagrant-rackspace/action/create_server.rb
  • Loading branch information
Kyle Rames committed Jun 20, 2014
2 parents afb4845 + 0860729 commit a5d37f3
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
1 change: 1 addition & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "dummy"
config.vm.provider :rackspace do |rs|
rs.username = ENV['RAX_USERNAME']
rs.admin_pass = ENV['VAGRANT_ADMIN_PASS']
rs.api_key = ENV['RAX_API_KEY']
rs.flavor = /1 GB Performance/
rs.image = /Ubuntu/
Expand Down
12 changes: 12 additions & 0 deletions lib/vagrant-rackspace/action/create_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,18 @@ def call(env)
:metadata => config.metadata
}

if config.admin_pass
options[:password] = config.admin_pass
end

if config.user_data
options[:user_data] = File.read(config.user_data)
end

if config.config_drive
options[:config_drive] = config.config_drive
end

if config.key_name
options[:key_name] = config.key_name
env[:ui].info(" -- Key Name: #{config.key_name}")
Expand Down
7 changes: 7 additions & 0 deletions lib/vagrant-rackspace/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,13 @@ class Config < Vagrant.plugin("2", :config)
# @return [Array]
attr_accessor :rsync_includes

# Password to set for root (on Linux) or Administrator (on Windows)
# A random password will be generated if admin_pass is not set or
# does not meet the password requirements of the operating system.
#
# @return [String]
attr_accessor :admin_pass

# Default Rackspace Cloud Network IDs
SERVICE_NET_ID = '11111111-1111-1111-1111-111111111111'
PUBLIC_NET_ID = '00000000-0000-0000-0000-000000000000'
Expand Down
4 changes: 3 additions & 1 deletion spec/vagrant-rackspace/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
its(:disk_config) { should be_nil }
its(:networks) { should be_nil }
its(:rsync_includes) { should be_nil }
its(:admin_pass) { should be_nil }
end

describe "overriding defaults" do
Expand All @@ -37,7 +38,8 @@
:rackconnect,
:server_name,
:disk_config,
:username].each do |attribute|
:username,
:admin_pass].each do |attribute|
it "should not default #{attribute} if overridden" do
subject.send("#{attribute}=".to_sym, "foo")
subject.finalize!
Expand Down

0 comments on commit a5d37f3

Please sign in to comment.