vagrant-digitalocean 0.7.7 → 0.7.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +18 -12
- data/lib/vagrant-digitalocean/actions.rb +6 -1
- data/lib/vagrant-digitalocean/actions/rebuild.rb +1 -5
- data/lib/vagrant-digitalocean/actions/shut_down.rb +33 -0
- data/lib/vagrant-digitalocean/commands/list.rb +1 -1
- data/lib/vagrant-digitalocean/commands/rebuild.rb +6 -0
- data/lib/vagrant-digitalocean/config.rb +1 -1
- data/lib/vagrant-digitalocean/provider.rb +1 -1
- data/lib/vagrant-digitalocean/version.rb +1 -1
- data/locales/en.yml +6 -5
- data/vagrant-digitalocean.gemspec +3 -3
- metadata +7 -5
- data/CHANGELOG.md +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7712f3d6c24ad17b4036e94c73407efc36d8f1e
|
4
|
+
data.tar.gz: 97936d9df0dd3fc5b25c1d35d86143d0c757e774
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30fabe81907e9ecc94198cbb2bb397cb66408eaf3700b8f2cfa8e2564e845903671f0aada4771024c71f967a2c4c53a418ae915d4d18e773d248254e0be13433
|
7
|
+
data.tar.gz: cc3d5a10e27a06aee9f86c837329ff5d86c98dbee8976bebb8508dd316224da662b336d6b8d2bde0deaf98b44859d6a650ee03d004ae1af67d69d88954550667
|
data/README.md
CHANGED
@@ -1,6 +1,11 @@
|
|
1
|
-
|
1
|
+
DigitalOcean Vagrant Provider
|
2
2
|
==============================
|
3
|
-
|
3
|
+
|
4
|
+
[![Gem](https://img.shields.io/gem/dt/vagrant-digitalocean.svg)](https://rubygems.org/gems/vagrant-digitalocean)
|
5
|
+
[![Gem](https://img.shields.io/gem/dtv/vagrant-digitalocean.svg)](https://rubygems.org/gems/vagrant-digitalocean)
|
6
|
+
[![Twitter](https://img.shields.io/twitter/url/https/github.com/smdahlen/vagrant-digitalocean.svg?style=social)](https://twitter.com/intent/tweet?text=Check%20out%20this%20awesome%20Vagrant%20plugin%21&url=https%3A%2F%2Fgithub.com%2Fsmdahlen%2Fvagrant-digitalocean&hashtags=vagrant%2Cdigitalocean&original_referer=)
|
7
|
+
|
8
|
+
`vagrant-digitalocean` is a provider plugin for Vagrant that supports the management of [DigitalOcean](https://www.digitalocean.com/) droplets (instances).
|
4
9
|
|
5
10
|
Features include:
|
6
11
|
- create and destroy droplets
|
@@ -22,7 +27,7 @@ Install the provider plugin using the Vagrant command-line interface:
|
|
22
27
|
|
23
28
|
Configure
|
24
29
|
---------
|
25
|
-
Once the provider has been installed, you will need to configure your project to use it. The most basic `Vagrantfile` to create a droplet on
|
30
|
+
Once the provider has been installed, you will need to configure your project to use it. The most basic `Vagrantfile` to create a droplet on DigitalOcean is shown below:
|
26
31
|
|
27
32
|
```ruby
|
28
33
|
Vagrant.configure('2') do |config|
|
@@ -41,27 +46,27 @@ end
|
|
41
46
|
```
|
42
47
|
|
43
48
|
**Configuration Requirements**
|
44
|
-
- You *must* specify the `override.ssh.private_key_path` to enable authentication with the droplet. The provider will create a new
|
45
|
-
- You *must* specify your
|
49
|
+
- You *must* specify the `override.ssh.private_key_path` to enable authentication with the droplet. The provider will create a new DigitalOcean SSH key using your public key which is assumed to be the `private_key_path` with a *.pub* extension.
|
50
|
+
- You *must* specify your DigitalOcean Personal Access Token at `provider.token`. This may be found on the control panel within the *Apps & API* section.
|
46
51
|
|
47
52
|
**Supported Configuration Attributes**
|
48
53
|
|
49
54
|
The following attributes are available to further configure the provider:
|
50
55
|
- `provider.image`
|
51
56
|
* A string representing the image to use when creating a new droplet. It defaults to `ubuntu-14-04-x64`.
|
52
|
-
List available images with the `digitalocean-list images $DIGITAL_OCEAN_TOKEN` command. Like when using the DigitalOcean API directly, [it can be an image ID or slug](https://developers.digitalocean.com/documentation/v2/#create-a-new-droplet).
|
57
|
+
List available images with the `vagrant digitalocean-list images $DIGITAL_OCEAN_TOKEN` command. Like when using the DigitalOcean API directly, [it can be an image ID or slug](https://developers.digitalocean.com/documentation/v2/#create-a-new-droplet).
|
53
58
|
- `provider.ipv6`
|
54
59
|
* A boolean flag indicating whether to enable IPv6
|
55
60
|
- `provider.region`
|
56
|
-
* A string representing the region to create the new droplet in. It defaults to `nyc2`. List available regions with the `digitalocean-list regions $DIGITAL_OCEAN_TOKEN` command.
|
61
|
+
* A string representing the region to create the new droplet in. It defaults to `nyc2`. List available regions with the `vagrant digitalocean-list regions $DIGITAL_OCEAN_TOKEN` command.
|
57
62
|
- `provider.size`
|
58
|
-
* A string representing the size to use when creating a new droplet (e.g. `1gb`). It defaults to `512mb`. List available sizes with the `digitalocean-list sizes $DIGITAL_OCEAN_TOKEN` command.
|
63
|
+
* A string representing the size to use when creating a new droplet (e.g. `1gb`). It defaults to `512mb`. List available sizes with the `vagrant digitalocean-list sizes $DIGITAL_OCEAN_TOKEN` command.
|
59
64
|
- `provider.private_networking`
|
60
65
|
* A boolean flag indicating whether to enable a private network interface (if the region supports private networking). It defaults to `false`.
|
61
66
|
- `provider.backups_enabled`
|
62
67
|
* A boolean flag indicating whether to enable backups for the droplet. It defaults to `false`.
|
63
68
|
- `provider.ssh_key_name`
|
64
|
-
* A string representing the name to use when creating a
|
69
|
+
* A string representing the name to use when creating a DigitalOcean SSH key for droplet authentication. It defaults to `Vagrant`.
|
65
70
|
- `provider.setup`
|
66
71
|
* A boolean flag indicating whether to setup a new user account and modify sudo to disable tty requirement. It defaults to `true`. If you are using a tool like [Packer](https://packer.io) to create reusable snapshots with user accounts already provisioned, set to `false`.
|
67
72
|
- `config.vm.synced_folder`
|
@@ -129,9 +134,10 @@ To release a new version of vagrant-digitalocean you will need to do the followi
|
|
129
134
|
|
130
135
|
*(only contributors of the GitHub repo and owners of the project at RubyGems will have rights to do this)*
|
131
136
|
|
132
|
-
1. First,
|
133
|
-
*
|
134
|
-
2. Then, create a
|
137
|
+
1. First, bump the version in ~/lib/vagrant-digitalocean/version.rb:
|
138
|
+
* Follow [Semantic Versioning](http://semver.org/).
|
139
|
+
2. Then, create a matching GitHub Release (this will also create a tag):
|
140
|
+
* Preface the version number with a `v`.
|
135
141
|
* https://github.com/smdahlen/vagrant-digitalocean/releases
|
136
142
|
3. You will then need to build and push the new gem to RubyGems:
|
137
143
|
* `rake gem:build`
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'vagrant-digitalocean/actions/check_state'
|
2
2
|
require 'vagrant-digitalocean/actions/create'
|
3
3
|
require 'vagrant-digitalocean/actions/destroy'
|
4
|
+
require 'vagrant-digitalocean/actions/shut_down'
|
4
5
|
require 'vagrant-digitalocean/actions/power_off'
|
5
6
|
require 'vagrant-digitalocean/actions/power_on'
|
6
7
|
require 'vagrant-digitalocean/actions/rebuild'
|
@@ -112,7 +113,11 @@ module VagrantPlugins
|
|
112
113
|
builder.use Call, CheckState do |env, b|
|
113
114
|
case env[:machine_state]
|
114
115
|
when :active
|
115
|
-
|
116
|
+
if env[:force_halt]
|
117
|
+
b.use PowerOff
|
118
|
+
else
|
119
|
+
b.use ShutDown
|
120
|
+
end
|
116
121
|
when :off
|
117
122
|
env[:ui].info I18n.t('vagrant_digital_ocean.info.already_off')
|
118
123
|
when :not_created
|
@@ -15,15 +15,11 @@ module VagrantPlugins
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def call(env)
|
18
|
-
# look up image id
|
19
|
-
image_id = @client
|
20
|
-
.request('/v2/images')
|
21
|
-
.find_id(:images, :slug => @machine.provider_config.image)
|
22
18
|
|
23
19
|
# submit rebuild request
|
24
20
|
result = @client.post("/v2/droplets/#{@machine.id}/actions", {
|
25
21
|
:type => 'rebuild',
|
26
|
-
:image =>
|
22
|
+
:image => @machine.provider_config.image
|
27
23
|
})
|
28
24
|
|
29
25
|
# wait for request to complete
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'vagrant-digitalocean/helpers/client'
|
2
|
+
|
3
|
+
module VagrantPlugins
|
4
|
+
module DigitalOcean
|
5
|
+
module Actions
|
6
|
+
class ShutDown
|
7
|
+
include Helpers::Client
|
8
|
+
|
9
|
+
def initialize(app, env)
|
10
|
+
@app = app
|
11
|
+
@machine = env[:machine]
|
12
|
+
@client = client
|
13
|
+
@logger = Log4r::Logger.new('vagrant::digitalocean::shut_down')
|
14
|
+
end
|
15
|
+
|
16
|
+
def call(env)
|
17
|
+
# submit shutdown droplet request
|
18
|
+
result = @client.request("/droplets/#{@machine.id}/shutdown")
|
19
|
+
|
20
|
+
# wait for request to complete
|
21
|
+
env[:ui].info I18n.t('vagrant_digital_ocean.info.shutting_down')
|
22
|
+
@client.wait_for_event(env, result['event_id'])
|
23
|
+
|
24
|
+
# refresh droplet state with provider
|
25
|
+
Provider.droplet(@machine, :refresh => true)
|
26
|
+
|
27
|
+
@app.call(env)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
@@ -4,6 +4,12 @@ module VagrantPlugins
|
|
4
4
|
module DigitalOcean
|
5
5
|
module Commands
|
6
6
|
class Rebuild < Vagrant.plugin('2', :command)
|
7
|
+
|
8
|
+
# Show description when `vagrant list-commands` is triggered
|
9
|
+
def self.synopsis
|
10
|
+
"plugin: vagrant-digitalocean: destroys and ups the vm with the same ip address"
|
11
|
+
end
|
12
|
+
|
7
13
|
def execute
|
8
14
|
opts = OptionParser.new do |o|
|
9
15
|
o.banner = 'Usage: vagrant rebuild [vm-name]'
|
@@ -5,7 +5,7 @@ module VagrantPlugins
|
|
5
5
|
class Provider < Vagrant.plugin('2', :provider)
|
6
6
|
|
7
7
|
# This class method caches status for all droplets within
|
8
|
-
# the
|
8
|
+
# the DigitalOcean account. A specific droplet's status
|
9
9
|
# may be refreshed by passing :refresh => true as an option.
|
10
10
|
def self.droplet(machine, opts = {})
|
11
11
|
client = Helpers::ApiClient.new(machine)
|
data/locales/en.yml
CHANGED
@@ -9,6 +9,7 @@ en:
|
|
9
9
|
droplet_ip: "Assigned IP address: %{ip}"
|
10
10
|
droplet_private_ip: "Private IP address: %{ip}"
|
11
11
|
destroying: "Destroying the droplet..."
|
12
|
+
shutting_down: "Shutting down the droplet..."
|
12
13
|
powering_off: "Powering off the droplet..."
|
13
14
|
powering_on: "Powering on the droplet..."
|
14
15
|
rebuilding: "Rebuilding the droplet..."
|
@@ -24,7 +25,7 @@ en:
|
|
24
25
|
images_with_regions: "Description Slug ID Regions\n\n%{images}"
|
25
26
|
regions: "Description Slug\n\n%{regions}"
|
26
27
|
sizes: "Memory CPUs Slug\n\n%{sizes}"
|
27
|
-
list_error: 'Could not contact the
|
28
|
+
list_error: 'Could not contact the DigitalOcean API: %{message}'
|
28
29
|
config:
|
29
30
|
token: "Token is required"
|
30
31
|
private_key: "SSH private key path is required"
|
@@ -37,7 +38,7 @@ en:
|
|
37
38
|
|
38
39
|
Please check the file's permissions.
|
39
40
|
api_status: |-
|
40
|
-
There was an issue with the request made to the
|
41
|
+
There was an issue with the request made to the DigitalOcean
|
41
42
|
API at:
|
42
43
|
|
43
44
|
Path: %{path}
|
@@ -55,7 +56,7 @@ en:
|
|
55
56
|
Guest path: %{guestpath}
|
56
57
|
Error: %{stderr}
|
57
58
|
json: |-
|
58
|
-
There was an issue with the JSON response from the
|
59
|
+
There was an issue with the JSON response from the DigitalOcean
|
59
60
|
API at:
|
60
61
|
|
61
62
|
Path: %{path}
|
@@ -74,7 +75,7 @@ en:
|
|
74
75
|
|
75
76
|
Please ensure that the configured value exists in the collection.
|
76
77
|
certificate: |-
|
77
|
-
The secure connection to the
|
78
|
+
The secure connection to the DigitalOcean API has failed. Please
|
78
79
|
ensure that your local certificates directory is defined in the
|
79
80
|
provider config.
|
80
81
|
|
@@ -86,4 +87,4 @@ en:
|
|
86
87
|
with the Ruby install being unaware of the system specific ca
|
87
88
|
certs.
|
88
89
|
local_ip: |-
|
89
|
-
The
|
90
|
+
The DigitalOcean provider was unable to determine the host's IP.
|
@@ -6,9 +6,9 @@ require 'vagrant-digitalocean/version'
|
|
6
6
|
Gem::Specification.new do |gem|
|
7
7
|
gem.name = "vagrant-digitalocean"
|
8
8
|
gem.version = VagrantPlugins::DigitalOcean::VERSION
|
9
|
-
gem.authors = ["John Bender"]
|
10
|
-
gem.email = ["john.m.bender@gmail.com"]
|
11
|
-
gem.description = %q{Enables Vagrant to manage
|
9
|
+
gem.authors = ["John Bender","Seth Reeser"]
|
10
|
+
gem.email = ["john.m.bender@gmail.com","info@devopsgroup.io"]
|
11
|
+
gem.description = %q{Enables Vagrant to manage DigitalOcean droplets}
|
12
12
|
gem.summary = gem.description
|
13
13
|
|
14
14
|
gem.files = `git ls-files`.split($/)
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-digitalocean
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Bender
|
8
|
+
- Seth Reeser
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2015-07
|
12
|
+
date: 2015-10-07 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: faraday
|
@@ -52,15 +53,15 @@ dependencies:
|
|
52
53
|
- - ">="
|
53
54
|
- !ruby/object:Gem::Version
|
54
55
|
version: '0'
|
55
|
-
description: Enables Vagrant to manage
|
56
|
+
description: Enables Vagrant to manage DigitalOcean droplets
|
56
57
|
email:
|
57
58
|
- john.m.bender@gmail.com
|
59
|
+
- info@devopsgroup.io
|
58
60
|
executables: []
|
59
61
|
extensions: []
|
60
62
|
extra_rdoc_files: []
|
61
63
|
files:
|
62
64
|
- ".gitignore"
|
63
|
-
- CHANGELOG.md
|
64
65
|
- Gemfile
|
65
66
|
- LICENSE.txt
|
66
67
|
- README.md
|
@@ -80,6 +81,7 @@ files:
|
|
80
81
|
- lib/vagrant-digitalocean/actions/setup_key.rb
|
81
82
|
- lib/vagrant-digitalocean/actions/setup_sudo.rb
|
82
83
|
- lib/vagrant-digitalocean/actions/setup_user.rb
|
84
|
+
- lib/vagrant-digitalocean/actions/shut_down.rb
|
83
85
|
- lib/vagrant-digitalocean/actions/sync_folders.rb
|
84
86
|
- lib/vagrant-digitalocean/commands/list.rb
|
85
87
|
- lib/vagrant-digitalocean/commands/rebuild.rb
|
@@ -120,7 +122,7 @@ rubyforge_project:
|
|
120
122
|
rubygems_version: 2.4.6
|
121
123
|
signing_key:
|
122
124
|
specification_version: 4
|
123
|
-
summary: Enables Vagrant to manage
|
125
|
+
summary: Enables Vagrant to manage DigitalOcean droplets
|
124
126
|
test_files:
|
125
127
|
- test/Vagrantfile
|
126
128
|
- test/cookbooks/test/recipes/default.rb
|