openEuler-22.03-LTS-SP2源码安装OpenStack-Bobcat问题解决

文章说明

记录openEuler-22.03-LTS-SP2源码安装OpenStack-Bobcat所遇到的问题及解决办法

机器详情

主机名 IP 磁盘 CPU 内存
controller ens160:192.168.46.31/24 ens192:不配置IP地址 100G 2C 8G
compute ens160:192.168.46.32/24 ens192:不配置IP地址 100G 2C 8G

Keystone 编译安装所遇到的问题

CRITICAL keystone [-] Unhandled error: AttributeError: ‘function’ object has no attribute ‘ping’

运行如下命

su -s /bin/sh -c "keystone-manage db_sync" keystone

报错:
在这里插入图片描述

解决办法一(SQLAlchemy版本降低)

pip3 install SQLAlchemy==1.4.49 -i https://pypi.tuna.tsinghua.edu.cn/simple

解决办法二(修改代码)

根据报错信息可知出现问题的代码位于

File "/usr/local/lib64/python3.9/site-packages/sqlalchemy/dialects/mysql/pymysql.py", line 93, in _send_false_to_ping

进去查看代码

 @langhelpers.memoized_property
    def _send_false_to_ping(self):
        """determine if pymysql has deprecated, changed the default of,
        or removed the 'reconnect' argument of connection.ping().

        See #10492 and
        https://github.com/PyMySQL/mysqlclient/discussions/651#discussioncomment-7308971
        for background.

        """  # noqa: E501

        try:
            Connection = __import__("pymysql.connections").Connection
        except (ImportError, AttributeError):
            return True
        else:
            insp = langhelpers.get_callable_argspec(Connection.ping)
            try:
                reconnect_arg = insp.args[1]
            except IndexError:
                return False
            else:
                return reconnect_arg == "reconnect" and (
                    not insp.defaults or insp.defaults[0] is not False
                )

问题出现在这一行
insp = langhelpers.get_callable_argspec(Connection.ping)
这行代码的意思获取 Connection.ping 方法的参数规格
但是它报错AttributeError: 'function' object has no attribute 'ping'
这个时候就要去查看一下源代码确认一下ping是否存在
首先通过pip3 show pymysql查看模块的位置
[root@controller ~]# pip3 show pymysql
Name: PyMySQL
Version: 0.9.3
Summary: Pure Python MySQL Driver
Home-page: https://github.com/PyMySQL/PyMySQL/
Author: yutaka.matsubara
Author-email: yutaka.matsubara@gmail.com
License: "MIT"
Location: /usr/lib/python3.9/site-packages
Requires: 
Required-by: 
最终确认文件目录为/usr/lib/python3.9/site-packages/pymysql/connections.py
查看这个文件内容可以发现
是有ping存在的它是一个函数位于class Connection(object),这时就会发现Connection明明是一个class
为什么会报AttributeError: 'function'
这时返回/usr/local/lib64/python3.9/site-packages/sqlalchemy/dialects/mysql/pymysql.py
修改代码查看查看
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

想看一次满天星

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值