Skip to content

Commit

Permalink
correct cubocop formatting
Browse files Browse the repository at this point in the history
Signed-off-by: dmitriy kalinin <dmitriy@pivotallabs.com>
  • Loading branch information
Caleb Miles committed Oct 15, 2013
1 parent 3224d8d commit c678824
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
6 changes: 3 additions & 3 deletions bosh-dev/lib/bosh/dev/sandbox/database_migrator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

module Bosh::Dev::Sandbox
class DatabaseMigrator
def initialize(director_dir, director_config_path)
def initialize(director_dir, director_config_path, logger)
@director_dir = director_dir
@director_config_path = director_config_path
@logger = logger
end

def migrate
Dir.chdir(@director_dir) do
output = `bin/bosh-director-migrate -c #{@director_config_path}`
unless $?.exitstatus == 0
puts "Failed to run migration:"
puts output
@logger.info("Failed to run migration: \n#{output}")
exit 1
end
end
Expand Down
8 changes: 4 additions & 4 deletions bosh-dev/lib/bosh/dev/sandbox/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ def start
Process.detach(@pid)

tries = 0
while !running?
until running?
tries += 1
raise RuntimeError, "Cannot run #{@cmd_array} with #{env.inspect}" if tries > 20
sleep(0.1)
end
end
end

def stop(signal="TERM")
def stop(signal = 'TERM')
return unless running?

begin
Expand All @@ -61,12 +61,12 @@ def running?
false
end

def wait_for_process_to_exit_or_be_killed(remaining_attempts=30)
def wait_for_process_to_exit_or_be_killed(remaining_attempts = 30)
# Actually just twiddle our thumbs here because wait() can hang forever...
while running?
remaining_attempts -= 1
if remaining_attempts == 5
Process.kill("KILL", @pid)
Process.kill('KILL', @pid)
elsif remaining_attempts == 0
raise "KILL signal ignored by #{@cmd_array.first} with PID=#{@pid}"
else
Expand Down
2 changes: 1 addition & 1 deletion bosh-dev/lib/bosh/dev/sandbox/socket_connector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def initialize(host, port, logger)
@logger = logger
end

def try_to_connect(remaining_attempts=20)
def try_to_connect(remaining_attempts = 20)
remaining_attempts -= 1
socket = Socket.new(Socket::Constants::AF_INET, Socket::Constants::SOCK_STREAM, 0)
socket.connect(@addr)
Expand Down
7 changes: 5 additions & 2 deletions spec/support/sandbox.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,11 @@ def initialize
@logger,
)

@postgresql = Bosh::Dev::Sandbox::Postgresql.new(sandbox_root, @name, @logger)
@database_migrator = Bosh::Dev::Sandbox::DatabaseMigrator.new(DIRECTOR_PATH, director_config)
@postgresql = Bosh::Dev::Sandbox::Postgresql.new(
sandbox_root, @name, @logger)

@database_migrator = Bosh::Dev::Sandbox::DatabaseMigrator.new(
DIRECTOR_PATH, director_config, @logger)
end

def agent_tmp_path
Expand Down

0 comments on commit c678824

Please sign in to comment.