olegkachur-e commented on code in PR #54452:
URL: https://github.com/apache/airflow/pull/54452#discussion_r2284542124


##########
airflow-core/src/airflow/configuration.py:
##########
@@ -902,7 +902,16 @@ def _get_cmd_option(self, section: str, key: str):
         if (section, key) in self.sensitive_config_values:
             if super().has_option(section, fallback_key):
                 command = super().get(section, fallback_key)
-                return run_command(command)
+                try:
+                    cmd_output = run_command(command)
+                except AirflowConfigException as e:
+                    raise e
+                except Exception as e:
+                    raise AirflowConfigException(
+                        f"Cannot run the command for the config section 
[{section}]{fallback_key}_cmd."
+                        f" Please check the {fallback_key} value."
+                    ) from e

Review Comment:
   Thanks for your review!
   >can't this specific error be raised from the run_command it self?
   
   I guess it can, but I see two possible issues with it:
   1) Don't want to "pollute" `run_command` with this kind of command 
validation, i think it is a responsibility of 'outside' caller to verify the 
command itself is valid.
   2) Is it safe to expose (log) full command that runs from the sensitive 
config values?
   
   @Programmer-RD-AI @potiuk  WDYT?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to