AttributeError' module'对象没有属性'版本'

时间:2017-01-04 05:27:43

标签: openstack devstack

我正面临openstacksdk版本问题。

2016-12-26 07:11:30.069 | +./stack.sh:main:1033 create_keystone_accounts

2016-12-26 07:11:30.074 | +lib/keystone:create_keystone_accounts:372 local admin_tenant

2016-12-26 07:11:30.081 | ++lib/keystone:create_keystone_accounts:373 openstack project show admin -f value -c id

2016-12-26 07:11:31.019 | Traceback (most recent call last):

2016-12-26 07:11:31.019 | File "/usr/local/bin/openstack", line 7, in 

2016-12-26 07:11:31.019 | from openstackclient.shell import main

2016-12-26 07:11:31.019 | File "/usr/local/lib/python2.7/dist-packages/openstackclient/shell.py", line 32, in 

2016-12-26 07:11:31.019 | from openstackclient.common import clientmanager

2016-12-26 07:11:31.019 | File "/usr/local/lib/python2.7/dist-packages/openstackclient/common/clientmanager.py", line 293, in 

2016-12-26 07:11:31.019 | 'openstack.cli.base',

2016-12-26 07:11:31.019 | File "/usr/local/lib/python2.7/dist-packages/openstackclient/common/clientmanager.py", line 264, in get_plugin_modules

2016-12-26 07:11:31.019 | import(ep.module_name)

2016-12-26 07:11:31.019 | File "/usr/local/lib/python2.7/dist-packages/openstackclient/network/client.py", line 16, in 

2016-12-26 07:11:31.019 | from openstack import connection

2016-12-26 07:11:31.019 | File "/usr/local/lib/python2.7/dist-packages/openstack/connection.py", line 68, in 

2016-12-26 07:11:31.019 | from openstack import session as _session

2016-12-26 07:11:31.019 | File "/usr/local/lib/python2.7/dist-packages/openstack/session.py", line 29, in 

2016-12-26 07:11:31.019 | DEFAULT_USER_AGENT = "openstacksdk/%s" % openstack.version

2016-12-26 07:11:31.019 | AttributeError: 'module' object has no attribute 'version'

2016-12-26 07:11:31.041 | +lib/keystone:create_keystone_accounts:373 admin_tenant=

2016-12-26 07:11:31.049 | +lib/keystone:create_keystone_accounts:1 exit_trap

2016-12-26 07:11:31.056 | +./stack.sh:exit_trap:474 local r=1

2016-12-26 07:11:31.064 | ++./stack.sh:exit_trap:475 jobs -p

2016-12-26 07:11:31.072 | +./stack.sh:exit_trap:475 jobs=

2016-12-26 07:11:31.079 | +./stack.sh:exit_trap:478 [[ -n '' ]]

2016-12-26 07:11:31.086 | +./stack.sh:exit_trap:484 kill_spinner

2016-12-26 07:11:31.092 | +./stack.sh:kill_spinner:370 '[' '!' -z '' ']'

2016-12-26 07:11:31.098 | +./stack.sh:exit_trap:486 [[ 1 -ne 0 ]]

2016-12-26 07:11:31.105 | +./stack.sh:exit_trap:487 echo 'Error on exit'

2016-12-26 07:11:31.105 | Error on exit

2016-12-26 07:11:31.110 | +./stack.sh:exit_trap:488 generate-subunit 1482733821 2470 fail

2016-12-26 07:11:31.479 | +./stack.sh:exit_trap:489 [[ -z /opt/stack/logs ]]

2016-12-26 07:11:31.487 | +./stack.sh:exit_trap:492 /opt/stack/devstack/tools/worlddump.py -d /opt/stack/logs

2016-12-26 07:11:31.895 | +./stack.sh:exit_trap:498 exit 1

stack@openstack:~/devstack$

我过去几天试图找到原因,我发现他们更新了OpenStack SDK版本(UPDATE DEFAULT_USER_AGENT = "openstacksdk/%s" % openstack_version.__version__),但是它没有工作并抛出同样的错误。 任何帮助都会非常明显。

提前谢谢。

3 个答案:

答案 0 :(得分:0)

不是100%确定造成这种情况的原因,但我可以通过在本节后面的python-openstackclient脚本中添加显式升级stack.sh来解决此错误:

# Install the OpenStack client, needed for most setup commands
if use_library_from_git "python-openstackclient"; then
    git_clone_by_name "python-openstackclient"
    setup_dev_lib "python-openstackclient"
else
    pip_install_gr python-openstackclient
fi

我补充说:

sudo pip install "python-openstackclient==<version_I_want>"

答案 1 :(得分:0)

编辑文件trove-deshboard / requirements.txt

-e git:// ... =&gt; -e git + https:// ...

然后编辑requirements / upper-constraints.txt

openstacksdk === 0.8.1 =&gt; openstacksdk === 0.9.11或0.9.12

答案 2 :(得分:0)

此处列出了官方修复

https://review.openstack.org/#/c/325088/

我直接修补了/usr/local/lib/python2.7/dist-packages/openstack /

我能够无误地完成./stack.sh脚本