"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "scripts/mysqlserverclone.py" between
mysql-utilities-1.6.4.tar.gz and mysql-utilities-1.6.5.tar.gz

About: MySQL Utilities is a package of utilities that are used for maintenance and administration of MySQL servers (written in Python).

mysqlserverclone.py  (mysql-utilities-1.6.4):mysqlserverclone.py  (mysql-utilities-1.6.5)
#!/usr/bin/env python #!/usr/bin/env python
# #
# Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License. # the Free Software Foundation; version 2 of the License.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# #
""" """
This file contains the clone server utility which launches a new instance This file contains the clone server utility which launches a new instance
of an existing server. of an existing server.
""" """
from mysql.utilities.common.tools import check_python_version
# Check Python version compatibility
check_python_version()
import os.path import os.path
import sys import sys
from mysql.utilities.common.tools import check_python_version
from mysql.utilities import exception from mysql.utilities import exception
from mysql.utilities.command import serverclone from mysql.utilities.command import serverclone
from mysql.utilities.common.ip_parser import parse_connection from mysql.utilities.common.ip_parser import parse_connection
from mysql.utilities.common.tools import check_connector_python from mysql.utilities.common.tools import check_connector_python
from mysql.utilities.common.options import (add_basedir_option, add_verbosity, from mysql.utilities.common.options import (add_basedir_option, add_verbosity,
get_ssl_dict, get_ssl_dict,
check_dir_option, check_dir_option,
setup_common_options, setup_common_options,
check_password_security) check_password_security)
from mysql.utilities.common.server import Server from mysql.utilities.common.server import Server
# Check Python version compatibility
check_python_version()
# Constants # Constants
NAME = "MySQL Utilities - mysqlserverclone " NAME = "MySQL Utilities - mysqlserverclone "
DESCRIPTION = "mysqlserverclone - start another instance of a running server" DESCRIPTION = "mysqlserverclone - start another instance of a running server"
USAGE = "%prog --server=user:pass@host:port:socket --new-data=/tmp/data2 " \ USAGE = "%prog --server=user:pass@host:port:socket --new-data=/tmp/data2 " \
"--new-port=3310 --new-id=12 --root-password=root" "--new-port=3310 --new-id=12 --root-password=root"
CLONE_FAILED = ("ERROR: Unable to connect to cloned server. Server may have "
"failed to start. Try running the clone again using the -vvv "
"option, which presents all of the messages from the server "
"to the console. Correct the error(s) and retry the clone.")
# Check for connector/python # Check for connector/python
if not check_connector_python(): if not check_connector_python():
sys.exit(1) sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
# Setup the command parser and setup server, help # Setup the command parser and setup server, help
parser = setup_common_options(os.path.basename(sys.argv[0]), parser = setup_common_options(os.path.basename(sys.argv[0]),
DESCRIPTION, USAGE, False, True, None) DESCRIPTION, USAGE, False, True, None)
# Setup utility-specific options: # Setup utility-specific options:
skipping to change at line 213 skipping to change at line 217
except exception.UtilError: except exception.UtilError:
_, err, _ = sys.exc_info() _, err, _ = sys.exc_info()
parser.error("Server connection values invalid: %s." % err.errmsg) parser.error("Server connection values invalid: %s." % err.errmsg)
else: else:
conn = None conn = None
try: try:
serverclone.clone_server(conn, options) serverclone.clone_server(conn, options)
except exception.UtilError: except exception.UtilError:
_, e, _ = sys.exc_info() _, e, _ = sys.exc_info()
print(CLONE_FAILED)
print("ERROR: {0}".format(e.errmsg)) print("ERROR: {0}".format(e.errmsg))
sys.exit(1) sys.exit(1)
sys.exit() sys.exit()
 End of changes. 6 change blocks. 
6 lines changed or deleted 11 lines changed or added

Home  |  About  |  All  |  Newest  |  Fossies Dox  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTPS