vagrant-profitbricks 1.0.0 → 4.0.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.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +4 -4
  3. data/README.md +326 -174
  4. data/Rakefile +4 -2
  5. data/Vagrantfile +18 -13
  6. data/example_box/Vagrantfile +9 -0
  7. data/example_box/profitbricks.box +0 -0
  8. data/lib/vagrant-profitbricks.rb +12 -11
  9. data/lib/vagrant-profitbricks/action.rb +79 -40
  10. data/lib/vagrant-profitbricks/action/connect_profitbricks.rb +14 -12
  11. data/lib/vagrant-profitbricks/action/create_server.rb +74 -67
  12. data/lib/vagrant-profitbricks/action/delete_server.rb +33 -13
  13. data/lib/vagrant-profitbricks/action/is_created.rb +3 -1
  14. data/lib/vagrant-profitbricks/action/list_flavors.rb +5 -3
  15. data/lib/vagrant-profitbricks/action/list_images.rb +6 -4
  16. data/lib/vagrant-profitbricks/action/message_already_created.rb +4 -2
  17. data/lib/vagrant-profitbricks/action/message_not_created.rb +4 -2
  18. data/lib/vagrant-profitbricks/action/read_ssh_info.rb +10 -16
  19. data/lib/vagrant-profitbricks/action/read_state.rb +19 -12
  20. data/lib/vagrant-profitbricks/action/reboot_server.rb +45 -0
  21. data/lib/vagrant-profitbricks/action/run_init_script.rb +5 -3
  22. data/lib/vagrant-profitbricks/action/start_server.rb +50 -0
  23. data/lib/vagrant-profitbricks/action/stop_server.rb +51 -0
  24. data/lib/vagrant-profitbricks/command/datacenters.rb +34 -0
  25. data/lib/vagrant-profitbricks/command/flavors.rb +19 -6
  26. data/lib/vagrant-profitbricks/command/images.rb +21 -20
  27. data/lib/vagrant-profitbricks/command/locations.rb +34 -0
  28. data/lib/vagrant-profitbricks/command/root.rb +28 -23
  29. data/lib/vagrant-profitbricks/command/servers.rb +7 -4
  30. data/lib/vagrant-profitbricks/command/snapshots.rb +34 -0
  31. data/lib/vagrant-profitbricks/command/utils.rb +27 -0
  32. data/lib/vagrant-profitbricks/config.rb +44 -39
  33. data/lib/vagrant-profitbricks/errors.rb +14 -5
  34. data/lib/vagrant-profitbricks/plugin.rb +13 -11
  35. data/lib/vagrant-profitbricks/provider.rb +8 -6
  36. data/lib/vagrant-profitbricks/version.rb +3 -1
  37. data/locales/en.yml +28 -7
  38. data/spec/spec_helper.rb +4 -2
  39. data/spec/vagrant-profitbricks/config_spec.rb +65 -96
  40. data/vagrant-profitbricks.gemspec +17 -14
  41. metadata +42 -47
  42. data/Appraisals +0 -35
  43. data/CHANGELOG.md +0 -3
  44. data/RELEASE.md +0 -15
  45. data/bootstrap.cmd +0 -16
  46. data/features/provision.feature +0 -36
  47. data/features/steps/sdk_steps.rb +0 -13
  48. data/features/steps/server_steps.rb +0 -25
  49. data/features/support/env.rb +0 -35
  50. data/features/support/fog_mock.rb +0 -17
  51. data/features/vagrant-profitbricks.feature +0 -66
  52. data/lib/vagrant-profitbricks/action/create_image.rb +0 -53
  53. data/lib/vagrant-profitbricks/action/list_keypairs.rb +0 -20
  54. data/lib/vagrant-profitbricks/action/list_networks.rb +0 -20
  55. data/lib/vagrant-profitbricks/action/list_servers.rb +0 -21
  56. data/lib/vagrant-profitbricks/command/create_image.rb +0 -21
  57. data/lib/vagrant-profitbricks/command/keypairs.rb +0 -21
  58. data/lib/vagrant-profitbricks/command/list_images.rb +0 -21
  59. data/lib/vagrant-profitbricks/command/networks.rb +0 -21
  60. data/spec/vagrant-profitbricks/actions/list_flavors_spec.rb +0 -48
  61. data/spec/vagrant-profitbricks/actions/list_images_spec.rb +0 -48
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'vagrant-profitbricks/command/utils'
4
+
5
+ module VagrantPlugins
6
+ module ProfitBricks
7
+ module Command
8
+ class ListDatacenters < Vagrant.plugin('2', :command)
9
+ include VagrantPlugins::ProfitBricks::Command::Utils
10
+ def execute
11
+ opts = OptionParser.new do |o|
12
+ o.banner = 'Usage: vagrant profitbricks datacenters [options]'
13
+ end
14
+
15
+ argv = parse_options(opts)
16
+ return unless argv
17
+
18
+ compute = fog_pb(argv[0])
19
+
20
+ rows = []
21
+
22
+ compute.datacenters.sort_by(&:id).each do |dc|
23
+ rows << [
24
+ dc.id,
25
+ dc.name
26
+ ]
27
+ end
28
+
29
+ display_table(@env, %w[ID Name], rows)
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -1,19 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'vagrant-profitbricks/command/utils'
4
+
1
5
  module VagrantPlugins
