Closed cdabella closed 9 months ago
Good stuff - I guess my questions are if ps
, grep
, or /bin/airflow
would ever be reasonably expected to not be there?
We could feature flag this like the airgap mode, as a fallback if python
doesn't work out of the box?
Wanna make a PR?
There's now docs/
if you want to add a snippet for that AIRFLOW_REPORT_CMD
The current
AIRFLOW_REPORT_CMD
usespython
to run the report package.https://github.com/astronomer/telescope/blob/b837a2c7730bfabbf03aa51665db8202b4a6b1b3/astronomer_telescope/getter_util.py#L31-L37
For many Airflow installations, especially single-host Airflow deployments, it is more common for Airflow to be installed within a virtualenv of some flavor. Using logic similar to the following, we can make this support targeting Airflow under whatever python binary it might be running without manual user intervention.
If we don't want to add/test baking the functionality into the package itself, we can atleast at the following to the documentation, which takes the above, minifies and escapes the code, and sets it as the
TELESCOPE_AIRFLOW_REPORT_CMD
envvar.NOTE
There is probably a cleaner way of determining the python binary path, something like the following, but I was unable to get the interplay of
shlex.split
andshlex.join
to run the subshell, probably because of the the security features ofshlex.quote
https://docs.python.org/3/library/shlex.html#shlex.quote. I tried usingshlex.shlex
withpunctuation_chars=True
andpunctuation_chars="();<>|&$"
with no success in getting the appropriate tokenization.