Skip to content

Commit

Permalink
Run rubocop with --auto-correct
Browse files Browse the repository at this point in the history
Modifies many files except for driver.rb; rubocop seems to stall out
when auto-correcting driver.rb
  • Loading branch information
michaeljb committed Nov 18, 2016
1 parent 5800df9 commit 75bc210
Show file tree
Hide file tree
Showing 8 changed files with 129 additions and 133 deletions.
1 change: 0 additions & 1 deletion lib/vSphere/action.rb
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ def self.action_reload
end
end


# TODO: Remove the if guard when Vagrant 1.8.0 is the minimum version.
# rubocop:disable IndentationWidth
if Gem::Version.new(Vagrant::VERSION) >= Gem::Version.new('1.8.0')
Expand Down
18 changes: 8 additions & 10 deletions lib/vSphere/action/destroy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,16 @@ def call(env)
private

def destroy_vm(env)
begin
env[:ui].info I18n.t('vsphere.destroy_vm')
env[:ui].info I18n.t('vsphere.destroy_vm')

env[:machine].provider.driver.destroy do |progress|
env[:ui].clear_line
env[:ui].report_progress(progress, 100, false)
end
rescue Errors::VSphereError
raise
rescue StandardError => e
raise Errors::VSphereError.new, e.message
env[:machine].provider.driver.destroy do |progress|
env[:ui].clear_line
env[:ui].report_progress(progress, 100, false)
end
rescue Errors::VSphereError
raise
rescue StandardError => e
raise Errors::VSphereError.new, e.message
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/vSphere/action/snapshot_delete.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def initialize(app, _env)

def call(env)
snapshot_name = env[:snapshot_name]

env[:ui].info(I18n.t("vagrant.actions.vm.snapshot.deleting", name: snapshot_name))

env[:machine].provider.driver.delete_snapshot(snapshot_name) do |progress|
Expand Down
2 changes: 1 addition & 1 deletion lib/vSphere/action/snapshot_restore.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def call(env)
end

env[:ui].clear_line
#env[:ui].success(I18n.t("vagrant.actions.vm.snapshot.restored", name: snapshot_name))
# env[:ui].success(I18n.t("vagrant.actions.vm.snapshot.restored", name: snapshot_name))

@app.call env
end
Expand Down
4 changes: 2 additions & 2 deletions lib/vSphere/action/snapshot_save.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ def call(env)
snapshot_name = env[:snapshot_name]

env[:ui].info(I18n.t("vagrant.actions.vm.snapshot.saving", name: snapshot_name))

env[:machine].provider.driver.create_snapshot(snapshot_name) do |progress|
env[:ui].clear_line
env[:ui].report_progress(progress, 100, false)
end

env[:ui].clear_line
env[:ui].success(I18n.t("vagrant.actions.vm.snapshot.saved", name: snapshot_name))

@app.call env
end
end
Expand Down
127 changes: 63 additions & 64 deletions lib/vSphere/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
module VagrantPlugins
module VSphere
class Config < Vagrant.plugin('2', :config)

class NetworkConfiguration
attr_accessor :allow_guest_control
attr_accessor :connected
Expand Down Expand Up @@ -39,67 +38,67 @@ def initialize(network_config)
end

class SerialPortConfiguration
attr_accessor :yield_on_poll
attr_accessor :connected
attr_accessor :start_connected
attr_accessor :backing

attr_accessor :direction
attr_accessor :proxy_uri
attr_accessor :service_uri

attr_accessor :endpoint
attr_accessor :no_rx_loss

attr_accessor :file_name

attr_accessor :device_name
attr_accessor :use_auto_detect

def initialize(serial_port_config)
@yield_on_poll = true
@connected = true
@start_connected = true
@backing = ''

@direction = ''
@proxy_uri = ''
@service_uri = ''

@endpoint = ''
@no_rx_loss = true

@file_name = ''

@device_name = ''
@use_auto_detect = false

@yield_on_poll = serial_port_config[:yield_on_poll] if serial_port_config.key?(:yield_on_poll)
@connected = network_config[:connected] if network_config.key?(:connected)
@start_connected = network_config[:start_connected] if network_config.key?(:start_connected)
@backing = serial_port_config[:backing] if serial_port_config.key?(:backing)
if !(@backing == 'uri' || @backing == 'pipe' || @backing == 'file' || @backing == 'device')
raise "The only valid values allowed for backing are 'uri', 'pipe', 'file', 'device'"
end

