From 7da59e128c73bcbc6367d187df8c70d4a9dff0a0 Mon Sep 17 00:00:00 2001 From: Mike Langmayr Date: Fri, 9 Oct 2026 15:24:57 -0700 Subject: [PATCH] Drop the subsystem shorthand --- README.md | 1 - src/instrumentctl/commands.py | 2 +- src/instrumentctl/instances.py | 15 ++++++--------- src/instrumentctl/product.py | 2 -- 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 7bcd0e7..2f1fc2f 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,6 @@ Everything except `name` is optional. | `user` | `name` | the account the daemons run as | | `ops_group` | `-ops` | the group that may start, stop and deploy without a password | | `env_prefix` | `NAME` | instance files set `_DAEMON`, `_CONFIG` and `_HOST`; operators override paths with `_REPO_DIR`, `_VENV_DIR`, `_ETC_DIR` | -| `subsystem_prefix` | none | set it only where instance names share one, so `start fei` finds `hsfei_*` | | `docs_url` | none | linked from `--help` | | `secrets.key_suffix` | `_env` | a config key ending in this names the variable holding a credential | | `help.example_instance` | `` | used in `--help`, where a real name beats a placeholder | diff --git a/src/instrumentctl/commands.py b/src/instrumentctl/commands.py index 8b6970d..2bcee48 100644 --- a/src/instrumentctl/commands.py +++ b/src/instrumentctl/commands.py @@ -23,7 +23,7 @@ def _err(product: Product, message: str) -> None: def _resolve(paths: Paths, targets: List[str], names: List[str]) -> Optional[List[str]]: """Expand targets, explaining a miss. None means an error was printed.""" try: - return inst.resolve(paths.product, targets, names) + return inst.resolve(targets, names) except TargetError as exc: target, prog = str(exc), paths.product.name if target in inst.in_repo(paths): diff --git a/src/instrumentctl/instances.py b/src/instrumentctl/instances.py index 3cd645d..d4ad13d 100644 --- a/src/instrumentctl/instances.py +++ b/src/instrumentctl/instances.py @@ -190,16 +190,15 @@ def secrets_set(paths: Paths) -> Optional[Dict[str, str]]: return None -def resolve(product: Product, targets: Iterable[str], names: List[str]) -> List[str]: +def resolve(targets: Iterable[str], names: List[str]) -> List[str]: """Expand command-line targets against the instances in ``names``. - A target is an instance name (``hsfei_adc``), a subsystem prefix - (``hsfei``, or just ``fei`` where the product sets one), or ``all``. - Targets keep their command-line order, so ``start power fei`` powers up - before it starts the mechanisms. Duplicates are dropped, and a target - matching nothing is an error. + A target is an instance name (``hsfei_adc``), the prefix every instance in + a subsystem shares (``hsfei``), or ``all``. Targets keep their command-line + order, so ``start hspower hsfei`` powers up before it starts the + mechanisms. Duplicates are dropped, and a target matching nothing is an + error. """ - shorthand = product.subsystem_prefix selected: List[str] = [] for target in targets: if target == "all": @@ -209,8 +208,6 @@ def resolve(product: Product, targets: Iterable[str], names: List[str]) -> List[ else: prefix = target.rstrip("_") + "_" hits = [n for n in names if n.startswith(prefix)] - if not hits and shorthand and not target.startswith(shorthand): - hits = [n for n in names if n.startswith(shorthand + prefix)] if not hits: raise TargetError(target) selected.extend(n for n in hits if n not in selected) diff --git a/src/instrumentctl/product.py b/src/instrumentctl/product.py index e859b5c..06cdbc1 100644 --- a/src/instrumentctl/product.py +++ b/src/instrumentctl/product.py @@ -33,7 +33,6 @@ class Product: # pylint: disable=too-many-instance-attributes user: str ops_group: str env_prefix: str - subsystem_prefix: str secret_key_suffix: str = "_env" docs_url: str = "" # Used only in --help, where a real name beats a placeholder @@ -61,7 +60,6 @@ def load(cls, config: "ConfigSource") -> "Product": user=instrument.get("user", instrument["name"]), ops_group=instrument.get("ops_group", f"{instrument['name']}-ops"), env_prefix=instrument.get("env_prefix", instrument["name"].upper()), - subsystem_prefix=instrument.get("subsystem_prefix", ""), secret_key_suffix=secrets.get("key_suffix", "_env"), docs_url=instrument.get("docs_url", ""), example_instance=help_text.get("example_instance", ""),