Skip to content

Commit

Permalink
Merge pull request #5 from locp/bugfix/duplicated_logs
Browse files Browse the repository at this point in the history
Fix problem with duplicated bugs
  • Loading branch information
dallinb authored Dec 18, 2021
2 parents f7ca420 + 9931020 commit ce1db20
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 7 deletions.
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
# Changelog


## 0.2.2
## 0.2.3

### New

* Add Docker Compose example. [Ben Dalling]

### Fix

* Stop duplicated log messages. [Ben Dalling]


## 0.2.2 (2021-11-23)

### New

Expand Down
Binary file modified docs/.doctrees/environment.pickle
Binary file not shown.
Binary file modified docs/.doctrees/index.doctree
Binary file not shown.
46 changes: 46 additions & 0 deletions docs/docker-hub-README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,49 @@ to the script.
For full documentation, see the project home at https://github.com/locp/wait4localstack

To raise issues please go to https://github.com/locp/wait4localstack/issues

## Examples

### Docker Compose

Given a Docker Compose file like the following:

```yaml
---
version: "3"

services:
localstack:
container_name: "${LOCALSTACK_DOCKER_NAME-localstack}"
image: localstack/localstack:0.13.1
ports:
- "127.0.0.1:53:53" # only required for Pro
- "127.0.0.1:53:53/udp" # only required for Pro
- "127.0.0.1:443:443" # only required for Pro
- "127.0.0.1:4510-4530:4510-4530" # only required for Pro
- "127.0.0.1:4566:4566"
- "127.0.0.1:4571:4571"
environment:
- SERVICES=${SERVICES-iam}
- DEBUG=1
- DATA_DIR=${DATA_DIR- }
- LAMBDA_EXECUTOR=docker-reuse
- HOST_TMP_FOLDER=${TMPDIR:-/tmp/}
- DOCKER_HOST=unix:///var/run/docker.sock
volumes:
- "${TMPDIR:-/tmp}/localstack:/tmp/localstack"
- "/var/run/docker.sock:/var/run/docker.sock"

wait4localstack:
command: -de http://localstack:4566/health
container_name: wait4localstack
depends_on:
- localstack
image: "locp/wait4localstack:${DOCKER_IMAGE_TAG-latest}"
```
Run the following command to bring up Localstack and wait for it to be ready:
```shell
docker-compose -f examples/docker-compose.yml run --rm wait4localstack
```
2 changes: 1 addition & 1 deletion examples/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: "3"
services:
localstack:
container_name: "${LOCALSTACK_DOCKER_NAME-localstack}"
image: localstack/localstack:0.13.0
image: localstack/localstack:0.13.1
ports:
- "127.0.0.1:53:53" # only required for Pro
- "127.0.0.1:53:53/udp" # only required for Pro
Expand Down
2 changes: 1 addition & 1 deletion tests/features/wait4localstack.feature
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Feature: Wait4Localstack
Then expect package response to match <package_response>
Examples:
| testinfra_package | resource_name | package_response |
| file.exists | /tmp/dist/wait4localstack-0.2.2.tar.gz | True |
| file.exists | /tmp/dist/wait4localstack-0.2.3.tar.gz | True |
| file.exists | /usr/local/bin/entrypoint.sh | True |
| file.exists | /usr/local/bin/wait4localstack | True |
| host.run | /usr/local/bin/wait4localstack -h | 0 |
Expand Down
2 changes: 1 addition & 1 deletion wait4localstack/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2.2
0.2.3
6 changes: 3 additions & 3 deletions wait4localstack/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,8 @@ def __init__(self, localstack_endpoint='http://localhost:4566/health',
self._logger = None
self._maximum_retries = None
self._test_interval = None
logging.basicConfig()
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
logger = logging.getLogger('wait4localstack')
handler = logging.StreamHandler()
logger.addHandler(handler)
logger.setLevel(log_level)
self.logger(logger)
self.exponential_backoff(exponential_backoff)
Expand Down Expand Up @@ -237,6 +235,8 @@ def wait_for_all_services(self):
attempts += 1
time.sleep(sleep_time)

logger.info(f'The following service(s) are {status} {",".join(service_names)}.')


def command_line_interface(args):
"""
Expand Down

0 comments on commit ce1db20

Please sign in to comment.