2
6
  module ProfitBricks
3
7
  module Command
4
- class Flavors < Vagrant.plugin("2", :command)
8
+ class ListFlavors < Vagrant.plugin('2', :command)
9
+ include VagrantPlugins::ProfitBricks::Command::Utils
5
10
  def execute
6
- options = {}
7
11
  opts = OptionParser.new do |o|
8
- o.banner = "Usage: vagrant profitbricks flavors [options]"
12
+ o.banner = 'Usage: vagrant profitbricks flavors [options]'
9
13
  end
10
14
 
11
15
  argv = parse_options(opts)
12
- return if !argv
16
+ return unless argv
17
+
18
+ compute = fog_pb(argv[0])
13
19
 
14
- with_target_vms(argv, :provider => :profitbricks) do |machine|
15
- machine.action('list_flavors')
20
+ rows = []
21
+
22
+ compute.flavors.sort_by(&:id).each do |flavor|
23
+ rows << [
24
+ flavor.id,
25
+ flavor.name
26
+ ]
16
27
  end
28
+
29
+ display_table(@env, %w[ID Name], rows)
17
30
  end
18
31
  end
19
32
  end
@@ -1,31 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'vagrant-profitbricks/command/utils'
4
+
1
5
  module VagrantPlugins
2
6
  module ProfitBricks
3
7
  module Command
4
- class Images < Vagrant.plugin("2", :command)
5
- def initialize(argv, env)
6
- @main_args, @sub_command, @sub_args = split_main_and_subcommand(argv)
7
-
8
- @subcommands = Vagrant::Registry.new
9
- @subcommands.register(:list) do
10
- require File.expand_path("../list_images", __FILE__)
11
- ListImages
8
+ class ListImages < Vagrant.plugin('2', :command)
9
+ include VagrantPlugins::ProfitBricks::Command::Utils
10
+ def execute
11
+ opts = OptionParser.new do |o|
12
+ o.banner = 'Usage: vagrant profitbricks images'
12
13
  end
13
14
 
14
- super(argv, env)
15
- end
15
+ argv = parse_options(opts)
16
+ return unless argv
16
17
 
17
- def execute
18
- if @main_args.include?("-h") || @main_args.include?("--help")
19
- # Print the help for all the profitbricks commands.
20
- return help
21
- end
18
+ compute = fog_pb(argv[0])
22
19
 
23
- command_class = @subcommands.get(@sub_command.to_sym) if @sub_command
24
- return help if !command_class || !@sub_command
25
- @logger.debug("Invoking command class: #{command_class} #{@sub_args.inspect}")
20
+ rows = []
21
+ compute.images.each do |image|
22
+ rows << [
23
+ image.id,
24
+ image.name,
25
+ image.location
26
+ ]
27
+ end
26
28
 
27
- # Initialize and execute the command class
28
- command_class.new(@sub_args, @env).execute
29
+ display_table(@env, %w[ID Name Location], rows)
29
30
  end
30
31
  end
31
32
  end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'vagrant-profitbricks/command/utils'
