docker_swarm_service: Don't override docker-py secret/config defaults (#54611)

* Only supply specified config arguments

* Only supply specified secret arguments
pull/54617/head
Hannes Ljungberg 6 years ago committed by ansibot
parent acaf91d5f0
commit d56e64f3cd

@ -1815,31 +1815,47 @@ class DockerService(DockerBaseClass):
if self.configs is not None: if self.configs is not None:
configs = [] configs = []
for config_config in self.configs: for config_config in self.configs:
configs.append( config_args = {
types.ConfigReference( 'config_id': config_config['config_id'],
config_id=config_config['config_id'], 'config_name': config_config['config_name']
config_name=config_config['config_name'], }
filename=config_config.get('filename'), filename = config_config.get('filename')
uid=config_config.get('uid'), if filename:
gid=config_config.get('gid'), config_args['filename'] = filename
mode=config_config.get('mode') uid = config_config.get('uid')
) if uid:
) config_args['uid'] = uid
gid = config_config.get('gid')
if gid:
config_args['gid'] = gid
mode = config_config.get('mode')
if mode:
config_args['mode'] = mode
configs.append(types.ConfigReference(**config_args))
secrets = None secrets = None
if self.secrets is not None: if self.secrets is not None:
secrets = [] secrets = []
for secret_config in self.secrets: for secret_config in self.secrets:
secrets.append( secret_args = {
types.SecretReference( 'secret_id': secret_config['secret_id'],
secret_id=secret_config['secret_id'], 'secret_name': secret_config['secret_name']
secret_name=secret_config['secret_name'], }
filename=secret_config.get('filename'), filename = secret_config.get('filename')
uid=secret_config.get('uid'), if filename:
gid=secret_config.get('gid'), secret_args['filename'] = filename
mode=secret_config.get('mode') uid = secret_config.get('uid')
) if uid:
) secret_args['uid'] = uid
gid = secret_config.get('gid')
if gid:
secret_args['gid'] = gid
mode = secret_config.get('mode')
if mode:
secret_args['mode'] = mode
secrets.append(types.SecretReference(**secret_args))
dns_config_args = {} dns_config_args = {}
if self.dns is not None: if self.dns is not None:

Loading…
Cancel
Save