cvent/dogscaler

no home environment when run on lambda

Opened this issue · 1 comments

When dogscaler client is run on lambda, the logical way to do this is store your ruby libraries in a lambda layer and call the dogscaler binary from the lambda layer path.

When calling the client as if we were running it in the terminal like this:

def lambdaHandler(event:, context:)
	output = `/opt/2.5.0/bin/dogscaler`
	p output
end

I get this error:

/opt/2.5.0/gems/dogscaler-2.0.10/lib/settings.rb:31:in expand_path': couldn't find login name -- expanding ~' (ArgumentError)

Solution is to set a home dir when it's nil

if ENV['HOME'].nil?
  require 'etc'
  ENV['HOME'] = Etc.getpwuid.dir
end