Skip to content

Commit 43cd1ec

Browse files
committed
[Backport 2.5.3][yugabyte#7619] Platform: Properly detect python versions when activating virtualenv
Summary: D10896 did not pass in the executables as an array. This diff fixes it so the python executable is passed as an array and is properly looped over. Test Plan: bin/install_python_requirements.sh --create_package bin/install_python_requirements.sh --use_package Reviewers: daniel Reviewed By: daniel Subscribers: yugaware Differential Revision: https://phabricator.dev.yugabyte.com/D10900
1 parent 4b4fbf8 commit 43cd1ec

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

managed/devops/bin/common.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ get_timestamp() {
7878
}
7979

8080
check_python_executables() {
81-
executables="$1"
82-
for py_executable in $executables; do
81+
executables=("$@")
82+
for py_executable in "${executables[@]}"; do
8383
if which "$py_executable" > /dev/null 2>&1; then
8484
PYTHON_EXECUTABLE="$py_executable"
8585
return 0
@@ -91,9 +91,9 @@ check_python_executables() {
9191
set_python_vars() {
9292
# Prioritize python3 over python2.
9393
if [ -z "$YB_MANAGED_DEVOPS_USE_PYTHON3" ]; then
94-
if check_python_executables "$PYTHON3_EXECUTABLES"; then
94+
if check_python_executables "${PYTHON3_EXECUTABLES[@]}"; then
9595
YB_MANAGED_DEVOPS_USE_PYTHON3="1"
96-
elif check_python_executables "$PYTHON2_EXECUTABLES"; then
96+
elif check_python_executables "${PYTHON2_EXECUTABLES[@]}"; then
9797
YB_MANAGED_DEVOPS_USE_PYTHON3="0"
9898
fi
9999

@@ -123,7 +123,7 @@ set_python_vars() {
123123
if [[ "$YB_MANAGED_DEVOPS_USE_PYTHON3" == "0" ]]; then
124124
POSSIBLE_EXECUTABLES="$PYTHON2_EXECUTABLES"
125125
fi
126-
check_python_executables "$POSSIBLE_EXECUTABLES"
126+
check_python_executables "${POSSIBLE_EXECUTABLES[@]}"
127127
fi
128128
fi
129129

managed/devops/opscli/ybops/cloud/aws/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ def __init__(self, metadata, host_vpc_id, host_vpc_region):
210210
self._validate_cidr_overlap()
211211

212212
def _validate_cidr_overlap(self):
213-
region_networks = [ip_network(cidr.decode('utf-8')) for cidr in self.region_cidrs.values()]
213+
region_networks = [ip_network(cidr) for cidr in self.region_cidrs.values()]
214214
all_networks = region_networks
215215
for i in range(len(all_networks)):
216216
for j in range(i + 1, len(all_networks)):

0 commit comments

Comments
 (0)