4
+
5
+ module VagrantPlugins
6
+ module ProfitBricks
7
+ module Command
8
+ class ListLocations < Vagrant.plugin('2', :command)
9
+ include VagrantPlugins::ProfitBricks::Command::Utils
10
+ def execute
11
+ opts = OptionParser.new do |o|
12
+ o.banner = 'Usage: vagrant profitbricks locations [options]'
13
+ end
14
+
15
+ argv = parse_options(opts)
16
+ return unless argv
17
+
18
+ compute = fog_pb(argv[0])
19
+
20
+ rows = []
21
+
22
+ compute.locations.sort_by(&:id).each do |location|
23
+ rows << [
24
+ location.id,
25
+ location.name
26
+ ]
27
+ end
28
+
29
+ display_table(@env, %w[ID Name], rows)
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'vagrant-profitbricks/action'
2
4
 
3
5
  module VagrantPlugins
4
6
  module ProfitBricks
5
7
  module Command
6
- class Root < Vagrant.plugin("2", :command)
8
+ class Root < Vagrant.plugin('2', :command)
7
9
  def self.synopsis
8
10
  I18n.t('vagrant_profitbricks.command.synopsis')
9
11
  end
@@ -13,32 +15,35 @@ module VagrantPlugins
13
15
 
14
16
  @subcommands = Vagrant::Registry.new
15
17
 
16
- @subcommands.register(:images) do
17
- require File.expand_path("../images", __FILE__)
18
- Images
18
+ @subcommands.register(:datacenters) do
19
+ require File.expand_path('../datacenters', __FILE__)
20
+ ListDatacenters
19
21
  end
20
- @subcommands.register(:flavors) do
21
- require File.expand_path("../flavors", __FILE__)
22
- Flavors
22
+
23
+ @subcommands.register(:locations) do
24
+ require File.expand_path('../locations', __FILE__)
25
+ ListLocations
23
26
  end
24
- @subcommands.register(:keypairs) do
25
- require File.expand_path("../keypairs", __FILE__)
26
- KeyPairs
27
+
28
+ @subcommands.register(:snapshots) do
29
+ require File.expand_path('../snapshots', __FILE__)
30
+ ListSnapshots
27
31
  end
28
- @subcommands.register(:networks) do
29
- require File.expand_path("../networks", __FILE__)
30
- Networks
32
+
33
+ @subcommands.register(:flavors) do
34
+ require File.expand_path('../flavors', __FILE__)
35
+ ListFlavors
31
36
  end
32
- @subcommands.register(:servers) do
33
- require File.expand_path("../servers", __FILE__)
34
- Servers
37
+ @subcommands.register(:images) do
38
+ require File.expand_path('../images', __FILE__)
39
+ ListImages
35
40
  end
36
41
 
37
42
  super(argv, env)
38
43
  end
39
44
 
40
45
  def execute
41
- if @main_args.include?("-h") || @main_args.include?("--help")
46
+ if @main_args.include?('-h') || @main_args.include?('--help')
42
47
  # Print the help for all the profitbricks commands.
43
48
  return help
44
49
  end
@@ -53,25 +58,25 @@ module VagrantPlugins
53
58
 
54
59
  def help
55
60
  opts = OptionParser.new do |opts|
56
- opts.banner = "Usage: vagrant profitbricks <subcommand> [<args>]"
57
- opts.separator ""
61
+ opts.banner = 'Usage: vagrant profitbricks <subcommand> [<args>]'
62
+ opts.separator ''
58
63
  opts.separator I18n.t('vagrant_profitbricks.command.available_subcommands')
59
64
 
60
65
  # Add the available subcommands as separators in order to print them
61
66
  # out as well.
62
67
  keys = []
63
- @subcommands.each { |key, value| keys << key.to_s }
68
+ @subcommands.each { |key, _value| keys << key.to_s }
64
69
 
65
70
  keys.sort.each do |key|
66
71
  opts.separator " #{key}"
67
72
  end
68
73
 
69
- opts.separator ""
74
+ opts.separator ''
70
75
  opts.separator I18n.t('vagrant_profitbricks.command.help_subcommands') +
