找回密码
 注册
查看: 662|回复: 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' + g# x5 d& H4 f9 A0 w7 v
Traceback (most recent call last):! f$ u! L! r7 ?
  File "/usr/bin/gnocchi", line 10, in <module>! _( n% a6 w! x$ r: @* h0 o% N
    sys.exit(main())+ U6 d9 z+ P- k8 B
  File "/usr/lib/python3.6/site-packages/gnocchiclient/shell.py", line 252, in main
" M1 I6 H$ C/ N, P1 |5 w3 D    return GnocchiShell().run(args)
. Y* O, i% N! i1 ^  File "/usr/lib/python3.6/site-packages/gnocchiclient/shell.py", line 99, in __init__
1 ~& e! s0 Z) a' f; N, e6 N    deferred_help=True,
: j3 B0 b3 L8 N; m  File "/usr/lib/python3.6/site-packages/cliff/app.py", line 85, in __init__
. U: }; s, I3 A( q    self.parser = self.build_option_parser(description, version). C" F; G/ N' M: X$ ^- F
  File "/usr/lib/python3.6/site-packages/gnocchiclient/shell.py", line 130, in build_option_parser) T. ^: Z* _3 b5 Y
    os.environ.set("OS_AUTH_TYPE", "password")
( y0 A# L) V$ z# O. Z( {5 _AttributeError: '_Environ' object has no attribute 'set'. K/ i$ W. A5 P$ c+ p' s

- J' P& G( x2 y4 i2 f1 e总结出两个办法消除这个错误。# k  N' t6 T( u, U( f% t
方法一:3 a0 p5 c6 e% {0 z3 l/ `9 j+ F" s

1 W- I' L$ C/ C* c$ G% X4 Y vim /usr/lib/python2.7/site-packages/gnocchiclient/shell.py# ]# Z# o# \1 x6 P' P
#将2 u8 _$ j2 o* Q. r# a; I

7 [7 z8 C- g! Q: z5 g        # NOTE(jd) This is a workaroun for people using Keystone auth with the
+ q9 w& O2 h  g# Y9 C        # CLI. A lot of rc files do not export OS_AUTH_TYPE=password and- N4 M( I; E) n3 L& Y. I6 K
        # assumes it is the default. It's not in that case, but since we can't  @" Q/ |% W! t) z, C: S% |5 B
        # fix all the rc files of the world, workaround it here.) E8 H) M2 q6 P( v, m3 S6 k
        if ("OS_PASSWORD" in os.environ and! Q5 I7 \: r% n- a. J. g/ l
           "OS_AUTH_TYPE" not in os.environ):3 B4 l2 n+ r; w( _
            os.environ.set("OS_AUTH_TYPE","password"). V  f, D: [' X+ ^3 b% Y$ D
#修改为
& K3 Y. I1 \, l1 o  e 6 z2 t6 [% [, G' }; b% b9 X, O- ]
        # NOTE(jd) This is a workaroun for people using Keystone auth with the* ]4 }, {# E6 |+ [) x
        # CLI. A lot of rc files do not export OS_AUTH_TYPE=password and" s# b9 g4 m3 c1 U0 K5 ~0 S
        # assumes it is the default. It's not in that case, but since we can't  d% g+ ~  x3 J. \
        # fix all the rc files of the world, workaround it here.; u3 n& T. Q' n3 S
        if ("OS_PASSWORD" in os.environ and
  P# l1 W4 D, M           "OS_AUTH_TYPE" not in os.environ):
, @; q) C# x6 k7 ]1 ^0 B" f" J            os.environ.setdefault("OS_AUTH_TYPE","password")3 d8 n$ N# z( u
就是将 os.environ.set("OS_AUTH_TYPE","password")修改为os.environ.setdefault("OS_AUTH_TYPE","password")6 M( J  V% S, j
方法二:
" P! |" W' z& _#将* c- O* b3 F" u3 p- l7 T$ r
        # NOTE(jd) This is a workaroun for people using Keystone auth with the
, e+ L" H1 M1 c9 p" R, H        # CLI. A lot of rc files do not export OS_AUTH_TYPE=password and7 a& x0 {6 }& F* y5 l, u8 f2 e
        # assumes it is the default. It's not in that case, but since we can't
! Q" o0 m- S" v8 x& K1 `        # fix all the rc files of the world, workaround it here.
% n5 E, z( j0 W        if ("OS_PASSWORD" in os.environ and/ j2 c9 _8 _3 E/ Y4 G( P0 g
           "OS_AUTH_TYPE" not in os.environ):( l0 x, N2 v/ R: J$ w/ ]& l) X
            os.environ.set("OS_AUTH_TYPE","password")' [6 v0 Y+ G) o# V. O+ ^
#修改为
5 i2 c1 G3 S- J; f8 J# g& X        # NOTE(jd) This is a workaroun for people using Keystone auth with the$ H! U, ^, V, z! N; `
        # CLI. A lot of rc files do not export OS_AUTH_TYPE=password and
% A! F3 W( R9 E/ o5 H% w        # assumes it is the default. It's not in that case, but since we can't! z+ v0 X8 {$ `4 s% E) @4 ~% r
        # fix all the rc files of the world, workaround it here.5 a0 s6 y( L5 F$ H$ b
        if ("OS_PASSWORD" in os.environ and- G  c. e' q& I$ L9 o% D  w
           "OS_AUTH_TYPE" not in os.environ):& p, [. H* U3 f. K
            os.environ["OS_AUTH_TYPE"]="password"
* K$ @' l+ l( g8 \就是将os.environ.set("OS_AUTH_TYPE","password")修改为os.environ["OS_AUTH_TYPE"]="password"
7 u: T6 b' h4 y9 @以上两种方法供借鉴
8 n7 m% A( c. p7 X. b, E, X1 V: J  o' S2 H# F: F
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-6-12 03:22 , Processed in 0.019234 second(s), 23 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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