Skip to content

Commit

Permalink
Provide a way to update to the new agent build config format (#3181)
Browse files Browse the repository at this point in the history
  • Loading branch information
ofek authored Feb 21, 2019
1 parent 7cf1e13 commit 2b4eb0a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,11 @@ def start(ctx, check, env, agent, dev, base):
agent_ver = ctx.obj.get('agent{}'.format(agent), agent)
if isinstance(agent_ver, string_types):
agent_build = agent_ver
echo_warning(
'Agent fields missing from ddev config, please update to the latest config, '
'falling back to latest docker image...'
)
if agent_ver != agent:
echo_warning(
'Agent fields missing from ddev config, please update to the latest config via '
'`ddev config update`, falling back to latest docker image...'
)
else:
agent_build = agent_ver.get(env_type, env_type)

Expand Down
13 changes: 13 additions & 0 deletions datadog_checks_dev/datadog_checks/dev/tooling/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,19 @@ def restore_config():
def update_config():
config = copy_default_config()
config.update(load_config())

# Support legacy config where agent5 and agent6 were strings
if isinstance(config['agent6'], string_types):
config['agent6'] = OrderedDict((
('docker', config['agent6']),
('local', 'latest'),
))
if isinstance(config['agent5'], string_types):
config['agent5'] = OrderedDict((
('docker', config['agent5']),
('local', 'latest'),
))

save_config(config)
return config

Expand Down

0 comments on commit 2b4eb0a

Please sign in to comment.