Skip to content

Commit

Permalink
Set logging level default to INFO
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardobranco777 committed Aug 9, 2023
1 parent c16e080 commit 727962f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 16 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ options:
-h, --help show this help message and exit
--dry-run Don't remove anything
-l {debug,info,warning,error,critical}, --log {debug,info,warning,error,critical}
Log level
Log level (default is info)
-x, --remove Remove the specified images or repositories
-V, --version Show version and exit
```
Expand Down
6 changes: 3 additions & 3 deletions clean_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def garbage_collect(self) -> None:
stderr=subprocess.STDOUT
) as proc:
for line in proc.stdout:
logging.info(line.decode('utf-8'), end='')
logging.info(line.decode('utf-8').rstrip())
proc.communicate() # Wait for the process to complete


Expand All @@ -215,9 +215,9 @@ def parse_args():
'--dry-run', action='store_true',
help="Don't remove anything")
parser.add_argument(
'-l', '--log', default='error',
'-l', '--log', default='info',
choices='debug info warning error critical'.split(),
help="Log level")
help="Log level (default is info)")
parser.add_argument(
'-x', '--remove', action='store_true',
help="Remove the specified images or repositories")
Expand Down
17 changes: 5 additions & 12 deletions tests/e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,12 @@ set -e

cleanup() {
set +e
echo -e "\nCleaning up from test..."
echo -e "\nCleaning up for $runtime\n"
for runtime in podman docker ; do
image_ids=()
for image in "$regclean:test" "$regclean:latest" "$scratch" ; do
images_ids+=("$(docker images --no-trunc --format '{{.ID}}' "$image")")
"$runtime" rmi "$image"
done
images_ids+=("$(docker images --no-trunc --format '{{.ID}}' "$regclean")")
for image_id in "${image_ids[@]}" ; do
"$runtime" rmi "$image_id"
done
"$runtime" rm -vf "$registry"
# shellcheck disable=SC2046
"$runtime" rmi -f $("$runtime" images --no-trunc --format '{{.ID}}' "localhost:$random_port/*" | sort -u)
done
podman rm -vf "$registry"
sudo rm -rf "$directory"
}

Expand All @@ -30,7 +23,7 @@ get_random_port() {
random_port=$(get_random_port)
directory="$PWD/registry$random_port"
regclean="localhost:$random_port/clean_registry"
scratch="localhost/scratch$random_port"
scratch="localhost:$random_port/scratch"
registry="registry$random_port"

# Build once, load anywhere...
Expand Down

0 comments on commit 727962f

Please sign in to comment.