Skip to content

Commit 24cf5b2

Browse files
committed
fix(odoo_scripts): remove unnecessary caret anchor in container name filter
- Removed '^' anchor from `docker ps` name filter in multiple Odoo and PostgreSQL scripts - Ensures more flexible container name matching without requiring exact prefix match - Fixes potential issues where container names might not be detected due to anchoring
1 parent 5121848 commit 24cf5b2

File tree

8 files changed

+8
-8
lines changed

8 files changed

+8
-8
lines changed

roles/odoo_scripts/files/docker-odoo-backup

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ fi
7171
filepath="${dir}/${file}"
7272

7373
# Switch container name with id
74-
container_id=$(docker ps -f "name=^${container}" -q | tail -n1)
74+
container_id=$(docker ps -f "name=${container}" -q | tail -n1)
7575
[[ -z "$container_id" ]] && { echo "Container id for $container not found." ; exit 1; }
7676

7777
echo "Backup database $database to $filepath ..."

roles/odoo_scripts/files/docker-odoo-duplicate

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ done
6565
[[ "$target_database" == "$source_database" ]] && { echo 'Parameter -s|source and -t|target cannot be the same' ; exit 1; }
6666

6767
# Switch container name with id
68-
container_id=$(docker ps -f "name=^${container}" -q | tail -n1)
68+
container_id=$(docker ps -f "name=${container}" -q | tail -n1)
6969
[[ -z "$container_id" ]] && { echo "Container id for $container not found." ; exit 1; }
7070

7171
# Set alias

roles/odoo_scripts/files/docker-odoo-init

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ done
5959
[[ -z "$modules" ]] && { echo 'Parameter -i|init is empty' ; exit 1; }
6060

6161
# Switch container name with id
62-
container_id=$(docker ps -f "name=^${container}" -q | tail -n1)
62+
container_id=$(docker ps -f "name=${container}" -q | tail -n1)
6363
[[ -z "$container_id" ]] && { echo "Container id for $container not found." ; exit 1; }
6464

6565
# Init modules on database

roles/odoo_scripts/files/docker-odoo-rename

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ done
5656
[[ "$target_database" == "$source_database" ]] && { echo 'Parameter -s|source and -t|target cannot be the same' ; exit 1; }
5757

5858
# Switch container name with id
59-
container_id=$(docker ps -f "name=^${container}" -q | tail -n1)
59+
container_id=$(docker ps -f "name=${container}" -q | tail -n1)
6060
[[ -z "$container_id" ]] && { echo "Container id for $container not found." ; exit 1; }
6161

6262
# Set alias

roles/odoo_scripts/files/docker-odoo-shell

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ done
5555
[[ -z "$database" ]] && { echo 'Parameter -d|database is empty' ; exit 1; }
5656

5757
# Switch container name with id
58-
container_id=$(docker ps -f "name=^${container}" -q | tail -n1)
58+
container_id=$(docker ps -f "name=${container}" -q | tail -n1)
5959
[[ -z "$container_id" ]] && { echo "Container id for $container not found." ; exit 1; }
6060

6161
# Escape quotes

roles/postgres/files/docker-postgres-duplicate

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ done
5454
[[ "$target_database" == "$source_database" ]] && { echo 'Parameter -s|source and -t|target cannot be the same' ; exit 1; }
5555

5656
# Switch container name with id
57-
container_id=$(docker ps -f "name=^${container}" -q | tail -n1)
57+
container_id=$(docker ps -f "name=${container}" -q | tail -n1)
5858
[[ -z "$container_id" ]] && { echo "Container id for $container not found." ; exit 1; }
5959

6060
# Set alias

roles/postgres/files/docker-postgres-rename

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ done
5656
[[ "$target_database" == "$source_database" ]] && { echo 'Parameter -s|source and -t|target cannot be the same' ; exit 1; }
5757

5858
# Switch container name with id
59-
container_id=$(docker ps -f "name=^${container}" -q | tail -n1)
59+
container_id=$(docker ps -f "name=${container}" -q | tail -n1)
6060
[[ -z "$container_id" ]] && { echo "Container id for $container not found." ; exit 1; }
6161

6262
# Drop target database

roles/postgres/files/docker-postgres-upgrade

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ done
5353
source_version=${source_version:-"$target_version"}
5454

5555
# Switch container name with id
56-
container_id=$(docker ps -f "name=^${container}" -q | tail -n1)
56+
container_id=$(docker ps -f "name=${container}" -q | tail -n1)
5757
[[ -z "$container_id" ]] && { echo "Container id for $container not found." ; exit 1; }
5858

5959
# Verify the source version is correct

0 commit comments

Comments
 (0)