|
|
AttributeError: '_Environ' object has no attribute 'set' % W9 C3 j( ]. _9 Y$ ~: e5 |# E
Traceback (most recent call last):; R- d( i+ a0 p5 C q: w- v1 z. N
File "/usr/bin/gnocchi", line 10, in <module>
9 M1 [0 I. U# s. C* |+ l- _' w sys.exit(main())
# m0 U3 O* E7 p& q File "/usr/lib/python3.6/site-packages/gnocchiclient/shell.py", line 252, in main! D' Q B- F4 m" r( J. K3 v
return GnocchiShell().run(args)
) b2 ^/ \/ s/ q! `* ^' P# l! i% c File "/usr/lib/python3.6/site-packages/gnocchiclient/shell.py", line 99, in __init__% G& R8 O: `2 g8 `1 ?
deferred_help=True,
+ Z+ o' P% G: _- \7 c! E File "/usr/lib/python3.6/site-packages/cliff/app.py", line 85, in __init__5 k6 z7 J% a2 q, s
self.parser = self.build_option_parser(description, version)# Q/ W K1 H# w8 U% Y3 g
File "/usr/lib/python3.6/site-packages/gnocchiclient/shell.py", line 130, in build_option_parser R" S) p( P: q
os.environ.set("OS_AUTH_TYPE", "password"), r" p% p2 E' @: e% g
AttributeError: '_Environ' object has no attribute 'set'
7 r/ k0 z4 N, O4 r* r" c, c; `6 r
总结出两个办法消除这个错误。- o% e# D1 S, @+ F: w- B; M; m
方法一:* S& {: F- |. T j
3 T0 ^! s ?; @0 X: o( B
vim /usr/lib/python2.7/site-packages/gnocchiclient/shell.py; h, t* c2 C. J# P6 Y f- f3 F
#将
2 i' p- ? e' A2 J9 k! i
7 N8 c" ?6 N; A& ]& X # NOTE(jd) This is a workaroun for people using Keystone auth with the$ H3 ?" Y$ s; J4 @: A) U
# CLI. A lot of rc files do not export OS_AUTH_TYPE=password and
" R7 A/ v; ?3 y6 `. [ # assumes it is the default. It's not in that case, but since we can't
) K7 O5 U* V. g- u # fix all the rc files of the world, workaround it here.! `" O( b, N- A* H3 f2 ~4 N/ J+ V
if ("OS_PASSWORD" in os.environ and
/ o7 h H1 b' M/ J "OS_AUTH_TYPE" not in os.environ):
1 ^7 K2 P9 O- i; p* w7 b0 A os.environ.set("OS_AUTH_TYPE","password")! c2 a3 V. {/ R( e& U( \8 G6 o# \
#修改为 V+ i' H+ _+ y' T1 g1 Q. E4 a
; U( L, J+ j% D # NOTE(jd) This is a workaroun for people using Keystone auth with the
( C" ^0 ~2 M7 h! }2 m; w6 I # CLI. A lot of rc files do not export OS_AUTH_TYPE=password and3 ~! A: L/ E" J3 g' w! f! S
# assumes it is the default. It's not in that case, but since we can't: {. ~4 I4 g! H) {4 |& b. W
# fix all the rc files of the world, workaround it here.
7 P/ L2 f' K) _7 Y8 d# Y @ v if ("OS_PASSWORD" in os.environ and$ m% w0 t9 N& H
"OS_AUTH_TYPE" not in os.environ):
4 `% c# D( }4 i0 p- [ os.environ.setdefault("OS_AUTH_TYPE","password")/ q! u8 Q- j6 n: b) N* ~
就是将 os.environ.set("OS_AUTH_TYPE","password")修改为os.environ.setdefault("OS_AUTH_TYPE","password")
" [! o' a+ D) ^# }- h2 z方法二:
* R% A/ B& q/ i. b% @( _7 d#将
4 I) P4 _! q0 J/ C$ m2 P. V # NOTE(jd) This is a workaroun for people using Keystone auth with the
- f9 {$ V* h2 e7 W7 R- { # CLI. A lot of rc files do not export OS_AUTH_TYPE=password and b; W+ d6 I6 p, l; H. f) o
# assumes it is the default. It's not in that case, but since we can't# b9 l4 ^+ | V' G4 \
# fix all the rc files of the world, workaround it here.; x2 b( s8 |7 z1 q6 V" w
if ("OS_PASSWORD" in os.environ and
2 Q( w: E7 Q, e0 W "OS_AUTH_TYPE" not in os.environ):
' u; P: T( x# W. n* {7 z os.environ.set("OS_AUTH_TYPE","password")
+ {; `, |* E/ N) H#修改为2 L2 s7 Y/ \/ L8 M( L d
# NOTE(jd) This is a workaroun for people using Keystone auth with the
0 Q- `. G+ B6 B7 H! q3 G1 z! F' [3 u # CLI. A lot of rc files do not export OS_AUTH_TYPE=password and
1 o! U- c+ \, W8 ?) V+ ]% s, _ # assumes it is the default. It's not in that case, but since we can't+ q' J9 q9 g8 l m- e
# fix all the rc files of the world, workaround it here.
2 G+ C S: d3 {5 j if ("OS_PASSWORD" in os.environ and
/ k: b1 ~( w: c6 _ "OS_AUTH_TYPE" not in os.environ):" Y' N0 T4 i/ y5 X, S0 n
os.environ["OS_AUTH_TYPE"]="password"
& T4 l' w6 `- t+ k% g就是将os.environ.set("OS_AUTH_TYPE","password")修改为os.environ["OS_AUTH_TYPE"]="password"" p" C- j: C+ i9 _ W, v3 q( E0 v# a
以上两种方法供借鉴& O3 R1 `9 R h4 _( a7 P
7 Y% _4 q& z$ z3 u
|
|