易陆发现互联网技术论坛

 找回密码
 开始注册
查看: 656|回复: 0
收起左侧

gnocchi resource list --type image AttributeError: '_Environ' object has no att

[复制链接]
发表于 2022-5-28 22:29:44 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?开始注册

x
AttributeError: '_Environ' object has no attribute 'set'
8 u, r2 Z: O4 MTraceback (most recent call last):' U2 h5 ~9 I, e0 o" c" x% v! h1 J
  File "/usr/bin/gnocchi", line 10, in <module>
9 `* X. T, U+ L) \8 q; S, o    sys.exit(main())3 n- l# D0 o6 @! M# o" I7 O
  File "/usr/lib/python3.6/site-packages/gnocchiclient/shell.py", line 252, in main) f, J& v& T! U% b( ?: h
    return GnocchiShell().run(args)
. D/ L3 W/ Q  V# Z6 ^0 e0 B  File "/usr/lib/python3.6/site-packages/gnocchiclient/shell.py", line 99, in __init__
: @: L: `- X# `# `    deferred_help=True,
; a/ k, w% m# p7 D  File "/usr/lib/python3.6/site-packages/cliff/app.py", line 85, in __init__, M! X  q! o8 a
    self.parser = self.build_option_parser(description, version)
& c) G2 e% |; k) r+ i& \  K7 T  File "/usr/lib/python3.6/site-packages/gnocchiclient/shell.py", line 130, in build_option_parser
9 G9 P' Q, F) X6 y' S    os.environ.set("OS_AUTH_TYPE", "password"); `; L4 a% _% h3 N& b4 I
AttributeError: '_Environ' object has no attribute 'set'
  I, `, ?2 p% I5 f. j8 \+ P$ Z) w) x3 q) [2 v$ L" l
总结出两个办法消除这个错误。1 t8 i- r" }/ {$ Q* u
方法一:$ h6 E3 B& d! R$ n7 B5 V
0 l, e+ \( S0 r7 l# j7 Y
vim /usr/lib/python2.7/site-packages/gnocchiclient/shell.py% |, o- `- u6 O( }  n* m. T0 G
#将
4 Q1 [' Z$ P3 s2 t
( L! h+ D1 F" D2 I        # NOTE(jd) This is a workaroun for people using Keystone auth with the: f3 x) S9 g# R) b- h
        # CLI. A lot of rc files do not export OS_AUTH_TYPE=password and7 d  o$ o; V  e3 ]. L. t# Z" o4 B
        # assumes it is the default. It's not in that case, but since we can't
2 M+ @8 K' |; p0 H* K( {        # fix all the rc files of the world, workaround it here.
) u7 H# L- f8 |: }. x5 r. Q( d+ n        if ("OS_PASSWORD" in os.environ and
$ J/ A4 Q' r4 K1 e' e3 P7 b           "OS_AUTH_TYPE" not in os.environ):% y( d4 e# H0 K2 n+ s2 n- P
            os.environ.set("OS_AUTH_TYPE","password")
9 ~$ f" e& `/ q  b3 f9 O/ r#修改为( l' \0 n3 N. Z
2 m3 J% Y2 N# H6 c6 x4 r5 ^
        # NOTE(jd) This is a workaroun for people using Keystone auth with the5 \9 P0 x6 }' |1 t  F  F" t
        # CLI. A lot of rc files do not export OS_AUTH_TYPE=password and2 S5 X1 k7 K1 Q; T" z  x
        # assumes it is the default. It's not in that case, but since we can't
9 R$ {  H8 \: C4 x$ @' s        # fix all the rc files of the world, workaround it here.* N% X* m$ V6 m% t2 x
        if ("OS_PASSWORD" in os.environ and
5 r0 h9 b" |2 l4 `8 Z( i$ L           "OS_AUTH_TYPE" not in os.environ):
+ }3 e; ?( e) Q            os.environ.setdefault("OS_AUTH_TYPE","password")& p6 R' v# g; `. d4 p9 Q1 \
就是将 os.environ.set("OS_AUTH_TYPE","password")修改为os.environ.setdefault("OS_AUTH_TYPE","password")
; Z) B% D0 B1 o- M0 Y6 W方法二:- F* ~9 k  h! M6 W" k' G+ x4 k# U4 U
#将7 s/ |/ Y" R- T$ _
        # NOTE(jd) This is a workaroun for people using Keystone auth with the+ }; d9 C5 }* o
        # CLI. A lot of rc files do not export OS_AUTH_TYPE=password and
. N2 y: X5 _0 q        # assumes it is the default. It's not in that case, but since we can't
/ g: C4 |: J0 z5 r" Y* M        # fix all the rc files of the world, workaround it here.- U" H5 s) o# R  Y+ n& ]
        if ("OS_PASSWORD" in os.environ and
) w: {* x# ?) b5 L           "OS_AUTH_TYPE" not in os.environ):
1 N5 p! `) c2 Q            os.environ.set("OS_AUTH_TYPE","password")" c" M2 v3 U' ?  D- M  z/ F9 m' T
#修改为0 w/ l8 G$ ?  e" H
        # NOTE(jd) This is a workaroun for people using Keystone auth with the
( f, V1 b, I8 D        # CLI. A lot of rc files do not export OS_AUTH_TYPE=password and0 x. ~- \3 u2 Y& E" o' t; X5 a1 A+ S
        # assumes it is the default. It's not in that case, but since we can't" p1 k& k9 U$ A- c# u
        # fix all the rc files of the world, workaround it here.
1 x8 D+ r# m- Y2 D3 o        if ("OS_PASSWORD" in os.environ and
" x2 t+ I$ ?% d  h* K9 f           "OS_AUTH_TYPE" not in os.environ):
$ I& ?: R2 k! S% N, |; k1 B* }            os.environ["OS_AUTH_TYPE"]="password"4 x' U$ U& V- s% a7 I
就是将os.environ.set("OS_AUTH_TYPE","password")修改为os.environ["OS_AUTH_TYPE"]="password"5 L" r' U  W. e6 J! J* D
以上两种方法供借鉴
6 a; v0 w/ k* O5 O' U2 A
$ d: w$ h3 M% X: `7 Z1 U8 u! g% S
您需要登录后才可以回帖 登录 | 开始注册

本版积分规则

关闭

站长推荐上一条 /4 下一条

北京云银创陇科技有限公司以云计算运维,代码开发

QQ|返回首页|Archiver|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )点击这里给我发消息

GMT+8, 2026-4-8 21:20 , Processed in 0.046718 second(s), 25 queries .

Powered by Discuz! X3.4 Licensed

© 2012-2025 Discuz! Team.

快速回复 返回顶部 返回列表