Versent / saml2aws

CLI tool which enables you to login and retrieve AWS temporary credentials using a SAML IDP
https://github.com/Versent/saml2aws
MIT License
2.08k stars 562 forks source link

Executable file not in $PATH #1055

Open lxadtz33 opened 1 year ago

lxadtz33 commented 1 year ago

To whom it may concern,

Recently I did an upgrade (via brew) to 2.36.7. Unfortunately I don't recall the previous version I was using. After the update I started to get this error exec: "pipenv run chalice local --port 8980": executable file not found in $PATH

This is the saml2aws command that has been working until upgrading to 2.36.7 saml2aws exec -a AWS-profile "pipenv run chalice local --port 8980"

I did get the error to stop by removing the wrapping double quotes ("") saml2aws exec -a AWS-profile pipenv run chalice local --port 8980 but then it complained about --port 8980, because saml2aws assumed it was its option and not part of the chalice command

This worked, without --port 8980 saml2aws exec -a AWS-profile pipenv run chalice local

I'm not the only one on the team experiencing this. Any help would be great.

Thanks in advance, Fred

mapkon commented 1 year ago

Hey @lxadtz33 Will this fix your issue? https://github.com/Versent/saml2aws/pull/1056

kmcduffee-verisk commented 1 year ago

@mapkon The bug topic is not really reflective of what is going on (and I have seen this error as well).

The problem is that, previously, one could submit the exec command with a double-hyphen flag like --port 8080 but now that seems to be getting interpreted as a command, which of course does not exist.

mapkon commented 1 year ago

That is interesting. I am not sure how that got mangled up. If you can submit a PR, I can look to merge it. CC: @gliptak

kmcduffee-verisk commented 1 year ago

Possibly more context/example:

➜  ~ which pipenv
/opt/homebrew/bin/pipenv
➜  ~ saml2aws exec -a AWS-profile "/opt/homebrew/bin/pipenv run chalice local --port 8980"
fork/exec /opt/homebrew/bin/pipenv run chalice local --port 8980: no such file or directory

Putting the command to be executed in quotes used to work, but without it the --port flag gets passed to saml2aws

lxadtz33 commented 1 year ago

@mapkon #1056 will not fix the issue. I install saml2aws via brew. My original post, and what @kmcduffee-verisk also stated, we can use saml2aws, but now one can't wrap the sub-command and its options with double quotes

mapkon commented 1 year ago

If any of you can submit a PR, we can work to get it merged ASAP.

kmcduffee-verisk commented 1 year ago

@mapkon ☝️ (that's me)

kmcduffee-verisk commented 1 year ago

This is the PR that broke the behavior: #737

The commit log says "it can always be wrapped in a shell on the command line" but that does not seem to work when provided a quoted string, at least on OS X.

An alternative might be to check if cmdline is wrapped in quotes and only then concat the command. Open to feedback and I can provide a change in that direction.

kmcduffee-verisk commented 1 year ago

After some investigation, it appears just using the current version and prefixing the command with -- allows the command to work as expected. This perhaps should be in the documentation somewhere.

mapkon commented 1 year ago

That is great to hear. Maybe if you can still submit a documentation ticket, I will merge it ASAP!