71
- " `vagrant profitbricks <subcommand> -h`"
76
+ ' `vagrant profitbricks <subcommand> -h`'
72
77
  end
73
78
 
74
- @env.ui.info(opts.help, :prefix => false)
79
+ @env.ui.info(opts.help, prefix: false)
75
80
  end
76
81
  end
77
82
  end
@@ -1,17 +1,20 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module VagrantPlugins
2
4
  module ProfitBricks
3
5
  module Command
4
- class Servers < Vagrant.plugin("2", :command)
6
+ class ListServers < Vagrant.plugin('2', :command)
5
7
  def execute
8
+ p 'Garegaer'
6
9
  options = {}
7
10
  opts = OptionParser.new do |o|
8
- o.banner = "Usage: vagrant profitbricks servers [options]"
11
+ o.banner = 'Usage: vagrant profitbricks servers [options]'
9
12
  end
10
13
 
11
14
  argv = parse_options(opts)
12
- return if !argv
15
+ return unless argv
13
16
 
14
- with_target_vms(argv, :provider => :profitbricks) do |machine|
17
+ with_target_vms(argv, provider: :profitbricks) do |machine|
15
18
  machine.action('list_servers')
16
19
  end
17
20
  end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'vagrant-profitbricks/command/utils'
4
+
5
+ module VagrantPlugins
6
+ module ProfitBricks
7
+ module Command
8
+ class ListSnapshots < Vagrant.plugin('2', :command)
9
+ include VagrantPlugins::ProfitBricks::Command::Utils
10
+ def execute
11
+ opts = OptionParser.new do |o|
12
+ o.banner = 'Usage: vagrant profitbricks snapshots [options]'
13
+ end
14
+
15
+ argv = parse_options(opts)
16
+ return unless argv
17
+
18
+ compute = fog_pb(argv[0])
19
+
20
+ rows = []
21
+
22
+ compute.snapshots.sort_by(&:id).each do |snapshot|
23
+ rows << [
24
+ snapshot.id,
25
+ snapshot.name
26
+ ]
27
+ end
28
+
29
+ display_table(@env, %w[ID Name], rows)
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'fog/profitbricks'
4
+ require 'terminal-table'
5
+
6
+ module VagrantPlugins
7
+ module ProfitBricks
8
+ module Command
9
+ module Utils
10
+ def fog_pb(_token)
11
+ compute = Fog::Compute.new(provider: 'ProfitBricks', profitbricks_username: ENV['PROFITBRICKS_USERNAME'], profitbricks_password: ENV['PROFITBRICKS_PASSWORD'])
12
+
13
+ compute
14
+ end
15
+
16
+ def display_table(env, headers, rows)
17
+ table = Terminal::Table.new headings: headers, rows: rows
18
+ if env.respond_to?('ui')
19
+ env.ui.info(table.to_s)
20
+ else
21
+ env[:ui].info(table.to_s)
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -1,10 +1,12 @@
1
- require "vagrant"
2
- require "fog/profitbricks"
1
+ # frozen_string_literal: true
2
+
3
+ require 'vagrant'
4
+ require 'fog/profitbricks'
3
5
 
4
6
  module VagrantPlugins
5
7
  module ProfitBricks
6
- class Config < Vagrant.plugin("2", :config)
7
- # The API key to access ProfitBricks - profitbricks_password
8
+ class Config < Vagrant.plugin('2', :config)
9
+ # The API key to access ProfitBricks - password
8
10
  # @return [String]
9
11
  attr_accessor :password
10
12
 
@@ -13,10 +15,10 @@ module VagrantPlugins
13
15
  # @return [String]
14
16
  attr_accessor :username
15
17
 
16
- # The profitbricks_url to access ProfitBricks.
18
+ # The url to access ProfitBricks Cloud API.
17
19
  #
18
20
  # expected to be a string url -
19
- # 'https://api.profitbricks.com/cloudapi/v3/'
21
+ # 'https://api.profitbricks.com/cloudapi/v4/'
20
22
  attr_accessor :profitbricks_url
21
23
 
22
24
  # The flavor of server to launch, either the ID or name. This
@@ -26,7 +28,7 @@ module VagrantPlugins
26
28
  # The name or ID of the image to use. This can also be a regular
