Skip to content

Commit

Permalink
Fix environment metadata accessor (#16009)
Browse files Browse the repository at this point in the history
  • Loading branch information
ofek authored Oct 12, 2023
1 parent 9201801 commit 395bb57
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 8 deletions.
4 changes: 4 additions & 0 deletions ddev/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

***Fixed***:

* Fix environment metadata accessor ([#16009](https://github.com/DataDog/integrations-core/pull/16009))

## 5.2.0 / 2023-10-12

***Added***:
Expand Down
2 changes: 1 addition & 1 deletion ddev/src/ddev/cli/env/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def agent(app: Application, *, intg_name: str, environment: str, args: tuple[str
app.abort(f'Environment `{environment}` for integration `{integration.name}` is not running')

metadata = env_data.read_metadata()
agent_type = metadata.get(E2EMetadata.ENV_VARS, DEFAULT_AGENT_TYPE)
agent_type = metadata.get(E2EMetadata.AGENT_TYPE, DEFAULT_AGENT_TYPE)
agent = get_agent_interface(agent_type)(app.platform, integration, environment, metadata, env_data.config_file)

full_args = list(args)
Expand Down
2 changes: 1 addition & 1 deletion ddev/src/ddev/cli/env/reload.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def reload_command(app: Application, *, intg_name: str, environment: str):
app.abort(f'Environment `{environment}` for integration `{integration.name}` is not running')

metadata = env_data.read_metadata()
agent_type = metadata.get(E2EMetadata.ENV_VARS, DEFAULT_AGENT_TYPE)
agent_type = metadata.get(E2EMetadata.AGENT_TYPE, DEFAULT_AGENT_TYPE)
agent = get_agent_interface(agent_type)(app.platform, integration, environment, metadata, env_data.config_file)

try:
Expand Down
2 changes: 1 addition & 1 deletion ddev/src/ddev/cli/env/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def shell(app: Application, *, intg_name: str, environment: str):
app.abort(f'Environment `{environment}` for integration `{integration.name}` is not running')

metadata = env_data.read_metadata()
agent_type = metadata.get(E2EMetadata.ENV_VARS, DEFAULT_AGENT_TYPE)
agent_type = metadata.get(E2EMetadata.AGENT_TYPE, DEFAULT_AGENT_TYPE)
agent = get_agent_interface(agent_type)(app.platform, integration, environment, metadata, env_data.config_file)

try:
Expand Down
6 changes: 3 additions & 3 deletions ddev/src/ddev/cli/env/show.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def show(app: Application, *, intg_name: str | None, environment: str | None, fo
metadata = env_data.read_metadata()

columns['Name'][i] = name
columns['Agent type'][i] = metadata.get(E2EMetadata.ENV_VARS, DEFAULT_AGENT_TYPE)
columns['Agent type'][i] = metadata.get(E2EMetadata.AGENT_TYPE, DEFAULT_AGENT_TYPE)

app.display_table(active_integration, columns, show_lines=True, force_ascii=force_ascii)
# Display active and available environments for a specific integration
Expand All @@ -54,7 +54,7 @@ def show(app: Application, *, intg_name: str | None, environment: str | None, fo
metadata = env_data.read_metadata()

active_columns['Name'][i] = name
active_columns['Agent type'][i] = metadata.get(E2EMetadata.ENV_VARS, DEFAULT_AGENT_TYPE)
active_columns['Agent type'][i] = metadata.get(E2EMetadata.AGENT_TYPE, DEFAULT_AGENT_TYPE)

with integration.path.as_cwd():
environments = json.loads(
Expand All @@ -81,7 +81,7 @@ def show(app: Application, *, intg_name: str | None, environment: str | None, fo
app.abort(f'Environment `{environment}` for integration `{integration.name}` is not running')

metadata = env_data.read_metadata()
agent_type = metadata.get(E2EMetadata.ENV_VARS, DEFAULT_AGENT_TYPE)
agent_type = metadata.get(E2EMetadata.AGENT_TYPE, DEFAULT_AGENT_TYPE)
agent = get_agent_interface(agent_type)(app.platform, integration, environment, metadata, env_data.config_file)

app.display_pair('Agent type', agent_type)
Expand Down
2 changes: 1 addition & 1 deletion ddev/src/ddev/cli/env/start.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def start(
config = result['config']
env_data.write_config(config)

agent_type = metadata.get(E2EMetadata.ENV_VARS, DEFAULT_AGENT_TYPE)
agent_type = metadata.get(E2EMetadata.AGENT_TYPE, DEFAULT_AGENT_TYPE)
agent = get_agent_interface(agent_type)(app.platform, integration, environment, metadata, env_data.config_file)

if not agent_build:
Expand Down
2 changes: 1 addition & 1 deletion ddev/src/ddev/cli/env/stop.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def stop(app: Application, *, intg_name: str, environment: str, ignore_state: bo
metadata = env_data.read_metadata()
env_vars.update(metadata.get(E2EMetadata.ENV_VARS, {}))

agent_type = metadata.get(E2EMetadata.ENV_VARS, DEFAULT_AGENT_TYPE)
agent_type = metadata.get(E2EMetadata.AGENT_TYPE, DEFAULT_AGENT_TYPE)
agent = get_agent_interface(agent_type)(app.platform, integration, environment, metadata, env_data.config_file)

try:
Expand Down

0 comments on commit 395bb57

Please sign in to comment.