|
|
AttributeError: '_Environ' object has no attribute 'set'
3 I3 R" m7 L" {% r. g7 p$ h( ITraceback (most recent call last):
, e1 z9 c/ G, D0 N& l6 v File "/usr/bin/gnocchi", line 10, in <module>
' E K+ e5 |. i; M, g2 I5 R; V sys.exit(main())
+ l) P0 P. R5 o" N2 ?3 N5 d1 } File "/usr/lib/python3.6/site-packages/gnocchiclient/shell.py", line 252, in main
% U. K+ M0 H( g return GnocchiShell().run(args)
2 w! l/ j. c( b" O( M+ C* P1 j File "/usr/lib/python3.6/site-packages/gnocchiclient/shell.py", line 99, in __init__9 h5 @1 V4 Q' Z! k ]4 i& c
deferred_help=True,
: S. r* L! j8 v1 U" E% @ File "/usr/lib/python3.6/site-packages/cliff/app.py", line 85, in __init__
& D2 t5 O4 ?0 R3 E% t: d7 @- g G self.parser = self.build_option_parser(description, version)
% H' U0 ]6 o$ A5 Y File "/usr/lib/python3.6/site-packages/gnocchiclient/shell.py", line 130, in build_option_parser' S% S. I" \( ?9 {
os.environ.set("OS_AUTH_TYPE", "password")* B# b! I4 y. p: X8 u5 p/ Z& I4 h& G
AttributeError: '_Environ' object has no attribute 'set'
" x+ I# t. O) X% h' D2 L7 W h' b7 B4 m2 j
总结出两个办法消除这个错误。
8 Z9 h9 M' A! t2 v( R* ~6 d1 L方法一:
2 P& v j5 \* E, U; n/ v' X- ?& a * I9 D9 s8 {4 Y4 k' a
vim /usr/lib/python2.7/site-packages/gnocchiclient/shell.py- K5 a1 t) j0 N- ~3 B( }
#将5 r5 S4 ]/ ]1 N/ b+ T' f( } L
3 @* _7 Z F7 g* e5 z # NOTE(jd) This is a workaroun for people using Keystone auth with the
% T$ S% H) {3 Q4 `" j, A C # CLI. A lot of rc files do not export OS_AUTH_TYPE=password and+ L2 R: E: u1 G# Z/ q( P
# assumes it is the default. It's not in that case, but since we can't
7 N, f( S1 a% ]- s8 t2 T7 w% A # fix all the rc files of the world, workaround it here.
- w4 d- w! I/ r/ D/ \6 ^: i if ("OS_PASSWORD" in os.environ and2 f& i- @0 e; e5 o
"OS_AUTH_TYPE" not in os.environ):
% i; v1 a: h" e. M: r os.environ.set("OS_AUTH_TYPE","password")& v6 d s' t6 E6 f! A5 d% F# ]
#修改为
) d" e! X) r ]
Y+ g' O3 g6 ?% b # NOTE(jd) This is a workaroun for people using Keystone auth with the
' g Q. v! X5 @, E- D # CLI. A lot of rc files do not export OS_AUTH_TYPE=password and$ l6 z' e6 Z2 j I% l
# assumes it is the default. It's not in that case, but since we can't
: O R0 W3 s5 l W6 c # fix all the rc files of the world, workaround it here.
# j( j. D' r0 Z$ t0 K if ("OS_PASSWORD" in os.environ and, g. W4 o# s& x* ?# P, ^
"OS_AUTH_TYPE" not in os.environ):
q9 F, M0 g/ B* h os.environ.setdefault("OS_AUTH_TYPE","password")
7 w2 R5 Z4 {8 g2 n) l% k5 t就是将 os.environ.set("OS_AUTH_TYPE","password")修改为os.environ.setdefault("OS_AUTH_TYPE","password"), C1 n* u6 f( M1 z0 p4 d
方法二:
/ M9 y* E: X' `5 T5 M3 V+ }#将2 I) J: h, p- U2 c2 m
# NOTE(jd) This is a workaroun for people using Keystone auth with the m+ `& f% {; ~, U! z
# CLI. A lot of rc files do not export OS_AUTH_TYPE=password and# d3 }" m( C/ s% Y$ o$ B9 H' @
# assumes it is the default. It's not in that case, but since we can't* Y3 C+ D w: z% ~, d4 V
# fix all the rc files of the world, workaround it here.! Q( N9 Y- b: \6 [: S5 h
if ("OS_PASSWORD" in os.environ and/ E5 Y, H, e" a8 b* D
"OS_AUTH_TYPE" not in os.environ):
+ Y+ g- \/ d$ K os.environ.set("OS_AUTH_TYPE","password")
8 k4 l, v! z4 Z+ h6 n \2 w#修改为( w- _- E+ ^, m, u& x* _
# NOTE(jd) This is a workaroun for people using Keystone auth with the, i- y, Q9 r8 I# b, ]9 V9 G
# CLI. A lot of rc files do not export OS_AUTH_TYPE=password and
; [8 |( b4 O5 Q9 m9 k # assumes it is the default. It's not in that case, but since we can't) n1 Q& T& e1 X; b& H& M
# fix all the rc files of the world, workaround it here.
7 x9 n- i9 Q! b9 l/ f: p if ("OS_PASSWORD" in os.environ and
$ u0 m2 \+ S" ^$ X1 W "OS_AUTH_TYPE" not in os.environ):% B2 u) n. l+ f# S0 ?
os.environ["OS_AUTH_TYPE"]="password"
5 y' { [) w8 L X0 |8 o就是将os.environ.set("OS_AUTH_TYPE","password")修改为os.environ["OS_AUTH_TYPE"]="password"
5 F3 _( V8 U+ {以上两种方法供借鉴# i. F9 K* A) k" u9 W& \
) p. ]2 _: m/ u+ q4 Z- e% u5 o8 ` |
|