27
29
  # expression to partially match a name.
28
30
  attr_accessor :image
29
-
31
+ attr_accessor :image_alias
30
32
 
31
33
  # The name of the server. This defaults to the name of the machine
32
34
  # defined by Vagrant (via `config.vm.define`), but can be overriden
@@ -39,28 +41,28 @@ module VagrantPlugins
39
41
 
40
42
  # Specify location for datacenter if one needs to be created, default value is 'us/las'
41
43
  attr_accessor :location
42
-
44
+
43
45
  # Disk volume size in GB
44
- attr_accessor :profitbricks_volume_size
46
+ attr_accessor :volume_size
45
47
 
46
48
  # Disk volume type (SSD or HDD)
47
49
  # Will default to HDD if not specified
48
50
  attr_accessor :volume_type
49
51
 
50
52
  # The licence type of the volume. Options: LINUX, WINDOWS, UNKNOWN, OTHER
51
- # You will need to provide either the image or the licence_type parameters.
53
+ # You will need to provide either the image or the licence_type parameters.
52
54
  # licence_type is required, but if image is supplied, it is already set and cannot be changed
53
55
  attr_accessor :volume_licence_type
54
56
 
55
- # The storage availability zone assigned to the volume.
56
- # Valid values: AUTO, ZONE_1, ZONE_2, or ZONE_3. This only applies to HDD volumes.
57
+ # The storage availability zone assigned to the volume.
58
+ # Valid values: AUTO, ZONE_1, ZONE_2, or ZONE_3. This only applies to HDD volumes.
57
59
  # Leave blank or set to AUTO when provisioning SSD volumes.
58
60
  # Will default to AUTO if not specified
59
61
  attr_accessor :volume_availability_zone
60
62
 
61
- # One or more SSH keys to allow access to the volume via SSH.
63
+ # One or more SSH keys to allow access to the volume via SSH.
62
64
  # Works with ProfitBricks supplied Linux images.
63
- attr_accessor :volume_ssh_keys
65
+ attr_accessor :public_ssh_keys
64
66
 
65
67
  # POne-time password is set on the Image for the appropriate account.
66
68
  # This field may only be set in creation requests. When reading, it always returns null.
@@ -68,10 +70,10 @@ module VagrantPlugins
68
70
  attr_accessor :image_password
69
71
 
70
72
  # number of cores in profitbricks server
71
- attr_accessor :profitbricks_cores
73
+ attr_accessor :cores
72
74
 
73
75
  # Required, amount of memory in GB allocated to virtual server
74
- attr_accessor :profitbricks_ram
76
+ attr_accessor :ram
75
77
 
76
78
  # Sets the CPU type. "AMD_OPTERON" or "INTEL_XEON". Defaults to "AMD_OPTERON".
77
79
  attr_accessor :cpu_family
@@ -83,21 +85,22 @@ module VagrantPlugins
83
85
  attr_accessor :nat
84
86
 
85
87
  def initialize
86
- @password = UNSET_VALUE
88
+ @password = UNSET_VALUE
87
89
  @profitbricks_url = UNSET_VALUE
88
- @flavor = UNSET_VALUE
89
- @profitbricks_cores = UNSET_VALUE
90
- @profitbricks_ram = UNSET_VALUE
91
- @image = UNSET_VALUE
90
+ @flavor = UNSET_VALUE
91
+ @cores = UNSET_VALUE
92
+ @ram = UNSET_VALUE
93
+ @image = nil
94
+ @image_alias = nil
92
95
  @server_name = UNSET_VALUE
93
96
  @datacenter_id = UNSET_VALUE
94
97
  @username = UNSET_VALUE
95
- @profitbricks_volume_size = UNSET_VALUE
98
+ @volume_size = UNSET_VALUE
96
99
  @location = UNSET_VALUE
97
100
  @volume_type = UNSET_VALUE
98
101
  @volume_licence_type = UNSET_VALUE
99
102
  @volume_availability_zone = UNSET_VALUE
100
- @volume_ssh_keys = UNSET_VALUE
103
+ @public_ssh_keys = UNSET_VALUE
101
104
  @cpu_family = UNSET_VALUE