@direction = serial_port_config[:direction] if serial_port_config.key?(:direction)
if @backing == 'uri' && !(@direction == 'client' || @direction == 'server')
raise "The only valid values allowed for direction are 'client', 'server'"
end
@proxy_uri = serial_port_config[:proxy_uri] if serial_port_config.key?(:proxy_uri)
@service_uri = serial_port_config[:service_uri] if serial_port_config.key?(:service_uri)

@endpoint = serial_port_config[:endpoint] if serial_port_config.key?(:endpoint)
if @backing == 'pipe' && !(@endpoint == 'client' || @endpoint == 'server')
raise "The only valid values allowed for endpoint are 'client', 'server'"
end
@no_rx_loss = serial_port_config[:no_rx_loss] if serial_port_config.key?(:no_rx_loss)

@file_name = serial_port_config[:file_name] if serial_port_config.key?(:file_name)

@device_name = serial_port_config[:device_name] if serial_port_config.key?(:device_name)
@use_auto_detect = serial_port_config[:use_auto_detect] if serial_port_config.key?(:use_auto_detect)
attr_accessor :yield_on_poll
attr_accessor :connected
attr_accessor :start_connected
attr_accessor :backing

attr_accessor :direction
attr_accessor :proxy_uri
attr_accessor :service_uri

attr_accessor :endpoint
attr_accessor :no_rx_loss

attr_accessor :file_name

attr_accessor :device_name
attr_accessor :use_auto_detect

def initialize(serial_port_config)
@yield_on_poll = true
@connected = true
@start_connected = true
@backing = ''

@direction = ''
@proxy_uri = ''
@service_uri = ''

@endpoint = ''
@no_rx_loss = true

@file_name = ''

@device_name = ''
@use_auto_detect = false

@yield_on_poll = serial_port_config[:yield_on_poll] if serial_port_config.key?(:yield_on_poll)
@connected = network_config[:connected] if network_config.key?(:connected)
@start_connected = network_config[:start_connected] if network_config.key?(:start_connected)
@backing = serial_port_config[:backing] if serial_port_config.key?(:backing)
unless @backing == 'uri' || @backing == 'pipe' || @backing == 'file' || @backing == 'device'
fail "The only valid values allowed for backing are 'uri', 'pipe', 'file', 'device'"
end

@direction = serial_port_config[:direction] if serial_port_config.key?(:direction)
if @backing == 'uri' && !(@direction == 'client' || @direction == 'server')
fail "The only valid values allowed for direction are 'client', 'server'"
end
@proxy_uri = serial_port_config[:proxy_uri] if serial_port_config.key?(:proxy_uri)
@service_uri = serial_port_config[:service_uri] if serial_port_config.key?(:service_uri)

@endpoint = serial_port_config[:endpoint] if serial_port_config.key?(:endpoint)
if @backing == 'pipe' && !(@endpoint == 'client' || @endpoint == 'server')
fail "The only valid values allowed for endpoint are 'client', 'server'"
end
@no_rx_loss = serial_port_config[:no_rx_loss] if serial_port_config.key?(:no_rx_loss)

@file_name = serial_port_config[:file_name] if serial_port_config.key?(:file_name)

@device_name = serial_port_config[:device_name] if serial_port_config.key?(:device_name)
@use_auto_detect = serial_port_config[:use_auto_detect] if serial_port_config.key?(:use_auto_detect)
end
end

attr_accessor :host
Expand Down Expand Up @@ -131,9 +130,9 @@ def initialize(serial_port_config)
attr_accessor :destroy_unused_serial_ports
attr_accessor :management_network_adapter_slot
attr_accessor :management_network_adapter_address_family
attr_reader :network_adapters
attr_reader :serial_ports
attr_reader :custom_attributes
attr_reader :network_adapters
attr_reader :serial_ports
attr_reader :custom_attributes

def initialize
@wait_for_customization_timeout = 600
Expand Down
Loading

0 comments on commit 75bc210

Please sign in to comment.