找回密码
 注册
查看: 660|回复: 0

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

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2022-5-28 22:29:44 | 显示全部楼层 |阅读模式
AttributeError: '_Environ' object has no attribute 'set'
. Z7 q! W0 ]) h$ K) s) RTraceback (most recent call last):/ c$ K; V0 k' x# A
  File "/usr/bin/gnocchi", line 10, in <module>/ a! W6 N  `. S; R
    sys.exit(main())
% x4 @! ~9 ~; d* Z  File "/usr/lib/python3.6/site-packages/gnocchiclient/shell.py", line 252, in main* ~# t1 t( |" M' W; K# i
    return GnocchiShell().run(args)
6 Y2 r9 j! {1 z+ k4 n  File "/usr/lib/python3.6/site-packages/gnocchiclient/shell.py", line 99, in __init__- H5 B) P" k/ w7 U- m8 K0 Y) U
    deferred_help=True,: C  Y0 ~* p, M1 k4 ?! ~
  File "/usr/lib/python3.6/site-packages/cliff/app.py", line 85, in __init__
: E% q5 G, ]; P    self.parser = self.build_option_parser(description, version); |; e( V$ d1 ?* c+ x! c
  File "/usr/lib/python3.6/site-packages/gnocchiclient/shell.py", line 130, in build_option_parser, _& e- w% k& d. H% {5 m1 R% W
    os.environ.set("OS_AUTH_TYPE", "password")
; c/ _/ v' _$ Y% F0 b, x6 ^7 fAttributeError: '_Environ' object has no attribute 'set'
! S7 k5 P$ b8 j! X2 ?+ c( I: b) V
0 `& T; Y+ z( l$ f, g总结出两个办法消除这个错误。
; F& k- J0 N+ M* K方法一:
" D/ s5 t% b% ^+ @
+ q& K4 x+ Q0 k/ A; W% Q vim /usr/lib/python2.7/site-packages/gnocchiclient/shell.py- {* l: [1 y8 F- s' e
#将, N7 [$ x5 ^0 h+ z2 {

( Z& @- q) S6 }& k6 M        # NOTE(jd) This is a workaroun for people using Keystone auth with the
) L/ e  g. p2 M        # CLI. A lot of rc files do not export OS_AUTH_TYPE=password and
, t7 |: \0 ^9 m( p$ C        # assumes it is the default. It's not in that case, but since we can't
0 ?' s5 i$ p: S) N+ m; M* ^4 k+ `        # fix all the rc files of the world, workaround it here.
% k/ S" o, ~! }( J! W        if ("OS_PASSWORD" in os.environ and5 D( w- N5 Q7 M% ^
           "OS_AUTH_TYPE" not in os.environ):5 V1 O1 v+ T- E8 [! x& b
            os.environ.set("OS_AUTH_TYPE","password")
5 v/ R4 `" Q) K- X, K) W7 s#修改为
" R3 q5 e9 U2 d7 D+ K  `- f
+ F. A) B7 I3 W" P& ^; p6 c        # NOTE(jd) This is a workaroun for people using Keystone auth with the0 S4 A  j. ~- v* X2 t
        # CLI. A lot of rc files do not export OS_AUTH_TYPE=password and1 P4 r6 }( M* q
        # assumes it is the default. It's not in that case, but since we can't' g' ^1 p- Q  N- U! ~
        # fix all the rc files of the world, workaround it here.8 Y' N- R7 l# a  F  P4 g
        if ("OS_PASSWORD" in os.environ and$ R# R4 L0 e9 k+ d
           "OS_AUTH_TYPE" not in os.environ):
! }# _& [. F' {            os.environ.setdefault("OS_AUTH_TYPE","password"). R* M. u  y) j1 P+ t: o6 N2 b
就是将 os.environ.set("OS_AUTH_TYPE","password")修改为os.environ.setdefault("OS_AUTH_TYPE","password")
5 w; d, M9 @; \. W% F; L方法二:5 ~3 i: g( V4 O
#将$ c4 N9 R/ P) L6 S3 F' u
        # NOTE(jd) This is a workaroun for people using Keystone auth with the9 H4 p+ E8 ^! r" N6 h' S
        # CLI. A lot of rc files do not export OS_AUTH_TYPE=password and
5 s8 G# W4 [3 X& W& F4 T4 p; D7 |        # assumes it is the default. It's not in that case, but since we can't
5 c* \, s" \  E7 Y8 u( x+ Y        # fix all the rc files of the world, workaround it here.: ?, J' x0 T; F6 t# T
        if ("OS_PASSWORD" in os.environ and
$ q$ d  K+ {: x: C( a           "OS_AUTH_TYPE" not in os.environ):. t5 N& ]- M8 }; P7 F
            os.environ.set("OS_AUTH_TYPE","password")7 x1 Y) t' {  V
#修改为# a" L: j# U0 y
        # NOTE(jd) This is a workaroun for people using Keystone auth with the
4 h5 I/ P: c" {1 I4 G        # CLI. A lot of rc files do not export OS_AUTH_TYPE=password and% Q" T5 w- g/ ~) |; w# X# ^
        # assumes it is the default. It's not in that case, but since we can't. ?- o! `  V' b: Y8 p- e/ ?
        # fix all the rc files of the world, workaround it here.7 Q9 V# B7 |/ y9 z: k- x) Z/ t
        if ("OS_PASSWORD" in os.environ and9 g: M  e' l# `
           "OS_AUTH_TYPE" not in os.environ):2 o+ N$ N& D) q. w
            os.environ["OS_AUTH_TYPE"]="password", `9 @: }  Z& N$ W8 f" l
就是将os.environ.set("OS_AUTH_TYPE","password")修改为os.environ["OS_AUTH_TYPE"]="password"
$ A9 m/ a1 M4 A1 B# S以上两种方法供借鉴4 O( [5 N1 B6 `
2 L4 V& S' _# M+ ]
您需要登录后才可以回帖 登录 | 注册

本版积分规则

返回首页|Archiver|手机版|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )

GMT+8, 2026-6-12 00:10 , Processed in 0.017275 second(s), 23 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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