Open morganics opened 1 week ago
Thanks for the feedback, we’ll investigate asap.
Interesting that shutil.which
can find az
, but the subprocess is unable to resolve it even when passed in os.environ
. From what I understand, shutil.which
also retrieves the PATH
environment variable from os.environ
, which is the environment that should be passed to the subprocess. Something strange must be going on with the subprocess environment. I'm not sure if this stems from our usage of cmd \c
and /bin/sh -c
, however I can't seem to create a reproduction of the case where shutil
can find az
, but the subprocess cannot.
Are you encountering the issue on Windows or a Unix-based OS?
In any case, I am testing out just using the full path of the executable found from shutil.which
, and just calling that directly. This approach should hopefully resolve the issue.
Is your feature request related to a problem? Please describe.
Using os.environ can cause issues in azure_cli.py, e.g. cannot find the
az
command even when az is on the path.Describe the solution you'd like Inject os environment variables in to the identity module, so that we're not dependent on the global os.environ variables.
e.g. line 223 on azure_cli.py
Describe alternatives you've considered Patching os.environ, which isn't great.
Additional context Messy PATHs can stop the
az
command being found, despiteshutil
locating the appropriate path.