Skip to content

Commit

Permalink
fix astro dev init -v
Browse files Browse the repository at this point in the history
  • Loading branch information
andriisoldatenko committed Jun 17, 2021
1 parent 6012d86 commit debce80
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions cmd/airflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,11 +278,25 @@ func airflowInit(cmd *cobra.Command, args []string, client *houston.Client, out
httpClient := airflowversions.NewClient(httputil.NewHTTPClient())
defaultImageTag, _ := airflowversions.GetDefaultImageTag(httpClient, "")

// TODO: @andriisoldatenko rethink or remove this logic
// acceptableAirflowVersions := wsResp.Data.DeploymentConfig.AirflowVersions
// if airflowVersion != "" && !acceptableVersion(airflowVersion, acceptableAirflowVersions) {
// return errors.Errorf(messages.ERROR_INVALID_AIRFLOW_VERSION, strings.Join(acceptableAirflowVersions, ", "))
// }
r := houston.Request{
Query: houston.DeploymentInfoRequest,
}

defaultImageTag := ""
wsResp, err := r.DoWithClient(client)
if err == nil {
defaultImageTag = wsResp.Data.DeploymentConfig.DefaultAirflowImageTag
}

if err == nil {
acceptableAirflowVersions := wsResp.Data.DeploymentConfig.AirflowVersions
if airflowVersion != "" && !acceptableVersion(airflowVersion, acceptableAirflowVersions) {
return errors.Errorf(messages.ERROR_INVALID_AIRFLOW_VERSION, strings.Join(acceptableAirflowVersions, ", "))
}
defaultImageTag = fmt.Sprintf("%s-buster-onbuild", airflowVersion)
} else if airflowVersion != "" {
return errors.New("you can't use --airflow-version option while not authenticated to a cluster")
}

if len(defaultImageTag) == 0 {
defaultImageTag = "2.0.0-buster-onbuild"
Expand Down

0 comments on commit debce80

Please sign in to comment.