77
88from __future__ import annotations
99
10- from typing import Any , Dict , List , override
10+ from typing import Any , Dict , override
1111from pathlib import Path
1212
1313import yaml
@@ -118,7 +118,7 @@ def get_config_for_env(self, env_name: str) -> AgentEnvironmentConfig:
118118 )
119119 return self .environments [env_name ]
120120
121- def get_configs_for_env (self , env : str ) -> dict [str , AgentEnvironmentConfig ]:
121+ def get_configs_for_env (self , env_target : str ) -> dict [str , AgentEnvironmentConfig ]:
122122 """Get configuration for a specific environment based on the expected mapping.
123123 The environment is either:
124124 1. explicitly specified like so using a key-map in the environments conifg:
@@ -146,7 +146,7 @@ def get_configs_for_env(self, env: str) -> dict[str, AgentEnvironmentConfig]:
146146 if the environment field is not explicitly set, we assume its the same as
147147 the name of the environment
148148 Args:
149- env_name : Name of the environment (e.g., 'dev', 'prod')
149+ env_target : Name of the environment target (e.g., 'dev', 'prod')
150150
151151 Returns:
152152 AgentEnvironmentConfig for the specified environment
@@ -155,22 +155,26 @@ def get_configs_for_env(self, env: str) -> dict[str, AgentEnvironmentConfig]:
155155 ValueError: If environment is not found
156156 """
157157 envs_to_deploy = {}
158- if env in self .environments :
158+ if env_target in self .environments :
159159 # this supports if the top-level key is just "dev, staging, etc" and matches
160160 # the environment name exactly without any explicit mapping
161- envs_to_deploy [env ] = self .environments [env ]
161+ envs_to_deploy [env_target ] = self .environments [env_target ]
162162
163163 for env_name , config in self .environments .items ():
164- if config .environment == env :
164+ if config .environment == env_target :
165165 envs_to_deploy [env_name ] = config
166166
167167 if len (envs_to_deploy ) == 0 :
168- available_envs = [env .environment for env in self .environments .values () if env .environment ] + [
169- env_name for env_name in self .environments
170- ]
171- unique_names = set (available_envs )
168+ ## this just finds environments for each target, so "available_envs" refers to each target environment
169+
170+ available_envs = set ()
171+ for env_name , config in self .environments .items ():
172+ if config .environment is not None :
173+ available_envs .add (config .environment )
174+ else :
175+ available_envs .add (env_name )
172176 raise ValueError (
173- f"Environment '{ env } ' not found in environments.yaml. Available environments: { unique_names } "
177+ f"Environment '{ env_target } ' not found in environments.yaml. Available environments: { available_envs } "
174178 )
175179
176180 return envs_to_deploy
0 commit comments