vagrant-linode 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9e79120502b6fda82a12f08ad42c6b9ca167711f
4
- data.tar.gz: 13e80103279fbae0a7e521e3f81426b7a539c2ba
3
+ metadata.gz: e8ce03d21b5be2ac13a6492b31874c435dced26f
4
+ data.tar.gz: 4662545d18c8e288c37bb3f085306239865b8a09
5
5
  SHA512:
6
- metadata.gz: 63661d58fb59497f8017b370781ed289f2da809328d68475b79f55acb8b788a86299a9e2cc4622d794adf02fdebd33210f9c326cda10bc5930da321e947d57b7
7
- data.tar.gz: ffd6a184e1f2f60dd0120d76568b4d699c5a8143c79d491fc7da62989175d79b809379a0d853356f00a5c3efa3ab5fe7a881b8b914ea86fad736f6a26d89239a
6
+ metadata.gz: fbee5ac73c4c72a2f8518a775e895c64e420901ff3eb9e2d5dec78d3a0eb65d1cd66dc7b31dd05c754f63f2942aed694bedda10cc62e5e9ed33dad391e3b6969
7
+ data.tar.gz: 5f31d483d567d7bbdbb9a8548288f56748adf2172c00062a6e74c62f851e5ddf5f36723c76fb9bf4f1ef8fe2e90a1e04c2a4908980a366403a3c23ffc919c84e
data/.gitignore CHANGED
@@ -12,8 +12,10 @@ lib/bundler/man
12
12
  pkg
13
13
  rdoc
14
14
  spec/reports
15
+ Vagrantfile
16
+ .vagrant
17
+ !test/Vagrantfile
15
18
  test/tmp
16
19
  test/version_tmp
17
20
  test/.vagrant
18
21
  tmp
19
- .vagrant
data/README.md CHANGED
@@ -87,8 +87,8 @@ Please note the following:
87
87
  **Supported Configuration Attributes**
88
88
 
89
89
  The following attributes are available to further configure the provider:
90
- - `provider.image` - A string representing the image to use when creating a
91
- new linode (e.g. `Debian 7.5`). The available options may
90
+ - `provider.distribution` - A string representing the distribution to use when
91
+ creating a new linode (e.g. `Debian 7.5`). The available options may
92
92
  be found on Linode's new linode [form](https://www.linode.com/distributions).
93
93
  It defaults to `Ubuntu 14.04 LTS`.
94
94
  - `provider.datacenter` - A string representing the region to create the new
@@ -104,6 +104,10 @@ The following attributes are available to further configure the provider:
104
104
  account and modify sudo to disable tty requirement. It defaults to `true`.
