Skip to content

Commit 75d6207

Browse files
author
Paulo Jesus
committed
BUG#26636911 : AdminAPI commands throw error that does not support SSL for Win
The AdminAPI commands throw an error when used on servers with SSL support on Windows because the Python version used for that platform is the one bundled with the shell which does not have SSL support. In non-Windows systems this does not happen because the Python available in the system is used (not the one bundled with the shell). For those platforms there is no issue as long as the system Python supports SSL. This issue was manifested because secure connection are performed by default and to perform them connector/python requires a Python version with SSL support to be used. This patch replaces the use of connector/python with the use mysql-shell sessions to establish connections to the server for the internal mysqlprovision tool, always using the Python bundled with the shell independently of the platform, but no longer requiring Python to have SSL support.
1 parent 0f4c1fc commit 75d6207

File tree

13 files changed

+195
-172
lines changed

13 files changed

+195
-172
lines changed

include/shellcore/python_context.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
33
*
44
* This program is free software; you can redistribute it and/or
55
* modify it under the terms of the GNU General Public License as
@@ -191,6 +191,8 @@ class TYPES_COMMON_PUBLIC Python_context {
191191

192192
Interpreter_delegate *_delegate;
193193

194+
PyObject *db_error() { return _db_error; }
195+
194196
private:
195197
static PyObject *shell_print(PyObject *self, PyObject *args, const std::string& stream);
196198
static PyObject *shell_flush(PyObject *self, PyObject *args);
@@ -211,6 +213,8 @@ class TYPES_COMMON_PUBLIC Python_context {
211213
PyObject *_locals;
212214
PyThreadState *_main_thread_state;
213215

216+
PyObject *_db_error;
217+
214218
Python_type_bridger _types;
215219

216220
PyObject *_shell_stderr_module;

modules/adminapi/mod_dba_provisioning_interface.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "utils/utils_file.h"
2929

3030
static const char *kRequiredMySQLProvisionInterfaceVersion = "2.1";
31+
extern const char *g_mysqlsh_argv0;
3132

3233
using namespace mysqlsh;
3334
using namespace mysqlsh::dba;
@@ -59,7 +60,7 @@ int ProvisioningInterface::execute_mysqlprovision(const std::string &cmd, const
5960
if (_local_mysqlprovision_path.empty()) {
6061
std::string tmp(get_binary_folder());
6162
#ifdef _WIN32
62-
tmp.append("\\mysqlprovision.cmd");
63+
tmp.append("\\mysqlprovision.zip");
6364
#else
6465
tmp.append("/mysqlprovision");
6566
#endif
@@ -72,6 +73,10 @@ int ProvisioningInterface::execute_mysqlprovision(const std::string &cmd, const
7273
_local_mysqlprovision_path = "mysqlprovision";
7374
}
7475

76+
args_script.push_back(g_mysqlsh_argv0);
77+
args_script.push_back("--py");
78+
args_script.push_back("-f");
79+
7580
args_script.push_back(_local_mysqlprovision_path.c_str());
7681
args_script.push_back(cmd.c_str());
7782

python/front_end/mysqlprovision.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,12 @@
2424
the creation of MySQL sandbox instances.
2525
"""
2626

27-
from mysql_gadgets import check_connector_python, check_expected_version,\
27+
from mysql_gadgets import check_expected_version,\
2828
check_python_version
2929

3030
# Check Python version requirement
3131
check_python_version(json_msg=True)
3232

33-
# Check Connector/Python requirement
34-
check_connector_python(json_msg=True)
35-
3633
# pylint: disable=wrong-import-position,wrong-import-order
3734
import argparse
3835
import logging

0 commit comments

Comments
 (0)