turbaszek commented on a change in pull request #11408:
URL: https://github.com/apache/airflow/pull/11408#discussion_r502897572
##########
File path:
airflow/providers/microsoft/azure/operators/azure_container_instances.py
##########
@@ -167,11 +180,28 @@ def __init__(
self.fail_if_exists = fail_if_exists
self._ci_hook: Any = None
self.tags = tags
+ self.os_type = os_type
+ self.restart_policy = restart_policy
+ self.ip_address = ip_address
+ self.ports = ports
def execute(self, context: dict) -> int:
# Check name again in case it was templated.
self._check_name(self.name)
+ if self.os_type not in ['Linux', 'Windows']:
+ raise AirflowException(
+ "Invalid value for the os_type argument. "
+ "Please set 'Linux' or 'Windows' as the os_type. "
+ f"Found `{self.os_type}`."
+ )
+ if self.restart_policy not in ['Always', 'OnFailure', 'Never']:
+ raise AirflowException(
+ "Invalid value for the restart_policy argument. "
+ "Please set one of 'Always', 'OnFailure','Never' as the
restart_policy. "
+ f"Found `{self.restart_policy}`"
+ )
+
Review comment:
Let's move it to constructor to fail as soon as possible
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]