vagrant-rackspace 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +2 -1
- data/CHANGELOG.md +15 -0
- data/README.md +4 -1
- data/Vagrantfile +122 -0
- data/features/provision.feature +36 -0
- data/features/steps/sdk_steps.rb +13 -0
- data/features/steps/server_steps.rb +25 -0
- data/features/support/env.rb +37 -0
- data/features/support/fog_mock.rb +19 -0
- data/features/vagrant-rackspace.feature +74 -0
- data/lib/vagrant-rackspace/action.rb +16 -0
- data/lib/vagrant-rackspace/action/connect_rackspace.rb +19 -9
- data/lib/vagrant-rackspace/action/create_server.rb +14 -0
- data/lib/vagrant-rackspace/action/sync_folders.rb +24 -4
- data/lib/vagrant-rackspace/config.rb +34 -5
- data/lib/vagrant-rackspace/version.rb +1 -1
- data/locales/en.yml +2 -0
- data/spec/vagrant-rackspace/config_spec.rb +6 -2
- data/vagrant-rackspace.gemspec +1 -0
- metadata +32 -19
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ZThhZmFmOTgyYjFhYmJjZGQzYjBmMTU2OGIwNGEwODg0OGMxOTk3YQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MmNkY2MzYWU1MzJlYzEyNjAwODc3YmRhYzQ3MjBmMGEwNTAzZjYzMQ==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
YjU2MmM5NGU3MmU1ZjZiMWU4N2JhYjAzNDkyOWZhNjE4ODA2Y2ViZmQ2NDM3
|
10
|
+
YjcwZTRmZmI5NTg1MWQ2MzJhMjYwYWI2YjRhMjU4MWI1YWFhMWIwNzBkNDhm
|
11
|
+
NWFjNmJhZDgzODk2MjJiN2VjMzlmYmE2ZGVjMDIwYTAwMmUzN2M=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NjkxMzcwOGVjODFiYTNhNjViODA0NGUwZWI2ODYwZGQwY2MyNzgzYjY0YmQz
|
14
|
+
MmRkMjQyMjk0ODc0NzAzYWI2NzE3OTM1ZTcyODExZDg0OWFkYzU3ZjcwM2Fj
|
15
|
+
Yjc0MDM3NjczYWExZDUyMGNjMDA4YTFjMTI0NTUxY2Q0OTM2YWM=
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
# 0.1.2 (August 22, 2013)
|
2
|
+
|
3
|
+
FEATURES:
|
4
|
+
|
5
|
+
- Add provision support [GH-16]
|
6
|
+
|
7
|
+
IMPROVEMENTS:
|
8
|
+
|
9
|
+
- Adds option to allow provisioning after RackConnect scripts complete. [GH-18]
|
10
|
+
- Remove Fog deprecation warnings [GH-11]
|
11
|
+
- Bypass rsync's StrictHostKeyCheck [GH-5]
|
12
|
+
- Make chown'ing of synced folder perms recursive (for ssh user) [GH-24]
|
13
|
+
- Use /cygdrive when rsyncing on Windows [GH-17]
|
14
|
+
|
15
|
+
|
1
16
|
# 0.1.1 (March 18, 2013)
|
2
17
|
|
3
18
|
* Up fog dependency for Vagrant 1.1.1
|
data/README.md
CHANGED
@@ -90,7 +90,10 @@ This provider exposes quite a few provider-specific configuration options:
|
|
90
90
|
* `image` - The server image to boot. This can be a string matching the
|
91
91
|
exact ID or name of the image, or this can be a regular expression to
|
92
92
|
partially match some image.
|
93
|
-
* `
|
93
|
+
* `rackspace_region` - The region to hit. By default this is :dfw. Valid options are:
|
94
|
+
:dfw, :ord, :lon. User this OR rackspace_compute_url
|
95
|
+
* `rackspace_compute_url` - The compute_url to hit. This is good for custom endpoints.
|
96
|
+
Use this OR rackspace_region.
|
94
97
|
* `public_key_path` - The path to a public key to initialize with the remote
|
95
98
|
server. This should be the matching pair for the private key configured
|
96
99
|
with `config.ssh.private_key_path` on Vagrant.
|
data/Vagrantfile
ADDED
@@ -0,0 +1,122 @@
|
|
1
|
+
# -*- mode: ruby -*-
|
2
|
+
# vi: set ft=ruby :
|
3
|
+
|
4
|
+
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
|
5
|
+
VAGRANTFILE_API_VERSION = "2"
|
6
|
+
|
7
|
+
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
8
|
+
Vagrant.require_plugin "vagrant-rackspace"
|
9
|
+
# All Vagrant configuration is done here. The most common configuration
|
10
|
+
# options are documented and commented below. For a complete reference,
|
11
|
+
# please see the online documentation at vagrantup.com.
|
12
|
+
|
13
|
+
# Every Vagrant virtual environment requires a box to build off of.
|
14
|
+
config.vm.box = "dummy"
|
15
|
+
config.vm.provider :rackspace do |rs|
|
16
|
+
rs.username = ENV['RAX_USERNAME']
|
17
|
+
rs.api_key = ENV['RAX_API_KEY']
|
18
|
+
end
|
19
|
+
# The url from where the 'config.vm.box' box will be fetched if it
|
20
|
+
# doesn't already exist on the user's system.
|
21
|
+
# config.vm.box_url = "http://domain.com/path/to/above.box"
|
22
|
+
|
23
|
+
# Create a forwarded port mapping which allows access to a specific port
|
24
|
+
# within the machine from a port on the host machine. In the example below,
|
25
|
+
# accessing "localhost:8080" will access port 80 on the guest machine.
|
26
|
+
# config.vm.network :forwarded_port, guest: 80, host: 8080
|
27
|
+
|
28
|
+
# Create a private network, which allows host-only access to the machine
|
29
|
+
# using a specific IP.
|
30
|
+
# config.vm.network :private_network, ip: "192.168.33.10"
|
31
|
+
|
32
|
+
# Create a public network, which generally matched to bridged network.
|
33
|
+
# Bridged networks make the machine appear as another physical device on
|
34
|
+
# your network.
|
35
|
+
# config.vm.network :public_network
|
36
|
+
|
37
|
+
# If true, then any SSH connections made will enable agent forwarding.
|
38
|
+
# Default value: false
|
39
|
+
# config.ssh.forward_agent = true
|
40
|
+
|
41
|
+
# Share an additional folder to the guest VM. The first argument is
|
42
|
+
# the path on the host to the actual folder. The second argument is
|
43
|
+
# the path on the guest to mount the folder. And the optional third
|
44
|
+
# argument is a set of non-required options.
|
45
|
+
# config.vm.synced_folder "../data", "/vagrant_data"
|
46
|
+
|
47
|
+
# Provider-specific configuration so you can fine-tune various
|
48
|
+
# backing providers for Vagrant. These expose provider-specific options.
|
49
|
+
# Example for VirtualBox:
|
50
|
+
#
|
51
|
+
# config.vm.provider :virtualbox do |vb|
|
52
|
+
# # Don't boot with headless mode
|
53
|
+
# vb.gui = true
|
54
|
+
#
|
55
|
+
# # Use VBoxManage to customize the VM. For example to change memory:
|
56
|
+
# vb.customize ["modifyvm", :id, "--memory", "1024"]
|
57
|
+
# end
|
58
|
+
#
|
59
|
+
# View the documentation for the provider you're using for more
|
60
|
+
# information on available options.
|
61
|
+
|
62
|
+
# Enable provisioning with Puppet stand alone. Puppet manifests
|
63
|
+
# are contained in a directory path relative to this Vagrantfile.
|
64
|
+
# You will need to create the manifests directory and a manifest in
|
65
|
+
# the file base.pp in the manifests_path directory.
|
66
|
+
#
|
67
|
+
# An example Puppet manifest to provision the message of the day:
|
68
|
+
#
|
69
|
+
# # group { "puppet":
|
70
|
+
# # ensure => "present",
|
71
|
+
# # }
|
72
|
+
# #
|
73
|
+
# # File { owner => 0, group => 0, mode => 0644 }
|
74
|
+
# #
|
75
|
+
# # file { '/etc/motd':
|
76
|
+
# # content => "Welcome to your Vagrant-built virtual machine!
|
77
|
+
# # Managed by Puppet.\n"
|
78
|
+
# # }
|
79
|
+
#
|
80
|
+
# config.vm.provision :puppet do |puppet|
|
81
|
+
# puppet.manifests_path = "manifests"
|
82
|
+
# puppet.manifest_file = "init.pp"
|
83
|
+
# end
|
84
|
+
|
85
|
+
# Enable provisioning with chef solo, specifying a cookbooks path, roles
|
86
|
+
# path, and data_bags path (all relative to this Vagrantfile), and adding
|
87
|
+
# some recipes and/or roles.
|
88
|
+
#
|
89
|
+
# config.vm.provision :chef_solo do |chef|
|
90
|
+
# chef.cookbooks_path = "../my-recipes/cookbooks"
|
91
|
+
# chef.roles_path = "../my-recipes/roles"
|
92
|
+
# chef.data_bags_path = "../my-recipes/data_bags"
|
93
|
+
# chef.add_recipe "mysql"
|
94
|
+
# chef.add_role "web"
|
95
|
+
#
|
96
|
+
# # You may also specify custom JSON attributes:
|
97
|
+
# chef.json = { :mysql_password => "foo" }
|
98
|
+
# end
|
99
|
+
|
100
|
+
# Enable provisioning with chef server, specifying the chef server URL,
|
101
|
+
# and the path to the validation key (relative to this Vagrantfile).
|
102
|
+
#
|
103
|
+
# The Opscode Platform uses HTTPS. Substitute your organization for
|
104
|
+
# ORGNAME in the URL and validation key.
|
105
|
+
#
|
106
|
+
# If you have your own Chef Server, use the appropriate URL, which may be
|
107
|
+
# HTTP instead of HTTPS depending on your configuration. Also change the
|
108
|
+
# validation key to validation.pem.
|
109
|
+
#
|
110
|
+
# config.vm.provision :chef_client do |chef|
|
111
|
+
# chef.chef_server_url = "https://api.opscode.com/organizations/ORGNAME"
|
112
|
+
# chef.validation_key_path = "ORGNAME-validator.pem"
|
113
|
+
# end
|
114
|
+
#
|
115
|
+
# If you're using the Opscode platform, your validator client is
|
116
|
+
# ORGNAME-validator, replacing ORGNAME with your organization name.
|
117
|
+
#
|
118
|
+
# If you have your own Chef Server, the default validation client name is
|
119
|
+
# chef-validator, unless you changed the configuration.
|
120
|
+
#
|
121
|
+
# chef.validation_client_name = "ORGNAME-validator"
|
122
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
@announce
|
2
|
+
@vagrant-rackspace
|
3
|
+
Feature: vagrant-rackspace fog tests
|
4
|
+
|
5
|
+
Background:
|
6
|
+
Given I have Rackspace credentials available
|
7
|
+
And I have a "fog_mock.rb" file
|
8
|
+
|
9
|
+
Scenario: Create a single server (with provisioning)
|
10
|
+
Given a file named "Vagrantfile" with:
|
11
|
+
"""
|
12
|
+
Vagrant.configure("2") do |config|
|
13
|
+
Vagrant.require_plugin "vagrant-rackspace"
|
14
|
+
|
15
|
+
config.vm.box = "dummy"
|
16
|
+
config.ssh.private_key_path = "~/.ssh/id_rsa"
|
17
|
+
config.ssh.max_tries = 1
|
18
|
+
config.ssh.timeout = 10
|
19
|
+
|
20
|
+
config.vm.provider :rackspace do |rs|
|
21
|
+
rs.server_name = 'vagrant-provisioned-server'
|
22
|
+
rs.username = ENV['RAX_USERNAME']
|
23
|
+
rs.api_key = ENV['RAX_API_KEY']
|
24
|
+
rs.rackspace_region = ENV['RAX_REGION'].downcase.to_sym
|
25
|
+
rs.flavor = /512MB/
|
26
|
+
rs.image = /Ubuntu/
|
27
|
+
rs.public_key_path = "~/.ssh/id_rsa.pub"
|
28
|
+
end
|
29
|
+
|
30
|
+
config.vm.provision :shell, :inline => "echo Hello, World"
|
31
|
+
end
|
32
|
+
"""
|
33
|
+
When I successfully run `bundle exec vagrant up --provider rackspace`
|
34
|
+
# I want to capture the ID like I do in tests for other tools, but Vagrant doesn't print it!
|
35
|
+
# And I get the server from "Instance ID:"
|
36
|
+
Then the server "vagrant-provisioned-server" should be active
|
@@ -0,0 +1,13 @@
|
|
1
|
+
Given(/^I have Rackspace credentials available$/) do
|
2
|
+
fail unless ENV['RAX_USERNAME'] && ENV['RAX_API_KEY']
|
3
|
+
end
|
4
|
+
|
5
|
+
Given(/^I have a "fog_mock.rb" file$/) do
|
6
|
+
script = File.open("features/support/fog_mock.rb").read
|
7
|
+
steps %Q{
|
8
|
+
Given a file named "fog_mock.rb" with:
|
9
|
+
"""
|
10
|
+
#{script}
|
11
|
+
"""
|
12
|
+
}
|
13
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
When(/^I get the server from "(.*?)"$/) do |label|
|
2
|
+
@server_id = all_output.match(/#{label}\s([\w-]*)/)[1]
|
3
|
+
puts "Server: #{@server_id}"
|
4
|
+
end
|
5
|
+
|
6
|
+
When(/^I load the server$/) do
|
7
|
+
@server_id = all_output.strip.lines.to_a.last
|
8
|
+
puts "Server: #{@server_id}"
|
9
|
+
end
|
10
|
+
|
11
|
+
Then(/^the server should be active$/) do
|
12
|
+
unless Fog.mock? # unfortunately we can't assert this with Fog.mock!, since mocked objects do not persist from the subprocess
|
13
|
+
assert_active @server_id
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
Then(/^the server "(.+)" should be active$/) do |server_name|
|
18
|
+
server = @compute.servers.all.find{|s| s.name == server_name}
|
19
|
+
assert_active server.id
|
20
|
+
end
|
21
|
+
|
22
|
+
def assert_active server_id
|
23
|
+
server = @compute.servers.get server_id
|
24
|
+
server.state.should == 'ACTIVE'
|
25
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'fog'
|
2
|
+
require 'aruba/cucumber'
|
3
|
+
|
4
|
+
Fog.mock! if ENV['RAX_MOCK'] == 'true'
|
5
|
+
|
6
|
+
Before do | scenario |
|
7
|
+
@aruba_timeout_seconds = 600
|
8
|
+
@scenario = File.basename(scenario.file)
|
9
|
+
ENV['CASSETTE'] = @scenario
|
10
|
+
|
11
|
+
proxy_options = {
|
12
|
+
:connection_options => {
|
13
|
+
:proxy => ENV['https_proxy'],
|
14
|
+
:ssl_verify_peer => false
|
15
|
+
}
|
16
|
+
}
|
17
|
+
|
18
|
+
connect_options = {
|
19
|
+
:provider => 'rackspace',
|
20
|
+
:rackspace_username => ENV['RAX_USERNAME'],
|
21
|
+
:rackspace_api_key => ENV['RAX_API_KEY'],
|
22
|
+
:version => :v2, # Use Next Gen Cloud Servers
|
23
|
+
:rackspace_region => ENV['RAX_REGION'].downcase.to_sym
|
24
|
+
}
|
25
|
+
connect_options.merge!(proxy_options) unless ENV['https_proxy'].nil?
|
26
|
+
@compute = Fog::Compute.new(connect_options)
|
27
|
+
end
|
28
|
+
|
29
|
+
Around do | scenario, block |
|
30
|
+
Bundler.with_clean_env do
|
31
|
+
block.call
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
After('@creates_server') do
|
36
|
+
@compute.servers.delete @server_id
|
37
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'fog'
|
2
|
+
if ENV['RAX_MOCK'] == 'true'
|
3
|
+
Fog.mock!
|
4
|
+
Fog::Rackspace::MockData.configure do |c|
|
5
|
+
c[:image_name_generator] = Proc.new { "Ubuntu" }
|
6
|
+
c[:ipv4_generator] = Proc.new { "10.11.12.2"}
|
7
|
+
end
|
8
|
+
connect_options = {
|
9
|
+
:provider => 'rackspace',
|
10
|
+
:rackspace_username => ENV['RAX_USERNAME'],
|
11
|
+
:rackspace_api_key => ENV['RAX_API_KEY'],
|
12
|
+
:version => :v2, # Use Next Gen Cloud Servers
|
13
|
+
:rackspace_region => :ord #Use Chicago Region
|
14
|
+
}
|
15
|
+
connect_options.merge!(proxy_options) unless ENV['https_proxy'].nil?
|
16
|
+
compute = Fog::Compute.new(connect_options)
|
17
|
+
# Force creation of Ubuntu image so it will show up in compute.images.list
|
18
|
+
compute.images.get(0)
|
19
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
@announce
|
2
|
+
@vagrant-rackspace
|
3
|
+
Feature: vagrant-rackspace fog tests
|
4
|
+
As a Fog developer
|
5
|
+
I want to smoke (or "fog") test vagrant-rackspace.
|
6
|
+
So I am confident my upstream changes did not create downstream problems.
|
7
|
+
|
8
|
+
Background:
|
9
|
+
Given I have Rackspace credentials available
|
10
|
+
And I have a "fog_mock.rb" file
|
11
|
+
|
12
|
+
Scenario: Create a single server (region)
|
13
|
+
Given a file named "Vagrantfile" with:
|
14
|
+
"""
|
15
|
+
# Testing options
|
16
|
+
require File.expand_path '../fog_mock', __FILE__
|
17
|
+
|
18
|
+
Vagrant.configure("2") do |config|
|
19
|
+
# dev/test method of loading plugin, normally would be 'vagrant plugin install vagrant-rackspace'
|
20
|
+
Vagrant.require_plugin "vagrant-rackspace"
|
21
|
+
|
22
|
+
config.vm.box = "dummy"
|
23
|
+
config.ssh.username = "vagrant" if Fog.mock?
|
24
|
+
config.ssh.private_key_path = "~/.ssh/id_rsa" unless Fog.mock?
|
25
|
+
config.ssh.max_tries = 1
|
26
|
+
config.ssh.timeout = 10
|
27
|
+
|
28
|
+
config.vm.provider :rackspace do |rs|
|
29
|
+
rs.server_name = 'vagrant-single-server'
|
30
|
+
rs.username = ENV['RAX_USERNAME']
|
31
|
+
rs.api_key = ENV['RAX_API_KEY']
|
32
|
+
rs.rackspace_region = ENV['RAX_REGION'].downcase.to_sym
|
33
|
+
rs.flavor = /512MB/
|
34
|
+
rs.image = /Ubuntu/
|
35
|
+
rs.public_key_path = "~/.ssh/id_rsa.pub" unless Fog.mock?
|
36
|
+
end
|
37
|
+
end
|
38
|
+
"""
|
39
|
+
When I successfully run `bundle exec vagrant up --provider rackspace`
|
40
|
+
# I want to capture the ID like I do in tests for other tools, but Vagrant doesn't print it!
|
41
|
+
# And I get the server from "Instance ID:"
|
42
|
+
Then the server "vagrant-single-server" should be active
|
43
|
+
|
44
|
+
Scenario: Create a single server (compute_url)
|
45
|
+
Given a file named "Vagrantfile" with:
|
46
|
+
"""
|
47
|
+
# Testing options
|
48
|
+
require File.expand_path '../fog_mock', __FILE__
|
49
|
+
|
50
|
+
Vagrant.configure("2") do |config|
|
51
|
+
# dev/test method of loading plugin, normally would be 'vagrant plugin install vagrant-rackspace'
|
52
|
+
Vagrant.require_plugin "vagrant-rackspace"
|
53
|
+
|
54
|
+
config.vm.box = "dummy"
|
55
|
+
config.ssh.username = "vagrant" if Fog.mock?
|
56
|
+
config.ssh.private_key_path = "~/.ssh/id_rsa" unless Fog.mock?
|
57
|
+
config.ssh.max_tries = 1
|
58
|
+
config.ssh.timeout = 10
|
59
|
+
|
60
|
+
config.vm.provider :rackspace do |rs|
|
61
|
+
rs.server_name = 'vagrant-single-server'
|
62
|
+
rs.username = ENV['RAX_USERNAME']
|
63
|
+
rs.api_key = ENV['RAX_API_KEY']
|
64
|
+
rs.compute_url = "https://#{ENV['RAX_REGION'].downcase}.servers.api.rackspacecloud.com/v2"
|
65
|
+
rs.flavor = /512MB/
|
66
|
+
rs.image = /Ubuntu/
|
67
|
+
rs.public_key_path = "~/.ssh/id_rsa.pub" unless Fog.mock?
|
68
|
+
end
|
69
|
+
end
|
70
|
+
"""
|
71
|
+
When I successfully run `bundle exec vagrant up --provider rackspace`
|
72
|
+
# I want to capture the ID like I do in tests for other tools, but Vagrant doesn't print it!
|
73
|
+
# And I get the server from "Instance ID:"
|
74
|
+
Then the server "vagrant-single-server" should be active
|
@@ -24,6 +24,22 @@ module VagrantPlugins
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
+
# This action is called when `vagrant provision` is called.
|
28
|
+
def self.action_provision
|
29
|
+
Vagrant::Action::Builder.new.tap do |b|
|
30
|
+
b.use ConfigValidate
|
31
|
+
b.use Call, IsCreated do |env, b2|
|
32
|
+
if !env[:result]
|
33
|
+
b2.use MessageNotCreated
|
34
|
+
next
|
35
|
+
end
|
36
|
+
|
37
|
+
b2.use Provision
|
38
|
+
b2.use SyncFolders
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
27
43
|
# This action is called to read the SSH info of the machine. The
|
28
44
|
# resulting state is expected to be put into the `:machine_ssh_info`
|
29
45
|
# key.
|
@@ -17,17 +17,27 @@ module VagrantPlugins
|
|
17
17
|
# Get the configs
|
18
18
|
config = env[:machine].provider_config
|
19
19
|
api_key = config.api_key
|
20
|
-
endpoint = config.endpoint
|
21
20
|
username = config.username
|
22
21
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
22
|
+
if config.rackspace_compute_url.nil? then
|
23
|
+
@logger.info("Connecting to Rackspace region...")
|
24
|
+
env[:rackspace_compute] = Fog::Compute.new({
|
25
|
+
:provider => :rackspace,
|
26
|
+
:version => :v2,
|
27
|
+
:rackspace_api_key => api_key,
|
28
|
+
:rackspace_region => config.rackspace_region,
|
29
|
+
:rackspace_username => username
|
30
|
+
})
|
31
|
+
else
|
32
|
+
@logger.info("Connecting to Rackspace compute_url...")
|
33
|
+
env[:rackspace_compute] = Fog::Compute.new({
|
34
|
+
:provider => :rackspace,
|
35
|
+
:version => :v2,
|
36
|
+
:rackspace_api_key => api_key,
|
37
|
+
:rackspace_compute_url => config.rackspace_compute_url,
|
38
|
+
:rackspace_username => username
|
39
|
+
})
|
40
|
+
end
|
31
41
|
|
32
42
|
@app.call(env)
|
33
43
|
end
|
@@ -90,6 +90,20 @@ module VagrantPlugins
|
|
90
90
|
# Clear the line one more time so the progress is removed
|
91
91
|
env[:ui].clear_line
|
92
92
|
|
93
|
+
# Wait for RackConnect to complete
|
94
|
+
if ( config.rackconnect )
|
95
|
+
env[:ui].info(I18n.t("vagrant_rackspace.waiting_for_rackconnect"))
|
96
|
+
while true
|
97
|
+
status = server.metadata.all["rackconnect_automation_status"]
|
98
|
+
if ( !status.nil? )
|
99
|
+
env[:ui].info( status )
|
100
|
+
end
|
101
|
+
break if env[:interrupted]
|
102
|
+
break if (status.to_s =~ /deployed/i)
|
103
|
+
sleep 10
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
93
107
|
# Wait for SSH to become available
|
94
108
|
env[:ui].info(I18n.t("vagrant_rackspace.waiting_for_ssh"))
|
95
109
|
while true
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require "log4r"
|
2
|
-
|
2
|
+
require 'rbconfig'
|
3
3
|
require "vagrant/util/subprocess"
|
4
4
|
|
5
5
|
module VagrantPlugins
|
@@ -11,6 +11,7 @@ module VagrantPlugins
|
|
11
11
|
def initialize(app, env)
|
12
12
|
@app = app
|
13
13
|
@logger = Log4r::Logger.new("vagrant_rackspace::action::sync_folders")
|
14
|
+
@host_os = RbConfig::CONFIG['host_os']
|
14
15
|
end
|
15
16
|
|
16
17
|
def call(env)
|
@@ -25,6 +26,11 @@ module VagrantPlugins
|
|
25
26
|
# Make sure there is a trailing slash on the host path to
|
26
27
|
# avoid creating an additional directory with rsync
|
27
28
|
hostpath = "#{hostpath}/" if hostpath !~ /\/$/
|
29
|
+
|
30
|
+
# If on Windows, modify the path to work with cygwin rsync
|
31
|
+
if @host_os =~ /mswin|mingw|cygwin/
|
32
|
+
hostpath = hostpath.sub(/^([A-Za-z]):\//, "/cygdrive/#{$1.downcase}/")
|
33
|
+
end
|
28
34
|
|
29
35
|
env[:ui].info(I18n.t("vagrant_rackspace.rsync_folder",
|
30
36
|
:hostpath => hostpath,
|
@@ -33,15 +39,29 @@ module VagrantPlugins
|
|
33
39
|
# Create the guest path
|
34
40
|
env[:machine].communicate.sudo("mkdir -p '#{guestpath}'")
|
35
41
|
env[:machine].communicate.sudo(
|
36
|
-
"chown #{ssh_info[:username]} '#{guestpath}'")
|
42
|
+
"chown -R #{ssh_info[:username]} '#{guestpath}'")
|
37
43
|
|
38
|
-
# Rsync over to the guest path using the SSH info
|
44
|
+
# Rsync over to the guest path using the SSH info. add
|
45
|
+
# .hg/ to exclude list as that isn't covered in
|
46
|
+
# --cvs-exclude
|
39
47
|
command = [
|
40
48
|
"rsync", "--verbose", "--archive", "-z",
|
41
|
-
"-
|
49
|
+
"--cvs-exclude",
|
50
|
+
"--exclude", ".hg/",
|
51
|
+
"-e", "ssh -p #{ssh_info[:port]} -i '#{ssh_info[:private_key_path]}' -o StrictHostKeyChecking=no",
|
42
52
|
hostpath,
|
43
53
|
"#{ssh_info[:username]}@#{ssh_info[:host]}:#{guestpath}"]
|
44
54
|
|
55
|
+
# during rsync, ignore files specified in .hgignore and
|
56
|
+
# .gitignore traditional .gitignore or .hgignore files
|
57
|
+
ignore_files = [".hgignore", ".gitignore"]
|
58
|
+
ignore_files.each do |ignore_file|
|
59
|
+
abs_ignore_file = env[:root_path].to_s + "/" + ignore_file
|
60
|
+
if File.exist?(abs_ignore_file)
|
61
|
+
command = command + ["--exclude-from", abs_ignore_file]
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
45
65
|
r = Vagrant::Util::Subprocess.execute(*command)
|
46
66
|
if r.exit_code != 0
|
47
67
|
raise Errors::RsyncError,
|
@@ -8,11 +8,31 @@ module VagrantPlugins
|
|
8
8
|
# @return [String]
|
9
9
|
attr_accessor :api_key
|
10
10
|
|
11
|
-
# The
|
11
|
+
# The region to access RackSpace. If nil, it will default
|
12
12
|
# to DFW.
|
13
|
+
# (formerly know as 'endpoint')
|
13
14
|
#
|
14
|
-
#
|
15
|
-
|
15
|
+
# expected to be a symbol - :dfw (default), :ord, :lon
|
16
|
+
#
|
17
|
+
# use this OR rackspace_compute_url
|
18
|
+
attr_accessor :rackspace_region
|
19
|
+
|
20
|
+
# The compute_url to access RackSpace. If nil, it will default
|
21
|
+
# to DFW.
|
22
|
+
# (formerly know as 'endpoint')
|
23
|
+
#
|
24
|
+
# expected to be a string url -
|
25
|
+
# 'https://dfw.servers.api.rackspacecloud.com/v2'
|
26
|
+
# 'https://ord.servers.api.rackspacecloud.com/v2'
|
27
|
+
# 'https://lon.servers.api.rackspacecloud.com/v2'
|
28
|
+
#
|
29
|
+
# alternatively, can use constants if you require 'fog/rackspace' in your Vagrantfile
|
30
|
+
# Fog::Compute::RackspaceV2::DFW_ENDPOINT
|
31
|
+
# Fog::Compute::RackspaceV2::ORD_ENDPOINT
|
32
|
+
# Fog::Compute::RackspaceV2::LON_ENDPOINT
|
33
|
+
#
|
34
|
+
# use this OR rackspace_region
|
35
|
+
attr_accessor :rackspace_compute_url
|
16
36
|
|
17
37
|
# The flavor of server to launch, either the ID or name. This
|
18
38
|
# can also be a regular expression to partially match a name.
|
@@ -28,6 +48,11 @@ module VagrantPlugins
|
|
28
48
|
# @return [String]
|
29
49
|
attr_accessor :public_key_path
|
30
50
|
|
51
|
+
# The option that indicates RackConnect usage or not.
|
52
|
+
#
|
53
|
+
# @return [Boolean]
|
54
|
+
attr_accessor :rackconnect
|
55
|
+
|
31
56
|
# The name of the server. This defaults to the name of the machine
|
32
57
|
# defined by Vagrant (via `config.vm.define`), but can be overriden
|
33
58
|
# here.
|
@@ -40,19 +65,23 @@ module VagrantPlugins
|
|
40
65
|
|
41
66
|
def initialize
|
42
67
|
@api_key = UNSET_VALUE
|
43
|
-
@
|
68
|
+
@rackspace_region = UNSET_VALUE
|
69
|
+
@rackspace_compute_url = UNSET_VALUE
|
44
70
|
@flavor = UNSET_VALUE
|
45
71
|
@image = UNSET_VALUE
|
46
72
|
@public_key_path = UNSET_VALUE
|
73
|
+
@rackconnect = UNSET_VALUE
|
47
74
|
@server_name = UNSET_VALUE
|
48
75
|
@username = UNSET_VALUE
|
49
76
|
end
|
50
77
|
|
51
78
|
def finalize!
|
52
79
|
@api_key = nil if @api_key == UNSET_VALUE
|
53
|
-
@
|
80
|
+
@rackspace_region = nil if @rackspace_region == UNSET_VALUE
|
81
|
+
@rackspace_compute_url = nil if @rackspace_compute_url == UNSET_VALUE
|
54
82
|
@flavor = /512MB/ if @flavor == UNSET_VALUE
|
55
83
|
@image = /Ubuntu/ if @image == UNSET_VALUE
|
84
|
+
@rackconnect = false if @rackconnect == UNSET_VALUE
|
56
85
|
@server_name = nil if @server_name == UNSET_VALUE
|
57
86
|
@username = nil if @username == UNSET_VALUE
|
58
87
|
|
data/locales/en.yml
CHANGED
@@ -18,6 +18,8 @@ en:
|
|
18
18
|
Rsyncing folder: %{hostpath} => %{guestpath}
|
19
19
|
waiting_for_build: |-
|
20
20
|
Waiting for the server to be built...
|
21
|
+
waiting_for_rackconnect: |-
|
22
|
+
Waiting for RackConnect to complete...
|
21
23
|
waiting_for_ssh: |-
|
22
24
|
Waiting for SSH to become available...
|
23
25
|
warn_insecure_ssh: |-
|
@@ -11,20 +11,24 @@ describe VagrantPlugins::Rackspace::Config do
|
|
11
11
|
end
|
12
12
|
|
13
13
|
its(:api_key) { should be_nil }
|
14
|
-
its(:
|
14
|
+
its(:rackspace_region) { should be_nil }
|
15
|
+
its(:rackspace_compute_url) { should be_nil }
|
15
16
|
its(:flavor) { should eq(/512MB/) }
|
16
17
|
its(:image) { should eq(/Ubuntu/) }
|
17
18
|
its(:public_key_path) { should eql(vagrant_public_key) }
|
19
|
+
its(:rackconnect) { should be_nil }
|
18
20
|
its(:server_name) { should be_nil }
|
19
21
|
its(:username) { should be_nil }
|
20
22
|
end
|
21
23
|
|
22
24
|
describe "overriding defaults" do
|
23
25
|
[:api_key,
|
24
|
-
:
|
26
|
+
:rackspace_region,
|
27
|
+
:rackspace_compute_url,
|
25
28
|
:flavor,
|
26
29
|
:image,
|
27
30
|
:public_key_path,
|
31
|
+
:rackconnect,
|
28
32
|
:server_name,
|
29
33
|
:username].each do |attribute|
|
30
34
|
it "should not default #{attribute} if overridden" do
|
data/vagrant-rackspace.gemspec
CHANGED
@@ -16,6 +16,7 @@ Gem::Specification.new do |gem|
|
|
16
16
|
|
17
17
|
gem.add_development_dependency "rake"
|
18
18
|
gem.add_development_dependency "rspec", "~> 2.13.0"
|
19
|
+
gem.add_development_dependency "aruba"
|
19
20
|
|
20
21
|
gem.files = `git ls-files`.split($/)
|
21
22
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-rackspace
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Mitchell Hashimoto
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-08-22 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: fog
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -30,7 +27,6 @@ dependencies:
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rake
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ! '>='
|
36
32
|
- !ruby/object:Gem::Version
|
@@ -38,7 +34,6 @@ dependencies:
|
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - ! '>='
|
44
39
|
- !ruby/object:Gem::Version
|
@@ -46,7 +41,6 @@ dependencies:
|
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: rspec
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
45
|
- - ~>
|
52
46
|
- !ruby/object:Gem::Version
|
@@ -54,11 +48,24 @@ dependencies:
|
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
52
|
- - ~>
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: 2.13.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: aruba
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ! '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
62
69
|
description: Enables Vagrant to manage machines in RackSpace Cloud.
|
63
70
|
email:
|
64
71
|
- mitchell@hashicorp.com
|
@@ -72,9 +79,16 @@ files:
|
|
72
79
|
- LICENSE.txt
|
73
80
|
- README.md
|
74
81
|
- Rakefile
|
82
|
+
- Vagrantfile
|
75
83
|
- dummy.box
|
76
84
|
- example_box/README.md
|
77
85
|
- example_box/metadata.json
|
86
|
+
- features/provision.feature
|
87
|
+
- features/steps/sdk_steps.rb
|
88
|
+
- features/steps/server_steps.rb
|
89
|
+
- features/support/env.rb
|
90
|
+
- features/support/fog_mock.rb
|
91
|
+
- features/vagrant-rackspace.feature
|
78
92
|
- lib/vagrant-rackspace.rb
|
79
93
|
- lib/vagrant-rackspace/action.rb
|
80
94
|
- lib/vagrant-rackspace/action/connect_rackspace.rb
|
@@ -97,33 +111,32 @@ files:
|
|
97
111
|
- vagrant-rackspace.gemspec
|
98
112
|
homepage: http://www.vagrantup.com
|
99
113
|
licenses: []
|
114
|
+
metadata: {}
|
100
115
|
post_install_message:
|
101
116
|
rdoc_options: []
|
102
117
|
require_paths:
|
103
118
|
- lib
|
104
119
|
required_ruby_version: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
120
|
requirements:
|
107
121
|
- - ! '>='
|
108
122
|
- !ruby/object:Gem::Version
|
109
123
|
version: '0'
|
110
|
-
segments:
|
111
|
-
- 0
|
112
|
-
hash: -1125899910436206923
|
113
124
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
114
|
-
none: false
|
115
125
|
requirements:
|
116
126
|
- - ! '>='
|
117
127
|
- !ruby/object:Gem::Version
|
118
128
|
version: '0'
|
119
|
-
segments:
|
120
|
-
- 0
|
121
|
-
hash: -1125899910436206923
|
122
129
|
requirements: []
|
123
130
|
rubyforge_project:
|
124
|
-
rubygems_version:
|
131
|
+
rubygems_version: 2.0.3
|
125
132
|
signing_key:
|
126
|
-
specification_version:
|
133
|
+
specification_version: 4
|
127
134
|
summary: Enables Vagrant to manage machines in RackSpace Cloud.
|
128
135
|
test_files:
|
136
|
+
- features/provision.feature
|
137
|
+
- features/steps/sdk_steps.rb
|
138
|
+
- features/steps/server_steps.rb
|
139
|
+
- features/support/env.rb
|
140
|
+
- features/support/fog_mock.rb
|
141
|
+
- features/vagrant-rackspace.feature
|
129
142
|
- spec/vagrant-rackspace/config_spec.rb
|