102
105
  @lan_id = UNSET_VALUE
103
106
  @nat = UNSET_VALUE
@@ -105,47 +108,49 @@ module VagrantPlugins
105
108
  end
106
109
 
107
110
  def finalize!
108
- @password = nil if @password == UNSET_VALUE
111
+ @password = nil if @password == UNSET_VALUE
109
112
  @profitbricks_url = nil if @profitbricks_url == UNSET_VALUE
110
- @flavor = nil if @flavor == UNSET_VALUE
111
- @profitbricks_cores = 1 if @profitbricks_cores == UNSET_VALUE
112
- @profitbricks_ram = 256 if profitbricks_ram == UNSET_VALUE
113
- @image = /ubuntu/ if @image == UNSET_VALUE
113
+ @flavor = nil if @flavor == UNSET_VALUE
114
+ @cores = 1 if @cores == UNSET_VALUE
115
+ @ram = 2048 if ram == UNSET_VALUE
114
116
  @server_name = nil if @server_name == UNSET_VALUE
115
117
  @datacenter_id = nil if @datacenter_id == UNSET_VALUE
116
118
  @username = nil if @username == UNSET_VALUE
117
- @profitbricks_volume_size = 5 if @profitbricks_volume_size == UNSET_VALUE
119
+ @volume_size = 5 if @volume_size == UNSET_VALUE
118
120
  @location = 'us/las' if @location == UNSET_VALUE
119
121
  @volume_type = 'HDD' if @volume_type == UNSET_VALUE
120
122
  @volume_licence_type = 'UNKNOWN' if @volume_licence_type == UNSET_VALUE
121
123
  @volume_availability_zone = 'AUTO' if @volume_availability_zone == UNSET_VALUE
122
- @volume_ssh_keys = nil if @volume_ssh_keys == UNSET_VALUE
124
+ @public_ssh_keys = nil if @public_ssh_keys == UNSET_VALUE
123
125
  @cpu_family = 'AMD_OPTERON' if @cpu_family == UNSET_VALUE
124
126
  @lan_id = nil if @lan_id == UNSET_VALUE
125
127
  @nat = false if @nat == UNSET_VALUE
126
128
  @image_password = nil if @image_password == UNSET_VALUE
127
129
  end
128
130
 
129
- def validate(machine)
131
+ def validate(_machine)
130
132
  errors = _detected_errors
131
133
 
132
- errors << I18n.t("vagrant_profitbricks.config.password_required") if !@password
133
- errors << I18n.t("vagrant_profitbricks.config.username_required") if !@username
134
- errors << I18n.t("vagrant_profitbricks.config.datacenter_required") if !@datacenter_id
134
+ errors << I18n.t('vagrant_profitbricks.config.password_required') unless @password
135
+ errors << I18n.t('vagrant_profitbricks.config.username_required') unless @username
136
+ errors << I18n.t('vagrant_profitbricks.config.datacenter_required') unless @datacenter_id
137
+ errors << I18n.t('vagrant_profitbricks.config.image_or_image_alias_must_be_provided') if !@image && !@image_alias
138
+ errors << I18n.t('vagrant_profitbricks.config.image_password_or_public_ssh_required') if !@public_ssh_keys && !@image_password
139
+
135
140
  {
136
- :profitbricks_url => @profitbricks_url
141
+ url: @profitbricks_url
137
142
  }.each_pair do |key, value|
138
- errors << I18n.t("vagrant_profitbricks.config.invalid_uri", :key => key, :uri => value) unless value.nil? || valid_uri?(value)
143
+ errors << I18n.t('vagrant_profitbricks.config.invalid_uri', key: key, uri: value) unless value.nil? || valid_uri?(value)
139
144
  end
140
145
 
141
- { "ProfitBricks Provider" => errors }
146
+ { 'ProfitBricks Provider' => errors }
142
147
  end
143
148
 
144
149
  private
145
150
 
146
- def valid_uri? value
151
+ def valid_uri?(value)
147
152
  uri = URI.parse value
148
- uri.kind_of?(URI::HTTP)
153
+ uri.is_a?(URI::HTTP)
149
154
  end
150
155
  end
151
156
  end