vagrant-digitalocean 0.2.4 → 0.3.0

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.
data/Gemfile CHANGED
@@ -1,5 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'vagrant', :git => 'git://github.com/mitchellh/vagrant.git', :tag => 'v1.2.2'
3
+ gem 'vagrant', :git => 'git://github.com/mitchellh/vagrant.git', :tag => 'v1.2.7'
4
4
  gem 'vagrant-omnibus'
5
+ gem 'rake'
5
6
  gemspec
data/README.md CHANGED
@@ -7,10 +7,7 @@ management of [Digital Ocean](https://www.digitalocean.com/) droplets
7
7
  **NOTE:** The Chef provisioner is no longer supported by default (as of 0.2.0).
8
8
  Please use the `vagrant-omnibus` plugin to install Chef on Vagrant-managed
9
9
  machines. This plugin provides control over the specific version of Chef
10
- to install. The custom `rebuild` command will not work until a
11
- [pull request](https://github.com/schisamo/vagrant-omnibus/pull/21)
12
- is accepted within the `vagrant-omnibus` project. I will update the README
13
- when this is completed.
10
+ to install.
14
11
 
15
12
  Current features include:
16
13
  - create and destroy droplets
@@ -20,7 +17,7 @@ Current features include:
20
17
  - setup a SSH public key for authentication
21
18
  - create a new user account during droplet creation
22
19
 
23
- The provider has been tested with Vagrant 1.1.5 using Ubuntu 12.04 and
20
+ The provider has been tested with Vagrant 1.1.5+ using Ubuntu 12.04 and
24
21
  CentOS 6.3 guest operating systems.
25
22
 
26
23
  Install
@@ -73,9 +70,6 @@ Please note the following:
73
70
  extension.
74
71
  - You *must* specify your Digital Ocean Client and API keys. These may be
75
72
  found on the control panel within the *My Settings > API Access* section.
76
- - The Chef provisioner is installed via the
77
- [`vagrant-omnibus` plugin](https://github.com/schisamo/vagrant-omnibus).
78
- Please see its documentation for details.
79
73
 
80
74
  **Supported Configuration Attributes**
81
75
 
@@ -83,24 +77,21 @@ The following attributes are available to further configure the provider:
83
77
  - `provider.image` - A string representing the image to use when creating a
84
78
  new droplet (e.g. `Debian 6.0 x64`). The available options may
85
79
  be found on Digital Ocean's new droplet [form](https://www.digitalocean.com/droplets/new).
86
- It defaults to `Ubuntu 12.04 x64 Server`.
80
+ It defaults to `Ubuntu 12.04 x64`.
87
81
  - `provider.region` - A string representing the region to create the new
88
- droplet in. The available options are `New York 1` and `Amsterdam 1`. It
89
- defaults to `New York 1`.
82
+ droplet in. It defaults to `New York 2`.
90
83
  - `provider.size` - A string representing the size to use when creating a
91
84
  new droplet (e.g. `1GB`). It defaults to `512MB`.
92
- - `provider.ssh_key_name` - A String representing the name to use when creating
85
+ - `provider.ssh_key_name` - A string representing the name to use when creating
93
86
  a Digital Ocean SSH key for droplet authentication. It defaults to `Vagrant`.
94
-
95
- By default, the provider will create a new user account, `vagrant`, and setup
96
- the specified SSH key for authentication. To change the user, set
97
- `config.ssh.username` to the name of the account to create. When Vagrant 1.2 is
98
- released, a new user account will only be created if `config.ssh.username` is
99
- set.
100
-
101
- *NOTE:* For those using a 0.0.x version of the provider,
102
- `provider.ssh_username` and `provider.ssh_private_key_path` have been removed
103
- in favor of the configuration options above.
87
+ - `provider.setup` - A boolean flag indicating whether to setup a new user
88
+ account and modify sudo to disable tty requirement. It defaults to `true`.
89
+ If you are using a tool like [packer](https://packer.io) to create
90
+ reusable snapshots with user accounts already provisioned, set to `false`.
91
+
92
+ The provider will create a new user account with the specified SSH key for
93
+ authorization if `config.ssh.username` is set and the `provider.setup`
94
+ attribute is `true`.
104
95
 
105
96
  Run
106
97
  ---
@@ -51,13 +51,16 @@ module VagrantPlugins
51
51
  :ip => droplet['ip_address']
52
52
  })
53
53
 
54
- # wait for ssh to be ready using the root user account
54
+ # wait for ssh to be ready
55
+ switch_user = @machine.provider_config.setup?
55
56
  user = @machine.config.ssh.username
56
- @machine.config.ssh.username = 'root'
57
+ @machine.config.ssh.username = 'root' if switch_user
58
+
57
59
  retryable(:tries => 120, :sleep => 10) do
58
60
  next if env[:interrupted]
59
61
  raise 'not ready' if !@machine.communicate.ready?
60
62
  end
63
+
61
64
  @machine.config.ssh.username = user
62
65
 
63
66
  @app.call(env)
@@ -9,7 +9,10 @@ module VagrantPlugins
9
9
  end
10
10
 
11
11
  def call(env)
12
- # override ssh username to root temporarily
12
+ # check if setup is enabled
13
+ return @app.call(env) unless @machine.provider_config.setup?
14
+
15
+ # override ssh username to root
13
16
  user = @machine.config.ssh.username
14
17
  @machine.config.ssh.username = 'root'
15
18
 
@@ -9,8 +9,11 @@ module VagrantPlugins
9
9
  end
10
10
 
11
11
  def call(env)
12
+ # check if setup is enabled
13
+ return @app.call(env) unless @machine.provider_config.setup?
14
+
12
15
  # check if a username has been specified
13
- return @app.call(env) if !@machine.config.ssh.username
16
+ return @app.call(env) unless @machine.config.ssh.username
14
17
 
15
18
  # override ssh username to root temporarily
16
19
  user = @machine.config.ssh.username
@@ -8,6 +8,9 @@ module VagrantPlugins
8
8
  attr_accessor :size
9
9
  attr_accessor :ca_path
10
10
  attr_accessor :ssh_key_name
11
+ attr_accessor :setup
12
+
13
+ alias_method :setup?, :setup
11
14
 
12
15
  def initialize
13
16
  @client_id = UNSET_VALUE
@@ -17,6 +20,7 @@ module VagrantPlugins
17
20
  @size = UNSET_VALUE
18
21
  @ca_path = UNSET_VALUE
19
22
  @ssh_key_name = UNSET_VALUE
23
+ @setup = UNSET_VALUE
20
24
  end
21
25
 
22
26
  def finalize!
@@ -27,6 +31,7 @@ module VagrantPlugins
27
31
  @size = '512MB' if @size == UNSET_VALUE
28
32
  @ca_path = nil if @ca_path == UNSET_VALUE
29
33
  @ssh_key_name = 'Vagrant' if @ssh_key_name == UNSET_VALUE
34
+ @setup = true if @setup == UNSET_VALUE
30
35
  end
31
36
 
32
37
  def validate(machine)
@@ -79,11 +79,10 @@ module VagrantPlugins
79
79
 
80
80
  return nil if droplet['status'].to_sym != :active
81
81
 
82
- # TODO remove config.ssh.username reference when Vagrant 1.2 is released
83
82
  return {
84
83
  :host => droplet['ip_address'],
85
84
  :port => '22',
86
- :username => @machine.config.ssh.username || 'root',
85
+ :username => 'root',
87
86
  :private_key_path => nil
88
87
  }
89
88
  end
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module DigitalOcean
3
- VERSION = '0.2.4'
3
+ VERSION = '0.3.0'
4
4
  end
5
5
  end
data/test/Vagrantfile CHANGED
@@ -4,18 +4,16 @@ Vagrant.require_plugin('vagrant-omnibus')
4
4
  Vagrant.configure('2') do |config|
5
5
  config.omnibus.chef_version = :latest
6
6
 
7
- config.vm.box = 'digital_ocean'
8
-
9
7
  config.ssh.username = 'tester'
10
8
  config.ssh.private_key_path = 'test_id_rsa'
11
9
 
12
10
  config.vm.synced_folder '.', '/vagrant', :disabled => true
13
11
 
14
- config.vm.provider :digital_ocean do |provider|
12
+ config.vm.provider :digital_ocean do |provider, override|
13
+ override.vm.box = 'digital_ocean'
14
+ override.vm.box_url = "https://github.com/smdahlen/vagrant-digitalocean/raw/master/box/digital_ocean.box"
15
15
  provider.client_id = ENV['DO_CLIENT_ID']
16
16
  provider.api_key = ENV['DO_API_KEY']
17
- provider.region = 'New York 1'
18
- provider.size = '512MB'
19
17
  provider.ssh_key_name = 'Test Key'
20
18
  end
21
19
 
@@ -28,7 +26,7 @@ Vagrant.configure('2') do |config|
28
26
 
29
27
  config.vm.define :ubuntu do |ubuntu|
30
28
  ubuntu.vm.provider :digital_ocean do |provider|
31
- provider.image = 'Ubuntu 12.04 x64 Server'
29
+ provider.image = 'Ubuntu 12.04 x64'
32
30
  end
33
31
  end
34
32
 
data/test/test.sh CHANGED
@@ -1,6 +1,6 @@
1
- if ! vagrant box list | grep digital_ocean 1>/dev/null; then
2
- vagrant box add digital_ocean box/digital_ocean.box
3
- fi
1
+ # if ! vagrant box list | grep digital_ocean 1>/dev/null; then
2
+ # vagrant box add digital_ocean box/digital_ocean.box
3
+ # fi
4
4
 
5
5
  cd test
6
6
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-digitalocean
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-08-19 00:00:00.000000000 Z
12
+ date: 2013-08-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday
16
- requirement: !ruby/object:Gem::Requirement
16
+ requirement: &17944820 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,15 +21,10 @@ dependencies:
21
21
  version: 0.8.6
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ~>
28
- - !ruby/object:Gem::Version
29
- version: 0.8.6
24
+ version_requirements: *17944820
30
25
  - !ruby/object:Gem::Dependency
31
26
  name: json
32
- requirement: !ruby/object:Gem::Requirement
27
+ requirement: &17944260 !ruby/object:Gem::Requirement
33
28
  none: false
34
29
  requirements:
35
30
  - - ! '>='
@@ -37,15 +32,10 @@ dependencies:
37
32
  version: '0'
38
33
  type: :runtime
39
34
  prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
45
- version: '0'
35
+ version_requirements: *17944260
46
36
  - !ruby/object:Gem::Dependency
47
37
  name: log4r
48
- requirement: !ruby/object:Gem::Requirement
38
+ requirement: &17943140 !ruby/object:Gem::Requirement
49
39
  none: false
50
40
  requirements:
51
41
  - - ! '>='
@@ -53,12 +43,7 @@ dependencies:
53
43
  version: '0'
54
44
  type: :runtime
55
45
  prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - ! '>='
60
- - !ruby/object:Gem::Version
61
- version: '0'
46
+ version_requirements: *17943140
62
47
  description: Enables Vagrant to manage Digital Ocean droplets
63
48
  email:
64
49
  - john.m.bender@gmail.com
@@ -123,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
108
  version: '0'
124
109
  requirements: []
125
110
  rubyforge_project:
126
- rubygems_version: 1.8.23
111
+ rubygems_version: 1.8.11
127
112
  signing_key:
128
113
  specification_version: 3
129
114
  summary: Enables Vagrant to manage Digital Ocean droplets