Skip to content
This repository has been archived by the owner on Feb 22, 2020. It is now read-only.

Commit

Permalink
fix(composer): fix yaml generation
Browse files Browse the repository at this point in the history
  • Loading branch information
hanhxiao committed Aug 6, 2019
1 parent e5fefce commit 2191b27
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions gnes/composer/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,11 @@ def build_dockerswarm(all_layers: List['YamlComposer.Layer'], docker_img: str =
args = ['--%s %s' % (a, str(v) if ' ' not in str(v) else ('"%s"' % str(v))) for a, v in c.items() if
a in YamlComposer.comp2args[c['name']] and a != 'yaml_path' and v]
if 'yaml_path' in c and c['yaml_path'] is not None:
args.append('--yaml_path /%s_yaml' % c_name)
config_dict['%s_yaml' % c_name] = {'file': c['yaml_path']}
if c['yaml_path'].endswith('.yml') or c['yaml_path'].endswith('.yaml'):
args.append('--yaml_path /%s_yaml' % c_name)
config_dict['%s_yaml' % c_name] = {'file': c['yaml_path']}
else:
args.append('--yaml_path %s' % c['yaml_path'])

if l_idx + 1 < len(all_layers):
next_layer = all_layers[l_idx + 1]
Expand Down Expand Up @@ -237,7 +240,8 @@ def build_dockerswarm(all_layers: List['YamlComposer.Layer'], docker_img: str =
}
})

if 'yaml_path' in c and c['yaml_path'] is not None:
if 'yaml_path' in c and c['yaml_path'] is not None \
and (c['yaml_path'].endswith('.yml') or c['yaml_path'].endswith('.yaml')):
swarm_lines['services'][c_name]['configs'] = ['%s_yaml' % c_name]

if c['name'] == 'gRPCFrontend':
Expand Down

0 comments on commit 2191b27

Please sign in to comment.