mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 06:12:51 +00:00
PEP 8 W291 whitespace cleanup.
This commit is contained in:
@@ -138,7 +138,7 @@ options:
|
||||
- exposed
|
||||
force_kill:
|
||||
description:
|
||||
- Use the kill command when stopping a running container.
|
||||
- Use the kill command when stopping a running container.
|
||||
default: false
|
||||
required: false
|
||||
groups:
|
||||
@@ -159,7 +159,7 @@ options:
|
||||
recreated. Stop this behavior by setting C(ignore_image) to I(True).
|
||||
default: false
|
||||
required: false
|
||||
version_added: "2.2"
|
||||
version_added: "2.2"
|
||||
image:
|
||||
description:
|
||||
- Repository path and tag used to create the container. If an image is not found or pull is true, the image
|
||||
@@ -313,10 +313,10 @@ options:
|
||||
any other mappings.
|
||||
- If C(networks) parameter is provided, will inspect each network to see if there exists
|
||||
a bridge network with optional parameter com.docker.network.bridge.host_binding_ipv4.
|
||||
If such a network is found, then published ports where no host IP address is specified
|
||||
If such a network is found, then published ports where no host IP address is specified
|
||||
will be bound to the host IP pointed to by com.docker.network.bridge.host_binding_ipv4.
|
||||
Note that the first bridge network with a com.docker.network.bridge.host_binding_ipv4
|
||||
value encountered in the list of C(networks) is the one that will be used.
|
||||
Note that the first bridge network with a com.docker.network.bridge.host_binding_ipv4
|
||||
value encountered in the list of C(networks) is the one that will be used.
|
||||
aliases:
|
||||
- ports
|
||||
required: false
|
||||
@@ -394,7 +394,7 @@ options:
|
||||
re-create a matching container, even if it is running. Use restart to force a matching container to be stopped and
|
||||
restarted. Use force_kill to kill a container rather than stopping it. Use keep_volumes to retain volumes associated
|
||||
with a removed container.'
|
||||
- 'I(stopped) - Asserts that the container is first I(present), and then if the container is running moves it to a stopped
|
||||
- 'I(stopped) - Asserts that the container is first I(present), and then if the container is running moves it to a stopped
|
||||
state. Use force_kill to kill a container rather than stopping it.'
|
||||
required: false
|
||||
default: started
|
||||
@@ -518,7 +518,7 @@ EXAMPLES = '''
|
||||
name: mycontainer
|
||||
state: present
|
||||
image: ubuntu:14.04
|
||||
command: sleep infinity
|
||||
command: sleep infinity
|
||||
|
||||
- name: Stop a container
|
||||
docker_container:
|
||||
@@ -1210,7 +1210,7 @@ class Container(DockerBaseClass):
|
||||
# assuming if the container was running, it must have been detached.
|
||||
detach = not (config.get('AttachStderr') and config.get('AttachStdout'))
|
||||
|
||||
# "ExposedPorts": null returns None type & causes AttributeError - PR #5517
|
||||
# "ExposedPorts": null returns None type & causes AttributeError - PR #5517
|
||||
if config.get('ExposedPorts') is not None:
|
||||
expected_exposed = [re.sub(r'/.+$', '', p) for p in config.get('ExposedPorts', dict()).keys()]
|
||||
else:
|
||||
@@ -1874,7 +1874,7 @@ class ContainerManager(DockerBaseClass):
|
||||
return self._get_container(container_id)
|
||||
|
||||
def container_remove(self, container_id, link=False, force=False):
|
||||
volume_state = (not self.parameters.keep_volumes)
|
||||
volume_state = (not self.parameters.keep_volumes)
|
||||
self.log("remove container container:%s v:%s link:%s force%s" % (container_id, volume_state, link, force))
|
||||
self.results['actions'].append(dict(removed=container_id, volume_state=volume_state, link=link, force=force))
|
||||
self.results['changed'] = True
|
||||
|
||||
@@ -503,24 +503,24 @@ AUTH_PARAM_MAPPING = {
|
||||
|
||||
@contextmanager
|
||||
def stdout_redirector(path_name):
|
||||
old_stdout = sys.stdout
|
||||
old_stdout = sys.stdout
|
||||
fd = open(path_name, 'w')
|
||||
sys.stdout = fd
|
||||
try:
|
||||
yield
|
||||
finally:
|
||||
sys.stdout = old_stdout
|
||||
sys.stdout = old_stdout
|
||||
|
||||
def get_stdout(path_name):
|
||||
full_stdout = ''
|
||||
last_line = ''
|
||||
last_line = ''
|
||||
with open(path_name, 'r') as fd:
|
||||
for line in fd:
|
||||
# strip terminal format/color chars
|
||||
new_line = re.sub(r'\x1b\[.+m', '', line.encode('ascii'))
|
||||
full_stdout += new_line
|
||||
if new_line.strip():
|
||||
# Assuming last line contains the error message
|
||||
# Assuming last line contains the error message
|
||||
last_line = new_line.strip().encode('utf-8')
|
||||
fd.close()
|
||||
os.remove(path_name)
|
||||
@@ -666,12 +666,12 @@ class ContainerManager(DockerBaseClass):
|
||||
|
||||
if self.pull:
|
||||
pull_output = self.cmd_pull()
|
||||
result['changed'] = pull_output['changed']
|
||||
result['changed'] = pull_output['changed']
|
||||
result['actions'] += pull_output['actions']
|
||||
|
||||
if self.build:
|
||||
build_output = self.cmd_build()
|
||||
result['changed'] = build_output['changed']
|
||||
result['changed'] = build_output['changed']
|
||||
result['actions'] += build_output['actions']
|
||||
|
||||
for service in self.project.services:
|
||||
@@ -679,8 +679,8 @@ class ContainerManager(DockerBaseClass):
|
||||
plan = service.convergence_plan(strategy=converge)
|
||||
if plan.action != 'noop':
|
||||
result['changed'] = True
|
||||
result_action = dict(service=service.name)
|
||||
result_action[plan.action] = []
|
||||
result_action = dict(service=service.name)
|
||||
result_action[plan.action] = []
|
||||
for container in plan.containers:
|
||||
result_action[plan.action].append(dict(
|
||||
id=container.id,
|
||||
@@ -712,17 +712,17 @@ class ContainerManager(DockerBaseClass):
|
||||
|
||||
if self.stopped:
|
||||
stop_output = self.cmd_stop(service_names)
|
||||
result['changed'] = stop_output['changed']
|
||||
result['changed'] = stop_output['changed']
|
||||
result['actions'] += stop_output['actions']
|
||||
|
||||
if self.restarted:
|
||||
restart_output = self.cmd_restart(service_names)
|
||||
result['changed'] = restart_output['changed']
|
||||
result['changed'] = restart_output['changed']
|
||||
result['actions'] += restart_output['actions']
|
||||
|
||||
if self.scale:
|
||||
scale_output = self.cmd_scale()
|
||||
result['changed'] = scale_output['changed']
|
||||
result['changed'] = scale_output['changed']
|
||||
result['actions'] += scale_output['actions']
|
||||
|
||||
for service in self.project.services:
|
||||
@@ -791,7 +791,7 @@ class ContainerManager(DockerBaseClass):
|
||||
if not self.check_mode:
|
||||
for service in self.project.get_services(self.services, include_deps=False):
|
||||
if 'image' not in service.options:
|
||||
continue
|
||||
continue
|
||||
|
||||
self.log('Pulling image for service %s' % service.name)
|
||||
# store the existing image ID
|
||||
@@ -809,16 +809,16 @@ class ContainerManager(DockerBaseClass):
|
||||
try:
|
||||
service.pull(ignore_pull_failures=False)
|
||||
except Exception as exc:
|
||||
self.client.fail("Error: pull failed with %s" % str(exc))
|
||||
self.client.fail("Error: pull failed with %s" % str(exc))
|
||||
|
||||
# store the new image ID
|
||||
new_image_id = ''
|
||||
new_image_id = ''
|
||||
try:
|
||||
image = service.image()
|
||||
if image and image.get('Id'):
|
||||
new_image_id = image['Id']
|
||||
except NoSuchImageError as exc:
|
||||
self.client.fail("Error: service image lookup failed after pull - %s" % str(exc))
|
||||
self.client.fail("Error: service image lookup failed after pull - %s" % str(exc))
|
||||
|
||||
if new_image_id != old_image_id:
|
||||
# if a new image was pulled
|
||||
@@ -856,13 +856,13 @@ class ContainerManager(DockerBaseClass):
|
||||
try:
|
||||
new_image_id = service.build(pull=True, no_cache=self.nocache)
|
||||
except Exception as exc:
|
||||
self.client.fail("Error: build failed with %s" % str(exc))
|
||||
self.client.fail("Error: build failed with %s" % str(exc))
|
||||
|
||||
if new_image_id not in old_image_id:
|
||||
# if a new image was built
|
||||
result['changed'] = True
|
||||
result['actions'].append(dict(
|
||||
service=service.name,
|
||||
service=service.name,
|
||||
built_image=dict(
|
||||
name=service.image_name,
|
||||
id=new_image_id
|
||||
@@ -901,7 +901,7 @@ class ContainerManager(DockerBaseClass):
|
||||
service_res = dict(
|
||||
service=service.name,
|
||||
stop=[]
|
||||
)
|
||||
)
|
||||
for container in service.containers(stopped=False):
|
||||
result['changed'] = True
|
||||
service_res['stop'].append(dict(
|
||||
@@ -977,7 +977,7 @@ class ContainerManager(DockerBaseClass):
|
||||
service.scale(int(self.scale[service.name]))
|
||||
except Exception as exc:
|
||||
self.client.fail("Error scaling %s - %s" % (service.name, str(exc)))
|
||||
result['actions'].append(service_res)
|
||||
result['actions'].append(service_res)
|
||||
return result
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user