105
105
  If you are using a tool like [packer](https://packer.io) to create
106
106
  reusable snapshots with user accounts already provisioned, set to `false`.
107
+ - `provider.label` - A string representing the Linode label to assign when
108
+ creating a new linode
109
+ - `provider.group` - A string representing the Linode's Display group to assign
110
+ when creating a new linode
107
111
 
108
112
  The provider will create a new user account with the specified SSH key for
109
113
  authorization if `config.ssh.username` is set and the `provider.setup`
@@ -147,6 +151,7 @@ Current Region-ID table is:
147
151
  | 7 | london | London, England, UK |
148
152
  | 6 | newark | Newark, NJ, USA |
149
153
  | 8 | tokyo | Tokyo, JP |
154
+ | 9 | singapore | Singapore, SGP |
150
155
 
151
156
  You can find latest datacenter ID number using Linode API call.
152
157
 
@@ -171,6 +176,8 @@ command:
171
176
  This command will create a new linode, setup your SSH key for authentication,
172
177
  create a new user account, and run the provisioners you have configured.
173
178
 
179
+ The environment variable `VAGRANT_DEFAULT_PROVIDER` can be set to `linode` to avoid sending `--provider=linode` on each `vagrant up`.
180
+
174
181
  **Supported Commands**
175
182
 
176
183
  The provider supports the following Vagrant sub-commands:
@@ -201,8 +208,10 @@ You can now make modifications. Running `vagrant` within the Bundler
201
208
  environment will ensure that plugins installed in your Vagrant
202
209
  environment are not loaded.
203
210
 
211
+ [![Join the chat at https://gitter.im/displague/vagrant-linode](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/displague/vagrant-linode?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
204
212
  [![Code Climate](https://codeclimate.com/github/displague/vagrant-linode/badges/gpa.svg)](https://codeclimate.com/github/displague/vagrant-linode)
205
213
  [![Test Coverage](https://codeclimate.com/github/displague/vagrant-linode/badges/coverage.svg)](https://codeclimate.com/github/displague/vagrant-linode)
206
214
  [![Gem Version](https://badge.fury.io/rb/vagrant-linode.svg)](http://badge.fury.io/rb/vagrant-linode)
215
+ [![Dependency Status](https://gemnasium.com/displague/vagrant-linode.svg)](https://gemnasium.com/displague/vagrant-linode)
207
216
  [![MIT Licensed](https://img.shields.io/badge/license-MIT-green.svg)](https://tldrlegal.com/license/mit-license)
208
217
 
@@ -98,16 +98,16 @@ module VagrantPlugins
98
98
  label: 'Vagrant Disk Distribution ' + distribution_id.to_s + ' Linode ' + result['linodeid'].to_s,
99
99
  type: 'ext4',
100
100
  size: xvda_size,
101
- rootSSHKey: pubkey,
102
- rootPass: root_pass
101
+ rootsshkey: pubkey,
102
+ rootpass: root_pass
103
103
  )
104
104
  elsif image_id
105
105
  disk = @client.linode.disk.createfromimage(
106
106
  linodeid: result['linodeid'],
107
107
  imageid: image_id,
108
108
  size: xvda_size,
109
- rootSSHKey: pubkey,
110
- rootPass: root_pass
109
+ rootsshkey: pubkey,
110
+ rootpass: root_pass
111
111
  )
112
112
 
113
113
  swap = @client.linode.disk.create(
@@ -137,9 +137,13 @@ module VagrantPlugins
137
137
  label = label || @machine.name if @machine.name != 'default'
138
138
  label = label || get_server_name
139
139
 
140
+ group = @machine.provider_config.group
141
+ group = "" if @machine.provider_config.group == false
142
+
140
143
  result = @client.linode.update(
141
144
  linodeid: result['linodeid'],
142
- label: label
145
+ label: label,
146
+ lpm_displaygroup: group
143
147
  )
144
148
 
145
149
  env[:ui].info I18n.t('vagrant_linode.info.booting', linodeid: result['linodeid'])
@@ -0,0 +1,32 @@
1
+ # -*- mode: ruby -*-
2
+ # vi: set ft=ruby :
3
+
4
+ module VagrantPlugins
5
+ module Linode
6
+ module Actions
7
+ class SetupHostname
8
+
9
+ def initialize(app, env)
10
+ @app = app
11
+ @machine = env[:machine]
12
+ @logger = Log4r::Logger.new('vagrant::linode::setup_hostname')
13
+ end
14
+
15
+ def call(env)
16
+ # Check if setup is enabled
17
+ return @app.call(env) unless @machine.provider_config.setup?
18
+
19
+ # Set Hostname
20
+ if @machine.config.vm.hostname
21
+ env[:ui].info I18n.t('vagrant_linode.info.modifying_host', name: @machine.config.vm.hostname)
22
+
23
+ @machine.communicate.execute(<<-BASH)
24
+ sudo echo -n #{@machine.config.vm.hostname} > /etc/hostname;
25
+ sudo hostname -F /etc/hostname
26
+ BASH
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -5,6 +5,7 @@ require 'vagrant-linode/actions/power_off'
5
5
  require 'vagrant-linode/actions/power_on'
6
6
  require 'vagrant-linode/actions/rebuild'
7
7
  require 'vagrant-linode/actions/reload'
8
+ require 'vagrant-linode/actions/setup_hostname'
8
9
  require 'vagrant-linode/actions/setup_user'
9
10
  require 'vagrant-linode/actions/setup_sudo'
10
11
  require 'vagrant-linode/actions/setup_key'
@@ -100,6 +101,7 @@ module VagrantPlugins
100
101
  b.use Create
101
102
  b.use SetupSudo
102
103
  b.use SetupUser
104
+ b.use SetupHostname
103
105
  b.use provision
104
106
  end
105
107
  end
@@ -148,6 +150,7 @@ module VagrantPlugins
148
150
  b.use Rebuild
149
151
  b.use SetupSudo
150
152
  b.use SetupUser
153
+ b.use SetupHostname
151
154
  b.use provision
152
155
  when :not_created
153
156
  env[:ui].info I18n.t('vagrant_linode.info.not_created')
@@ -15,6 +15,7 @@ module VagrantPlugins
15
15
  attr_accessor :swap_size
16
16
  attr_accessor :kernel_id
17
17
  attr_accessor :label
18
+ attr_accessor :group
18
19
 
19
20
  alias_method :setup?, :setup
20
21
 
@@ -33,6 +34,7 @@ module VagrantPlugins
33
34
  @swap_size = UNSET_VALUE
34
35
  @kernel_id = UNSET_VALUE
35
36
  @label = UNSET_VALUE
37
+ @group = UNSET_VALUE
36
38
  end
37
39
 
38
40
  def finalize!
@@ -50,6 +52,7 @@ module VagrantPlugins
50
52
  @swap_size = '256' if @swap_size == UNSET_VALUE
51
53
  @kernel_id = '138' if @kernel_id == UNSET_VALUE
52
54
  @label = false if @label == UNSET_VALUE
55
+ @group = false if @group == UNSET_VALUE
53
56
  end
54
57
 
55
58
  def validate(machine)
@@ -1,8 +1,10 @@
1
1
  require 'vagrant-linode/helpers/result'
2
- require 'linode'
2
+ require 'linodeapi'
3
3
  require 'json'
4
4
  require 'vagrant/util/retryable'
5
5
 
6
+ include Vagrant::Util::Retryable
7
+
6
8
  module VagrantPlugins
7
9
  module Linode
8
10
  module Helpers
@@ -20,8 +22,8 @@ module VagrantPlugins
20
22
  fail 'not ready' if result['host_finish_dt'] > ''
21
23
  end
22
24
  end
23
- linodeapi = ::Linode.new(api_key: @machine.provider_config.token,
24
- api_url: @machine.provider_config.api_url || nil)
25
+ linodeapi = ::LinodeAPI::Raw.new(apikey: @machine.provider_config.token,
26
+ endpoint: @machine.provider_config.api_url || nil)
25
27
  # linodeapi.wait_for_event = wait_for_event
26
28
  # linodeapi.extend wait_for_event
27
29
  end
@@ -33,7 +35,7 @@ module VagrantPlugins
33
35
  def initialize(machine)
34
36
  @logger = Log4r::Logger.new('vagrant::linode::apiclient')
35
37
  @config = machine.provider_config
36
- @client = ::Linode.new(api_key: @config.token)
38
+ @client = ::LinodeAPI::Raw.new(apikey: @config.token, endpoint: @config.api_url || nil)
37
39
  end
38
40
 
39
41
  attr_reader :client
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module Linode
3
- VERSION = '0.1.1'
3
+ VERSION = '0.1.2'
4
4
  end
5
5
  end
data/locales/en.yml CHANGED
@@ -17,6 +17,7 @@ en:
17
17
  reloading: "Rebooting the linode..."
18
18
  creating_user: "Creating user account: %{user}..."
19
19
  modifying_sudo: "Modifying sudoers file to remove tty requirement..."
20
+ modifying_host: "Modifying hostname: %{name}..."
20
21
  using_key: "Using existing SSH key: %{name}"
21
22
  creating_key: "Creating new SSH key: %{name}..."
22
23
  trying_rsync_install: "Rsync not found, attempting to install with yum..."
data/test/Vagrantfile CHANGED
@@ -20,6 +20,7 @@ Vagrant.configure('2') do |config|
20
20
  provider.distribution = 'Ubuntu 14.04 LTS'
21
21
  provider.datacenter = 'newark'
22
22
  provider.plan = '1024'
23
+ provider.label = 'vagrant-'+Time.new.strftime("%F%T").gsub(/[^0-9]/,'')
23
24
 
24
25
  # Disk Image Sizes (Optional configuration)
25
26
 
@@ -13,7 +13,7 @@ Gem::Specification.new do |gem|
13
13
  gem.homepage = 'https://www.github.com/displague/vagrant-linode'
14
14
  gem.summary = gem.description
15
15
 
16
- gem.add_runtime_dependency 'linode'
16
+ gem.add_runtime_dependency 'linodeapi'
17
17
  gem.add_runtime_dependency 'json'
18
18
  gem.add_runtime_dependency 'log4r'
19
19
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-linode
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marques Johansson
@@ -9,10 +9,10 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-10-31 00:00:00.000000000 Z
12
+ date: 2015-06-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: linode
15
+ name: linodeapi
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
18
  - - ">="
@@ -122,6 +122,7 @@ files:
122
122
  - lib/vagrant-linode/actions/power_on.rb
123
123
  - lib/vagrant-linode/actions/rebuild.rb
124
124
  - lib/vagrant-linode/actions/reload.rb
125
+ - lib/vagrant-linode/actions/setup_hostname.rb
125
126
  - lib/vagrant-linode/actions/setup_key.rb
126
127
  - lib/vagrant-linode/actions/setup_sudo.rb
127
128
  - lib/vagrant-linode/actions/setup_user.rb