Merge pull request #4173 from chouseknecht/fix_entrypoint

Fix entrypoint. Should behave the same as command.
reviewable/pr18780/r1
Chris Houseknecht 8 years ago committed by GitHub
commit 77db7011f0

@ -48,7 +48,7 @@ options:
version_added: 2.2 version_added: 2.2
command: command:
description: description:
- Command or list of commands to execute in the container when it starts. - Command to execute when the container starts.
default: null default: null
required: false required: false
cpu_period: cpu_period:
@ -113,7 +113,7 @@ options:
required: false required: false
entrypoint: entrypoint:
description: description:
- String or list of commands that overwrite the default ENTRYPOINT of the image. - Command that overwrites the default ENTRYPOINT of the image.
default: null default: null
required: false required: false
etc_hosts: etc_hosts:
@ -1137,7 +1137,7 @@ class Container(DockerBaseClass):
Diff parameters vs existing container config. Returns tuple: (True | False, List of differences) Diff parameters vs existing container config. Returns tuple: (True | False, List of differences)
''' '''
self.log('Starting has_different_configuration') self.log('Starting has_different_configuration')
self.parameters.expected_entrypoint = self._get_expected_entrypoint(image) self.parameters.expected_entrypoint = self._get_expected_entrypoint()
self.parameters.expected_links = self._get_expected_links() self.parameters.expected_links = self._get_expected_links()
self.parameters.expected_ports = self._get_expected_ports() self.parameters.expected_ports = self._get_expected_ports()
self.parameters.expected_exposed = self._get_expected_exposed(image) self.parameters.expected_exposed = self._get_expected_exposed(image)
@ -1395,17 +1395,11 @@ class Container(DockerBaseClass):
extra_networks.append(dict(name=network, id=network_config['NetworkID'])) extra_networks.append(dict(name=network, id=network_config['NetworkID']))
return extra, extra_networks return extra, extra_networks
def _get_expected_entrypoint(self, image): def _get_expected_entrypoint(self):
self.log('_get_expected_entrypoint') self.log('_get_expected_entrypoint')
if isinstance(self.parameters.entrypoint, list): if not self.parameters.entrypoint:
entrypoint = self.parameters.entrypoint
else:
entrypoint = []
if image and image['ContainerConfig'].get('Entrypoint'):
entrypoint = list(set(entrypoint + image['ContainerConfig'].get('Entrypoint')))
if len(entrypoint) == 0:
return None return None
return entrypoint return shlex.split(self.parameters.entrypoint)
def _get_expected_ports(self): def _get_expected_ports(self):
if not self.parameters.published_ports: if not self.parameters.published_ports:
@ -1870,7 +1864,7 @@ def main():
dns_search_domains=dict(type='list'), dns_search_domains=dict(type='list'),
env=dict(type='dict'), env=dict(type='dict'),
env_file=dict(type='path'), env_file=dict(type='path'),
entrypoint=dict(type='list'), entrypoint=dict(type='str'),
etc_hosts=dict(type='dict'), etc_hosts=dict(type='dict'),
exposed_ports=dict(type='list', aliases=['exposed', 'expose']), exposed_ports=dict(type='list', aliases=['exposed', 'expose']),
force_kill=dict(type='bool', default=False, aliases=['forcekill']), force_kill=dict(type='bool', default=False, aliases=['forcekill']),

Loading…
Cancel
Save