From c159a958bb5b3d4d4d124cda885aab18d8241970 Mon Sep 17 00:00:00 2001 From: yurkovychv Date: Thu, 9 May 2024 14:19:02 +0300 Subject: [PATCH 1/9] PMM-7 fix psmdb setup --- pmm_qa/pmm-framework.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/pmm_qa/pmm-framework.py b/pmm_qa/pmm-framework.py index 73c4e41..edfe87d 100755 --- a/pmm_qa/pmm-framework.py +++ b/pmm_qa/pmm-framework.py @@ -355,20 +355,13 @@ def execute_shell_scripts(shell_scripts, project_relative_scripts_dir, env_vars, result = subprocess.run(['bash', script], capture_output=True, text=True, check=True) print("Output:") print(result.stdout) + print(f"Shell script '{script}' executed successfully.") except subprocess.CalledProcessError as e: - print("Error:") - print(e.stderr) + print(f"Shell script '{script}' failed with an error! \n {e.stderr}") + exit(1) except Exception as e: print("Unexpected error occurred:", e) finally: - # Get the return code of the process - return_code = result.returncode - if return_code == 0: - print(f"Shell script '{script}' executed successfully.") - else: - print(f"Shell script '{script}' failed with return code: {return_code}! \n {result.stderr}") - exit(return_code) - # Return to the original working directory os.chdir(original_dir) From 66021595515d7c4b32dd67b5e825628a6fae924c Mon Sep 17 00:00:00 2001 From: yurkovychv Date: Thu, 9 May 2024 15:22:38 +0300 Subject: [PATCH 2/9] PMM-7 fix psmdb setup --- pmm_qa/pmm-framework.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pmm_qa/pmm-framework.py b/pmm_qa/pmm-framework.py index edfe87d..f5d6492 100755 --- a/pmm_qa/pmm-framework.py +++ b/pmm_qa/pmm-framework.py @@ -356,11 +356,11 @@ def execute_shell_scripts(shell_scripts, project_relative_scripts_dir, env_vars, print("Output:") print(result.stdout) print(f"Shell script '{script}' executed successfully.") - except subprocess.CalledProcessError as e: - print(f"Shell script '{script}' failed with an error! \n {e.stderr}") - exit(1) - except Exception as e: - print("Unexpected error occurred:", e) + # except subprocess.CalledProcessError as e: + # print(f"Shell script '{script}' failed with an error! \n {e.stderr}") + # exit(1) + # except Exception as e: + # print("Unexpected error occurred:", e) finally: # Return to the original working directory os.chdir(original_dir) From 0ae86316055a6fdc0715869b88f6e6d36015d3f4 Mon Sep 17 00:00:00 2001 From: yurkovychv Date: Thu, 9 May 2024 16:45:56 +0300 Subject: [PATCH 3/9] PMM-7 fix psmdb setup --- pmm_qa/pmm-framework.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pmm_qa/pmm-framework.py b/pmm_qa/pmm-framework.py index f5d6492..0c7accb 100755 --- a/pmm_qa/pmm-framework.py +++ b/pmm_qa/pmm-framework.py @@ -353,8 +353,6 @@ def execute_shell_scripts(shell_scripts, project_relative_scripts_dir, env_vars, os.chdir(shell_scripts_path) print(f'changed directory {os.getcwd()}') result = subprocess.run(['bash', script], capture_output=True, text=True, check=True) - print("Output:") - print(result.stdout) print(f"Shell script '{script}' executed successfully.") # except subprocess.CalledProcessError as e: # print(f"Shell script '{script}' failed with an error! \n {e.stderr}") @@ -362,6 +360,9 @@ def execute_shell_scripts(shell_scripts, project_relative_scripts_dir, env_vars, # except Exception as e: # print("Unexpected error occurred:", e) finally: + print("Output:") + print(result.stdout) + # Return to the original working directory os.chdir(original_dir) From 62615615eb3d43e138c94848e59f760e2dd7473c Mon Sep 17 00:00:00 2001 From: yurkovychv Date: Tue, 14 May 2024 13:11:54 +0300 Subject: [PATCH 4/9] PMM-7 fix psmdb setup --- pmm_psmdb-pbm_setup/Dockerfile | 6 +++--- pmm_qa/pmm-framework.py | 18 ++++++++---------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/pmm_psmdb-pbm_setup/Dockerfile b/pmm_psmdb-pbm_setup/Dockerfile index bca3144..f19f2e7 100644 --- a/pmm_psmdb-pbm_setup/Dockerfile +++ b/pmm_psmdb-pbm_setup/Dockerfile @@ -48,20 +48,20 @@ RUN set -ex; \ percona-server-mongodb-server-${PSMDB_VERSION}.el9 \ percona-server-mongodb-mongos-${PSMDB_VERSION}.el9 ; \ fi && \ - if [ $PBM_VERSION == "latest" ]; then \ + if [ "$PBM_VERSION" == "latest" ]; then \ yum -y install percona-backup-mongodb ; \ else \ yum -y install percona-backup-mongodb-${PBM_VERSION}.el9 ; \ fi -RUN if [[ $PMM_CLIENT_VERSION == http* ]]; then \ +RUN if [[ "$PMM_CLIENT_VERSION" == http* ]]; then \ yum -y install pmm-client && \ curl -Lf -o /tmp/pmm-client.tar.gz $PMM_CLIENT_VERSION && \ cd /tmp && tar -xvf pmm-client.tar.gz --transform 's,^/*[^/]*,/pmm-client,S' && \ cd /tmp/pmm-client && ./install_tarball && cd ../ && rm -rf pmm* ;\ elif [[ "$PMM_CLIENT_VERSION" =~ 3-dev-latest|latest ]]; then \ yum -y install pmm-client ; \ - elif [[ $PMM_CLIENT_VERSION =~ pmm3-rc ]]; then \ + elif [[ "$PMM_CLIENT_VERSION" = "pmm3-rc" ]]; then \ percona-release enable original testing \ yum update --refresh -y \ yum -y install pmm-client ; \ diff --git a/pmm_qa/pmm-framework.py b/pmm_qa/pmm-framework.py index 0c7accb..9f03758 100755 --- a/pmm_qa/pmm-framework.py +++ b/pmm_qa/pmm-framework.py @@ -346,23 +346,21 @@ def execute_shell_scripts(shell_scripts, project_relative_scripts_dir, env_vars, # Execute each shell script for script in shell_scripts: - result = '' + result: subprocess.CompletedProcess try: print(f'running script {script}') # Change directory to where the script is located os.chdir(shell_scripts_path) print(f'changed directory {os.getcwd()}') result = subprocess.run(['bash', script], capture_output=True, text=True, check=True) - print(f"Shell script '{script}' executed successfully.") - # except subprocess.CalledProcessError as e: - # print(f"Shell script '{script}' failed with an error! \n {e.stderr}") - # exit(1) - # except Exception as e: - # print("Unexpected error occurred:", e) - finally: print("Output:") print(result.stdout) - + print(f"Shell script '{script}' executed successfully.") + except subprocess.CalledProcessError as e: + print(f"Shell script '{script}' failed with return code: {e.returncode}! \n {e.stderr}") + except Exception as e: + print("Unexpected error occurred:", e) + finally: # Return to the original working directory os.chdir(original_dir) @@ -633,4 +631,4 @@ def setup_database(db_type, db_version=None, db_config=None, args=None): except Exception as e: print("An unexpected error occurred:", e) parser.print_help() - exit(1) + exit(1) \ No newline at end of file From 7c71f3948f5d75ac80d86c440c5456cb5410a716 Mon Sep 17 00:00:00 2001 From: yurkovychv Date: Tue, 14 May 2024 13:23:36 +0300 Subject: [PATCH 5/9] PMM-7 fix psmdb setup --- pmm_qa/pmm-framework.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pmm_qa/pmm-framework.py b/pmm_qa/pmm-framework.py index 9f03758..b439956 100755 --- a/pmm_qa/pmm-framework.py +++ b/pmm_qa/pmm-framework.py @@ -358,6 +358,7 @@ def execute_shell_scripts(shell_scripts, project_relative_scripts_dir, env_vars, print(f"Shell script '{script}' executed successfully.") except subprocess.CalledProcessError as e: print(f"Shell script '{script}' failed with return code: {e.returncode}! \n {e.stderr}") + exit(e.returncode) except Exception as e: print("Unexpected error occurred:", e) finally: From 4d3a3ae216774f7522fa2c4655f56b3bd83061ca Mon Sep 17 00:00:00 2001 From: yurkovychv Date: Tue, 14 May 2024 13:25:26 +0300 Subject: [PATCH 6/9] PMM-7 fix psmdb setup --- pmm_qa/pmm-framework.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pmm_qa/pmm-framework.py b/pmm_qa/pmm-framework.py index b439956..a7a1602 100755 --- a/pmm_qa/pmm-framework.py +++ b/pmm_qa/pmm-framework.py @@ -357,7 +357,7 @@ def execute_shell_scripts(shell_scripts, project_relative_scripts_dir, env_vars, print(result.stdout) print(f"Shell script '{script}' executed successfully.") except subprocess.CalledProcessError as e: - print(f"Shell script '{script}' failed with return code: {e.returncode}! \n {e.stderr}") + print(f"Shell script '{script}' failed with return code: {e.returncode}! \n {e.stderr} \n Output: \n {e.stdout} ") exit(e.returncode) except Exception as e: print("Unexpected error occurred:", e) From 9d90203868c586cd5a8dfbfbb6df6deb111056a2 Mon Sep 17 00:00:00 2001 From: yurkovychv Date: Tue, 14 May 2024 13:42:55 +0300 Subject: [PATCH 7/9] PMM-7 fix psmdb setup --- pmm_psmdb-pbm_setup/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pmm_psmdb-pbm_setup/Dockerfile b/pmm_psmdb-pbm_setup/Dockerfile index f19f2e7..db3d359 100644 --- a/pmm_psmdb-pbm_setup/Dockerfile +++ b/pmm_psmdb-pbm_setup/Dockerfile @@ -64,7 +64,7 @@ RUN if [[ "$PMM_CLIENT_VERSION" == http* ]]; then \ elif [[ "$PMM_CLIENT_VERSION" = "pmm3-rc" ]]; then \ percona-release enable original testing \ yum update --refresh -y \ - yum -y install pmm-client ; \ + yum -y install pmm3-client ; \ else \ yum -y install pmm-client-${PMM_CLIENT_VERSION}-6.el9 ; \ fi && \ From 3d1574ccb39c26d9d7df530b9c4a2655568f62f5 Mon Sep 17 00:00:00 2001 From: yurkovychv Date: Tue, 14 May 2024 13:55:35 +0300 Subject: [PATCH 8/9] PMM-7 fix psmdb setup --- pmm_psmdb-pbm_setup/Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pmm_psmdb-pbm_setup/Dockerfile b/pmm_psmdb-pbm_setup/Dockerfile index db3d359..710d5b9 100644 --- a/pmm_psmdb-pbm_setup/Dockerfile +++ b/pmm_psmdb-pbm_setup/Dockerfile @@ -64,14 +64,13 @@ RUN if [[ "$PMM_CLIENT_VERSION" == http* ]]; then \ elif [[ "$PMM_CLIENT_VERSION" = "pmm3-rc" ]]; then \ percona-release enable original testing \ yum update --refresh -y \ - yum -y install pmm3-client ; \ + yum -y install pmm-client ; \ else \ yum -y install pmm-client-${PMM_CLIENT_VERSION}-6.el9 ; \ fi && \ sed 's/Type=forking/#Type=forking/' -i /usr/lib/systemd/system/mongod.service && \ systemctl enable mongod && \ systemctl enable pbm-agent && \ - systemctl enable pmm-agent && \ curl -Lf -o /tmp/mgodatagen.tar.gz https://github.com/feliixx/mgodatagen/releases/download/v0.11.2/mgodatagen_0.11.2_Linux_x86_64.tar.gz && \ tar -xf /tmp/mgodatagen.tar.gz -C /usr/bin && \ yum clean all; \ From 8b8324f20410b434b1fc9b5c74fc5e5cd425dce7 Mon Sep 17 00:00:00 2001 From: yurkovychv Date: Tue, 14 May 2024 13:58:21 +0300 Subject: [PATCH 9/9] PMM-7 fix psmdb setup --- pmm_psmdb-pbm_setup/Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pmm_psmdb-pbm_setup/Dockerfile b/pmm_psmdb-pbm_setup/Dockerfile index 710d5b9..d6f8df2 100644 --- a/pmm_psmdb-pbm_setup/Dockerfile +++ b/pmm_psmdb-pbm_setup/Dockerfile @@ -62,8 +62,8 @@ RUN if [[ "$PMM_CLIENT_VERSION" == http* ]]; then \ elif [[ "$PMM_CLIENT_VERSION" =~ 3-dev-latest|latest ]]; then \ yum -y install pmm-client ; \ elif [[ "$PMM_CLIENT_VERSION" = "pmm3-rc" ]]; then \ - percona-release enable original testing \ - yum update --refresh -y \ + percona-release enable original testing && \ + yum update --refresh -y && \ yum -y install pmm-client ; \ else \ yum -y install pmm-client-${PMM_CLIENT_VERSION}-6.el9 ; \ @@ -71,6 +71,7 @@ RUN if [[ "$PMM_CLIENT_VERSION" == http* ]]; then \ sed 's/Type=forking/#Type=forking/' -i /usr/lib/systemd/system/mongod.service && \ systemctl enable mongod && \ systemctl enable pbm-agent && \ + systemctl enable pmm-agent && \ curl -Lf -o /tmp/mgodatagen.tar.gz https://github.com/feliixx/mgodatagen/releases/download/v0.11.2/mgodatagen_0.11.2_Linux_x86_64.tar.gz && \ tar -xf /tmp/mgodatagen.tar.gz -C /usr/bin && \ yum clean all; \