Comments (3)
I think this is a possible solution
awssume "aws --output text lambda list-functions --query \"Functions[?starts_with(FunctionName, \\\`FUNCTION_NAME\\\`) == \\\`true\\\`].FunctionName\""
from awssume.
I'm pretty sure the issue is with Awssume::CommandDecorator; format_cmd joins the args array into a string, and then that is passed to ruby's Kernel.system... but system()
is explicitly designed to perform shell expansion if its argument is a string as opposed to an Array.
A pretty telling example of this comes from Ruby's API documentation:
system("echo *")
system("echo", "*")
produces:
config.h main.rb
*
As to a solution... I'm not 100% sure here, but it looks to me like the only reason that we're converting args from a (non-shell-evaluated) Array to a (shell-evaluated) string is to interpolate the AWS_*
environment variable settings at the beginning of the command line. But we shouldn't have to do that; system()
accepts an optional first env
Hash parameter like spawn, where we can specify environment variables to set as a hash and then pass the command array through unmodified.
i.e. I think this problem would go away if the actual call became something like
system({'AWS_foo' => 'key', ... }, ARGV[0..-1])
or, in terms of an actual implementation, in lib/awssume.rb
, change:
aws_env = {
'AWS_REGION' => config.region,
'AWS_DEFAULT_REGION' => config.region
}
creds_hash = adapter.assume
fmt_cmd = Awssume::CommandDecorator.format_cmd(ARGV[0..-1], creds_hash)
handle_exit { system(aws_env, fmt_cmd) }
to:
aws_env = {
'AWS_REGION' => config.region,
'AWS_DEFAULT_REGION' => config.region
}
adapter.assume.each { |k,v| aws_env["AWS_#{k.upcase}"] = v }
handle_exit { system(aws_env, ARGV[0..-1]) }
... unless I'm missing there being a reason why we're exporting some things directly to the environment, but relying on the shell to export others...?
from awssume.
I also think the is the correct solution.
Do we feel good about a patch?
from awssume.
Related Issues (5)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from awssume.