Skip to content

Commit 62c0054

Browse files
adwk67claude
andcommitted
refactor: move vendored Flask writer to framework/flask_app_config_writer
Renames the vendored writer back to its upstream name and groups it under a `framework` module (mirroring the convention in trino-operator), signalling it as vendored code that is a candidate for a shared crate. The same writer is still used by superset-operator via the product-config crate. No behaviour change; the writer body is unchanged from the crate source. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 6667f36 commit 62c0054

5 files changed

Lines changed: 23 additions & 9 deletions

File tree

rust/operator-binary/src/airflow_controller.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ use crate::{
9292
v1alpha2,
9393
},
9494
env_vars::{self, build_airflow_template_envs},
95-
flask_config_writer::{self, FlaskAppConfigWriterError},
95+
framework::flask_app_config_writer::{self, FlaskAppConfigWriterError},
9696
operations::{
9797
graceful_shutdown::{
9898
add_airflow_graceful_shutdown_config, add_executor_graceful_shutdown_config,
@@ -754,7 +754,7 @@ fn build_rolegroup_config_map(
754754

755755
let temp_file_footer: Option<String> = config.remove(CONFIG_OVERRIDE_FILE_FOOTER_KEY);
756756

757-
flask_config_writer::write::<AirflowConfigOptions, _, _>(
757+
flask_app_config_writer::write::<AirflowConfigOptions, _, _>(
758758
&mut config_file,
759759
config.iter(),
760760
PYTHON_IMPORTS,

rust/operator-binary/src/crd/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ use crate::{
5555
CeleryBrokerConnection, CeleryResultBackendConnection, MetadataDatabaseConnection,
5656
},
5757
},
58-
flask_config_writer::{FlaskAppConfigOptions, PythonType},
58+
framework::flask_app_config_writer::{FlaskAppConfigOptions, PythonType},
5959
util::role_service_name,
6060
};
6161

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
//! Local helpers vendored from upstream crates, grouped here as candidates for a
2+
//! future shared home (e.g. operator-rs) once one exists.
3+
//!
4+
//! Mirrors the `framework` module convention used by other Stackable operators
5+
//! (e.g. trino-operator) for code that is intentionally duplicated until it can
6+
//! be upstreamed.
7+
8+
pub mod flask_app_config_writer;

rust/operator-binary/src/flask_config_writer.rs renamed to rust/operator-binary/src/framework/flask_app_config_writer.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
//! Writer for Flask App configurations (Python config files).
22
//!
3-
//! Vendored from `product_config::flask_app_config_writer` so airflow-operator can
4-
//! drop the `product-config` crate dependency. Applications based on the Flask App
5-
//! Builder (e.g. Apache Airflow) use configuration files written in Python. This
6-
//! writer only covers top-level assignments of a few primitive types and
7-
//! expressions — it is not a general Python code generator.
3+
//! Vendored verbatim from `product_config::flask_app_config_writer` so
4+
//! airflow-operator can drop the `product-config` crate dependency. Applications
5+
//! based on the Flask App Builder (e.g. Apache Airflow, Apache Superset) use
6+
//! configuration files written in Python. This writer only covers top-level
7+
//! assignments of a few primitive types and expressions — it is not a general
8+
//! Python code generator.
89
//!
910
//! Primitive types are escaped accordingly. Python expressions are written as-is;
1011
//! invalid expressions produce invalid configuration files. Config overrides that do
1112
//! not map to a known option are treated as plain expressions.
13+
//!
14+
// TODO: This is vendored, not airflow-specific. superset-operator still depends on
15+
// `product_config::flask_app_config_writer`; this writer is a candidate for a shared
16+
// crate (e.g. operator-rs) so both operators can drop the product-config crate.
17+
// Until such a home exists it is duplicated here, kept identical to the upstream source.
1218

1319
use std::{
1420
io::{self, Write},

rust/operator-binary/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ mod controller;
4444
mod controller_commons;
4545
mod crd;
4646
mod env_vars;
47-
mod flask_config_writer;
47+
mod framework;
4848
mod operations;
4949
mod product_logging;
5050
mod service;

0 commit comments

Comments
 (0)