Support python3 in guest agent
Story: #2006455 Task: #36376 Change-Id: I62323ac1c1edfbf0378d0c89e156fdb3a879aa88
This commit is contained in:
parent
40821578f9
commit
7b9a752eb0
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
# Copyright 2011 OpenStack Foundation
|
# Copyright 2011 OpenStack Foundation
|
||||||
# All Rights Reserved.
|
# All Rights Reserved.
|
||||||
|
@ -7,13 +7,9 @@ set -e
|
|||||||
set -o xtrace
|
set -o xtrace
|
||||||
|
|
||||||
export DEBIAN_FRONTEND=noninteractive
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
apt-get --allow-unauthenticated -y install python-dev libxml2-dev libxslt1-dev python-setuptools \
|
apt-get --allow-unauthenticated -y install \
|
||||||
libffi-dev libssl-dev \
|
libxml2-dev libxslt1-dev libffi-dev libssl-dev libyaml-dev \
|
||||||
python-pip python-sqlalchemy python-lxml \
|
python3 python3-dev python3-pip python3-sqlalchemy python3-setuptools
|
||||||
python-routes python-eventlet python-webob \
|
|
||||||
python-pastedeploy python-paste python-netaddr \
|
|
||||||
python-httplib2 python-iso8601 python-pexpect python-mysqldb python-migrate
|
|
||||||
|
|
||||||
|
|
||||||
# pick up the requirements file left for us by
|
# pick up the requirements file left for us by
|
||||||
# extra-data.d/15-reddwarf-dep
|
# extra-data.d/15-reddwarf-dep
|
||||||
@ -25,8 +21,10 @@ if [ -f ${TMP_HOOKS_DIR}/upper-constraints.txt ]; then
|
|||||||
UPPER_CONSTRAINTS=" -c ${TMP_HOOKS_DIR}/upper-constraints.txt"
|
UPPER_CONSTRAINTS=" -c ${TMP_HOOKS_DIR}/upper-constraints.txt"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pip2 install -q --upgrade -r ${TMP_HOOKS_DIR}/requirements.txt ${UPPER_CONSTRAINTS}
|
pip3 install pip==9.0.3
|
||||||
|
pip3 install wheel
|
||||||
|
pip3 install --upgrade -r ${TMP_HOOKS_DIR}/requirements.txt ${UPPER_CONSTRAINTS}
|
||||||
|
|
||||||
echo "diagnostic pip freeze output follows"
|
echo "diagnostic pip freeze output follows"
|
||||||
pip2 freeze
|
pip3 freeze
|
||||||
echo "diagnostic pip freeze output above"
|
echo "diagnostic pip freeze output above"
|
||||||
|
@ -294,7 +294,7 @@ class GuestLog(object):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def _update_log_header_digest(self, log_file):
|
def _update_log_header_digest(self, log_file):
|
||||||
with open(log_file, 'r') as log:
|
with open(log_file, 'rb') as log:
|
||||||
self._header_digest = hashlib.md5(log.readline()).hexdigest()
|
self._header_digest = hashlib.md5(log.readline()).hexdigest()
|
||||||
|
|
||||||
def _get_headers(self):
|
def _get_headers(self):
|
||||||
|
@ -22,7 +22,9 @@ import subprocess
|
|||||||
from tempfile import NamedTemporaryFile
|
from tempfile import NamedTemporaryFile
|
||||||
|
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
|
from oslo_utils import encodeutils
|
||||||
import pexpect
|
import pexpect
|
||||||
|
import six
|
||||||
|
|
||||||
from trove.common import exception
|
from trove.common import exception
|
||||||
from trove.common.exception import ProcessExecutionError
|
from trove.common.exception import ProcessExecutionError
|
||||||
@ -50,9 +52,10 @@ def getoutput(*cmd):
|
|||||||
stderr=subprocess.STDOUT)
|
stderr=subprocess.STDOUT)
|
||||||
except OSError:
|
except OSError:
|
||||||
# ignore errors like program not found
|
# ignore errors like program not found
|
||||||
return b''
|
return six.text_type("")
|
||||||
|
|
||||||
stdout = proc.communicate()[0]
|
stdout = proc.communicate()[0]
|
||||||
return stdout
|
return encodeutils.safe_decode(stdout)
|
||||||
|
|
||||||
|
|
||||||
class PkgAdminLockError(exception.TroveError):
|
class PkgAdminLockError(exception.TroveError):
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
|
from oslo_utils import encodeutils
|
||||||
|
|
||||||
from trove.common import exception
|
from trove.common import exception
|
||||||
from trove.common.i18n import _
|
from trove.common.i18n import _
|
||||||
@ -71,8 +72,8 @@ class MysqlGTIDReplication(mysql_base.MysqlReplicationBase):
|
|||||||
LOG.info("Reading last master GTID from %s", INFO_FILE)
|
LOG.info("Reading last master GTID from %s", INFO_FILE)
|
||||||
try:
|
try:
|
||||||
with open(INFO_FILE, 'rb') as f:
|
with open(INFO_FILE, 'rb') as f:
|
||||||
row = f.read().split('\t')
|
row = f.read().split(b'\t')
|
||||||
return row[2]
|
return encodeutils.safe_decode(row[2])
|
||||||
except (IOError, IndexError) as ex:
|
except (IOError, IndexError) as ex:
|
||||||
LOG.exception(ex)
|
LOG.exception(ex)
|
||||||
raise self.UnableToDetermineLastMasterGTID(
|
raise self.UnableToDetermineLastMasterGTID(
|
||||||
|
Loading…
Reference in New Issue
Block a user