vagrant-rackspace 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ODA5MmJhZGMzMzRlYmE2NTJmMGVmMWRkNTM2Y2ZjNzA4MWRmNzZkNg==
4
+ NzUyZjc0ZDA4OWM5ODRmYTczMjE2N2ZhMTY0MTAwN2QyMjA1NjdlYg==
5
5
  data.tar.gz: !binary |-
6
- OWFkY2M1MTVlYTRhY2QyMDJkNzMyZmM1NGE3ODNjNjdjMTc4ZWYyNg==
6
+ NGNiZDA2MzM4NjQ3YmU2MmUyMWMzNjMyZTcyZTRjYjlhNTdlNjdlYw==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- YzE1YjAwOGYwNTc1MjQxNzY0NmU5MjM1MmQzMTZjNGQ4ZTUwYjhmOGRmMzU1
10
- NDM3OTU0NzVjZWQ0M2EzMWRjMzExZmEyYWFhZjNiMWQ3MmRiNTE5ZmMwNmZm
11
- ZjRmOGJhNjJkOTc0YTMxYjI2MjZiNWYzNGE5N2I4M2QwNmIwMDE=
9
+ Zjc4NjA0MWRkZmU5NzE1Y2VmODQ2YTk1OTkxZGY2M2U1ZWM4ODk4NGNlZDNm
10
+ MWJmODk5YmI0MTFmNmFiOWVhMjBiMjE4M2E0MDNlODZmN2U5MzA4YjIwNTM0
11
+ Mjk2NmRmNGEzMTkzY2JlZjBiMjVjZjg5N2MyMmNjYTY0ODJkOTg=
12
12
  data.tar.gz: !binary |-
13
- YTllOWVkZTNiMGQ4ZWJkMTFiM2YzNzZkMmZkNjdlZjRlNzliZjhmNTlhYjVl
14
- N2M2YmIzYmJhNThmYzFmY2ZmZDVmMTI3ODc3MjY5MTNjYWMyODZkNjRiOGIx
15
- YWVjYjE0NDM2N2M5Mzk2YTZmMTcwZGI0NDg3YTNlN2Y4MTM0OTQ=
13
+ MWRiYmZlNGVkYTU2MjQyMzE0NzdhYzMxZmY1ZmQ3YjUzOWVlMjJmZTFhOTY0
14
+ NzQzZTM0NzA4MmNhOTMxNjlmNWRiYTA3ZTg3MWQ1NzE5ZjVhOWRkYTQ5MjUw
15
+ MWQ1NWU5MjdjZjNiNjFiNWFiNjE4N2I0Y2FlNTYxMzAyZmE3YmQ=
data/.gitignore CHANGED
@@ -5,6 +5,7 @@
5
5
  .vagrant
6
6
  .yardoc
7
7
  Gemfile.lock
8
+ gemfiles/*.lock
8
9
  InstalledFiles
9
10
  _yardoc
10
11
  coverage
data/.travis.yml CHANGED
@@ -2,4 +2,11 @@ language: ruby
2
2
  rvm:
3
3
  - 1.9.3
4
4
  - 2.0.0
5
+ - 2.1.0
6
+ script: "appraisal rake"
7
+ gemfile:
8
+ - Gemfile
9
+ - gemfiles/latest_stable.gemfile
10
+ - gemfiles/oldest_current.gemfile
11
+ - gemfiles/previous_release.gemfile
5
12
 
data/Appraisals ADDED
@@ -0,0 +1,14 @@
1
+ appraise "latest-stable" do
2
+ gem "vagrant", :git => 'git://github.com/mitchellh/vagrant.git', :branch => 'v1.4.2'
3
+ end
4
+
5
+ # Oldest (current release)
6
+ appraise "oldest-current" do
7
+ gem "vagrant", :git => 'git://github.com/mitchellh/vagrant.git', :branch => 'v1.4.0'
8
+ end
9
+
10
+ # Latest patch (previous release)
11
+ appraise "previous-release" do
12
+ gem "vagrant", :git => 'git://github.com/mitchellh/vagrant.git', :branch => 'v1.3.5'
13
+ end
14
+
data/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ # 0.1.5 (January 8, 2014)
2
+
3
+ IMPROVEMENTS:
4
+
5
+ - Fix Vagrant 1.4 compatibility and support multiple SSH keys [GH-58]
6
+ - Add uploaded keypair support [GH-53]
7
+ - Add ssh_run support, for vagrant ssh -c [GH-57]
8
+ - Requires fog 1.19 [GH-65]
9
+
10
+ BUG FIXES:
11
+
12
+ - Remove networks warning as vagrant-rackspace now supports networks [GH-64]
13
+
1
14
  # 0.1.4 (October 15, 2013)
2
15
 
3
16
  IMPROVEMENTS:
data/Gemfile CHANGED
@@ -2,10 +2,13 @@ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
+ gem "appraisal", "1.0.0.beta2"
6
+ gem "vagrant", :git => "git://github.com/mitchellh/vagrant.git"
7
+
5
8
  group :development do
6
9
  # We depend on Vagrant for development, but we don't add it as a
7
10
  # gem dependency because we expect to be installed within the
8
11
  # Vagrant environment itself using `vagrant plugin`.
9
- gem "vagrant", :git => "git://github.com/mitchellh/vagrant.git"
10
12
  gem 'coveralls', require: false
11
13
  end
14
+
data/README.md CHANGED
@@ -30,6 +30,16 @@ $ vagrant up --provider=rackspace
30
30
  Of course prior to doing this, you'll need to obtain an Rackspace-compatible
31
31
  box file for Vagrant.
32
32
 
33
+ ### CentOS / RHEL (sudo: sorry, you must have a tty to run sudo)
34
+
35
+ The default configuration of the RHEL family of Linux distributions requires a tty in order to run sudo. Vagrant does not connect with a tty by default, so you may experience the error:
36
+ > sudo: sorry, you must have a tty to run sudo
37
+
38
+ The best way to take deal with this error is to upgrade to Vagrant 1.4 or later, and enable:
39
+ ```
40
+ config.ssh.pty = true
41
+ ```
42
+
33
43
  ## Quick Start
34
44
 
35
45
  After installing the plugin (instructions above), the quickest way to get
@@ -99,6 +109,8 @@ vagrant will authenticate against the UK authentication endpoint.
99
109
  * `public_key_path` - The path to a public key to initialize with the remote
100
110
  server. This should be the matching pair for the private key configured
101
111
  with `config.ssh.private_key_path` on Vagrant.
112
+ * `key_name` - If a public key has been [uploaded to the account already](http://docs.rackspace.com/servers/api/v2/cs-devguide/content/ServersKeyPairs-d1e2545.html), the uploaded key can be used to initialize the remote server by providing its name. The uploaded public key should be the matching pair for the private key configured
113
+ with `config.ssh.private_key_path` on Vagrant.
102
114
  * `server_name` - The name of the server within RackSpace Cloud. This
103
115
  defaults to the name of the Vagrant machine (via `config.vm.define`), but
104
116
  can be overridden with this.
@@ -14,15 +14,14 @@ Feature: vagrant-rackspace fog tests
14
14
 
15
15
  config.vm.box = "dummy"
16
16
  config.ssh.private_key_path = "~/.ssh/id_rsa"
17
- config.ssh.max_tries = 1
18
- config.ssh.timeout = 10
17
+
19
18
 
20
19
  config.vm.provider :rackspace do |rs|
21
20
  rs.server_name = 'vagrant-provisioned-server'
22
21
  rs.username = ENV['RAX_USERNAME']
23
22
  rs.api_key = ENV['RAX_API_KEY']
24
23
  rs.rackspace_region = ENV['RAX_REGION'].downcase.to_sym
25
- rs.flavor = /512MB/
24
+ rs.flavor = /1 GB Performance/
26
25
  rs.image = /Ubuntu/
27
26
  rs.public_key_path = "~/.ssh/id_rsa.pub"
28
27
  end
@@ -22,15 +22,13 @@ Feature: vagrant-rackspace fog tests
22
22
  config.vm.box = "dummy"
23
23
  config.ssh.username = "vagrant" if Fog.mock?
24
24
  config.ssh.private_key_path = "~/.ssh/id_rsa" unless Fog.mock?
25
- config.ssh.max_tries = 1
26
- config.ssh.timeout = 10
27
25
 
28
26
  config.vm.provider :rackspace do |rs|
29
27
  rs.server_name = 'vagrant-single-server'
30
28
  rs.username = ENV['RAX_USERNAME']
31
29
  rs.api_key = ENV['RAX_API_KEY']
32
30
  rs.rackspace_region = ENV['RAX_REGION'].downcase.to_sym
33
- rs.flavor = /512MB/
31
+ rs.flavor = /1 GB Performance/
34
32
  rs.image = /Ubuntu/
35
33
  rs.public_key_path = "~/.ssh/id_rsa.pub" unless Fog.mock?
36
34
  end
@@ -41,7 +39,7 @@ Feature: vagrant-rackspace fog tests
41
39
  # And I get the server from "Instance ID:"
42
40
  Then the server "vagrant-single-server" should be active
43
41
 
44
- Scenario: Create a single server (compute_url)
42
+ Scenario: Create a single server (rackspace_compute_url)
45
43
  Given a file named "Vagrantfile" with:
46
44
  """
47
45
  # Testing options
@@ -54,15 +52,13 @@ Scenario: Create a single server (compute_url)
54
52
  config.vm.box = "dummy"
55
53
  config.ssh.username = "vagrant" if Fog.mock?
56
54
  config.ssh.private_key_path = "~/.ssh/id_rsa" unless Fog.mock?
57
- config.ssh.max_tries = 1
58
- config.ssh.timeout = 10
59
55
 
60
56
  config.vm.provider :rackspace do |rs|
61
57
  rs.server_name = 'vagrant-single-server'
62
58
  rs.username = ENV['RAX_USERNAME']
63
59
  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/
60
+ rs.rackspace_compute_url = "https://#{ENV['RAX_REGION'].downcase}.servers.api.rackspacecloud.com/v2"
61
+ rs.flavor = /1 GB Performance/
66
62
  rs.image = /Ubuntu/
67
63
  rs.public_key_path = "~/.ssh/id_rsa.pub" unless Fog.mock?
68
64
  end
@@ -0,0 +1,12 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal", "1.0.0.beta2"
6
+ gem "vagrant", :git=>"git://github.com/mitchellh/vagrant.git", :branch=>"v1.4.2"
7
+
8
+ group :development do
9
+ gem "coveralls", :require=>false
10
+ end
11
+
12
+ gemspec :path=>".././"
@@ -0,0 +1,12 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal", "1.0.0.beta2"
6
+ gem "vagrant", :git=>"git://github.com/mitchellh/vagrant.git", :branch=>"v1.4.0"
7
+
8
+ group :development do
9
+ gem "coveralls", :require=>false
10
+ end
11
+
12
+ gemspec :path=>".././"
@@ -0,0 +1,12 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal", "1.0.0.beta2"
6
+ gem "vagrant", :git=>"git://github.com/mitchellh/vagrant.git", :branch=>"v1.3.5"
7
+
8
+ group :development do
9
+ gem "coveralls", :require=>false
10
+ end
11
+
12
+ gemspec :path=>".././"
@@ -32,12 +32,15 @@ module VagrantPlugins
32
32
  # Figure out the name for the server
33
33
  server_name = config.server_name || env[:machine].name
34
34
 
35
- # If we're using the default keypair, then show a warning
36
- default_key_path = Vagrant.source_root.join("keys/vagrant.pub").to_s
37
- public_key_path = File.expand_path(config.public_key_path, env[:root_path])
38
-
39
- if default_key_path == public_key_path
40
- env[:ui].warn(I18n.t("vagrant_rackspace.warn_insecure_ssh"))
35
+ # If we are using a key name, can ignore the public key path
36
+ if not config.key_name
37
+ # If we're using the default keypair, then show a warning
38
+ default_key_path = Vagrant.source_root.join("keys/vagrant.pub").to_s
39
+ public_key_path = File.expand_path(config.public_key_path, env[:root_path])
40
+
41
+ if default_key_path == public_key_path
42
+ env[:ui].warn(I18n.t("vagrant_rackspace.warn_insecure_ssh"))
43
+ end
41
44
  end
42
45
 
43
46
  # Output the settings we're going to use to the user
@@ -52,14 +55,21 @@ module VagrantPlugins
52
55
  options = {
53
56
  :flavor_id => flavor.id,
54
57
  :image_id => image.id,
55
- :name => server_name,
56
- :personality => [
58
+ :name => server_name
59
+ }
60
+
61
+ if config.key_name
62
+ options[:keypair] = config.key_name
63
+ env[:ui].info(" -- Key Name: #{config.key_name}")
64
+ else
65
+ options[:personality] = [
57
66
  {
58
67
  :path => "/root/.ssh/authorized_keys",
59
68
  :contents => Base64.encode64(File.read(public_key_path))
60
69
  }
61
70
  ]
62
- }
71
+ end
72
+
63
73
  options[:disk_config] = config.disk_config if config.disk_config
64
74
  options[:networks] = config.networks if config.networks
65
75
 
@@ -48,7 +48,7 @@ module VagrantPlugins
48
48
  "rsync", "--verbose", "--archive", "-z",
49
49
  "--cvs-exclude",
50
50
  "--exclude", ".hg/",
51
- "-e", "ssh -p #{ssh_info[:port]} -i '#{ssh_info[:private_key_path]}' -o StrictHostKeyChecking=no",
51
+ "-e", "ssh -p #{ssh_info[:port]} -o StrictHostKeyChecking=no #{ssh_key_options(ssh_info)}",
52
52
  hostpath,
53
53
  "#{ssh_info[:username]}@#{ssh_info[:host]}:#{guestpath}"]
54
54
 
@@ -71,6 +71,13 @@ module VagrantPlugins
71
71
  end
72
72
  end
73
73
  end
74
+
75
+ private
76
+
77
+ def ssh_key_options(ssh_info)
78
+ # Ensure that `private_key_path` is an Array (for Vagrant < 1.4)
79
+ Array(ssh_info[:private_key_path]).map { |path| "-i '#{path}' " }.join
80
+ end
74
81
  end
75
82
  end
76
83
  end
@@ -76,6 +76,20 @@ module VagrantPlugins
76
76
  end
77
77
  end
78
78
 
79
+ def self.action_ssh_run
80
+ Vagrant::Action::Builder.new.tap do |b|
81
+ b.use ConfigValidate
82
+ b.use Call, IsCreated do |env, b2|
83
+ if !env[:result]
84
+ b2.use MessageNotCreated
85
+ next
86
+ end
87
+
88
+ b2.use SSHRun
89
+ end
90
+ end
91
+ end
92
+
79
93
  def self.action_up
80
94
  Vagrant::Action::Builder.new.tap do |b|
81
95
  b.use ConfigValidate
@@ -88,7 +102,6 @@ module VagrantPlugins
88
102
  b2.use ConnectRackspace
89
103
  b2.use Provision
90
104
  b2.use SyncFolders
91
- b2.use WarnNetworks
92
105
  b2.use CreateServer
93
106
  end
94
107
  end
@@ -105,7 +118,6 @@ module VagrantPlugins
105
118
  autoload :ReadSSHInfo, action_root.join("read_ssh_info")
106
119
  autoload :ReadState, action_root.join("read_state")
107
120
  autoload :SyncFolders, action_root.join("sync_folders")
108
- autoload :WarnNetworks, action_root.join("warn_networks")
109
121
  end
110
122
  end
111
123
  end
@@ -22,7 +22,7 @@ module VagrantPlugins
22
22
  # to DFW.
23
23
  # (formerly know as 'endpoint')
24
24
  #
25
- # expected to be a string url -
25
+ # expected to be a string url -
26
26
  # 'https://dfw.servers.api.rackspacecloud.com/v2'
27
27
  # 'https://ord.servers.api.rackspacecloud.com/v2'
28
28
  # 'https://lon.servers.api.rackspacecloud.com/v2'
@@ -54,6 +54,12 @@ module VagrantPlugins
54
54
  # @return [String]
55
55
  attr_accessor :public_key_path
56
56
 
57
+ # Alternately, if a keypair were already uploaded to Rackspace,
58
+ # the key name could be provided.
59
+ #
60
+ # @return [String]
61
+ attr_accessor :key_name
62
+
57
63
  # The option that indicates RackConnect usage or not.
58
64
  #
59
65
  # @return [Boolean]
@@ -154,10 +160,11 @@ module VagrantPlugins
154
160
  end
155
161
 
156
162
  def validate(machine)
157
- errors = []
163
+ errors = _detected_errors
158
164
 
159
165
  errors << I18n.t("vagrant_rackspace.config.api_key_required") if !@api_key
160
166
  errors << I18n.t("vagrant_rackspace.config.username_required") if !@username
167
+ errors << I18n.t("one of vagrant.rackspace.config.key_name or vagrant.rackspace.config.public_key_path required") if !@key_name && !@public_key_path
161
168
 
162
169
  {
163
170
  :rackspace_compute_url => @rackspace_compute_url,
@@ -166,9 +173,11 @@ module VagrantPlugins
166
173
  errors << I18n.t("vagrant_rackspace.config.invalid_uri", :key => key, :uri => value) unless value.nil? || valid_uri?(value)
167
174
  end
168
175
 
169
- public_key_path = File.expand_path(@public_key_path, machine.env.root_path)
170
- if !File.file?(public_key_path)
171
- errors << I18n.t("vagrant_rackspace.config.public_key_not_found")
176
+ if !@key_name
177
+ public_key_path = File.expand_path(@public_key_path, machine.env.root_path)
178
+ if !File.file?(public_key_path)
179
+ errors << I18n.t("vagrant_rackspace.config.public_key_not_found")
180
+ end
172
181
  end
173
182
 
174
183
  { "RackSpace Provider" => errors }
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module Rackspace
3
- VERSION = "0.1.4"
3
+ VERSION = "0.1.5"
4
4
  end
5
5
  end
@@ -81,6 +81,16 @@ describe VagrantPlugins::Rackspace::Config do
81
81
  end
82
82
  end
83
83
 
84
+ context "with invalid key" do
85
+ it "should raise an error" do
86
+ subject.nonsense1 = true
87
+ subject.nonsense2 = false
88
+ I18n.should_receive(:t).with('vagrant.config.common.bad_field',
89
+ { :fields => 'nonsense1, nonsense2' })
90
+ .and_return error_message
91
+ validation_errors.first.should == error_message
92
+ end
93
+ end
84
94
  context "with good values" do
85
95
  it "should validate" do
86
96
  validation_errors.should be_empty
@@ -12,7 +12,7 @@ Gem::Specification.new do |gem|
12
12
  gem.summary = "Enables Vagrant to manage machines in RackSpace Cloud."
13
13
  gem.homepage = "http://www.vagrantup.com"
14
14
 
15
- gem.add_runtime_dependency "fog", "~> 1.15.0"
15
+ gem.add_runtime_dependency "fog", "~> 1.19"
16
16
 
17
17
  gem.add_development_dependency "rake"
18
18
  gem.add_development_dependency "rspec", "~> 2.13.0"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-rackspace
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mitchell Hashimoto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-15 00:00:00.000000000 Z
11
+ date: 2014-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fog
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: 1.15.0
19
+ version: '1.19'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ~>
25
25
  - !ruby/object:Gem::Version
26
- version: 1.15.0
26
+ version: '1.19'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -75,6 +75,7 @@ extra_rdoc_files: []
75
75
  files:
76
76
  - .gitignore
77
77
  - .travis.yml
78
+ - Appraisals
78
79
  - CHANGELOG.md
79
80
  - Gemfile
80
81
  - LICENSE.txt
@@ -90,6 +91,9 @@ files:
90
91
  - features/support/env.rb
91
92
  - features/support/fog_mock.rb
92
93
  - features/vagrant-rackspace.feature
94
+ - gemfiles/latest_stable.gemfile
95
+ - gemfiles/oldest_current.gemfile
96
+ - gemfiles/previous_release.gemfile
93
97
  - lib/vagrant-rackspace.rb
94
98
  - lib/vagrant-rackspace/action.rb
95
99
  - lib/vagrant-rackspace/action/connect_rackspace.rb
@@ -101,7 +105,6 @@ files:
101
105
  - lib/vagrant-rackspace/action/read_ssh_info.rb
102
106
  - lib/vagrant-rackspace/action/read_state.rb
103
107
  - lib/vagrant-rackspace/action/sync_folders.rb
104
- - lib/vagrant-rackspace/action/warn_networks.rb
105
108
  - lib/vagrant-rackspace/config.rb
106
109
  - lib/vagrant-rackspace/errors.rb
107
110
  - lib/vagrant-rackspace/plugin.rb
@@ -1,19 +0,0 @@
1
- module VagrantPlugins
2
- module Rackspace
3
- module Action
4
- class WarnNetworks
5
- def initialize(app, env)
6
- @app = app
7
- end
8
-
9
- def call(env)
10
- if env[:machine].config.vm.networks.length > 0
11
- env[:ui].warn(I18n.t("vagrant_rackspace.warn_networks"))
12
- end
13
-
14
- @app.call(env)
15
- end
16
- end
17
- end
18
- end
19
- end