AWS cli和boto版本 - 多个版本和aws cli无法正常工作

时间:2018-04-19 09:21:56

标签: amazon-web-services chef boto botocore

我们有一个带有aws cli安装的Jenkins实例以及一个固定的boto版本。这导致aws无法在实例中解析

# aws
Traceback (most recent call last):
  File "/bin/aws", line 27, in <module>
    sys.exit(main())
  File "/bin/aws", line 23, in main
    return awscli.clidriver.main()
  File "/usr/lib/python2.7/site-packages/awscli/clidriver.py", line 58, in main
    driver = create_clidriver()
  File "/usr/lib/python2.7/site-packages/awscli/clidriver.py", line 69, in create_clidriver
    event_hooks=emitter)
  File "/usr/lib/python2.7/site-packages/awscli/plugin.py", line 44, in load_plugins
    modules = _import_plugins(plugin_mapping)
  File "/usr/lib/python2.7/site-packages/awscli/plugin.py", line 61, in _import_plugins
    module = __import__(path, fromlist=[module])
  File "/usr/lib/python2.7/site-packages/awscli/handlers.py", line 24, in <module>
    from awscli.customizations.assumerole import register_assume_role_provider
  File "/usr/lib/python2.7/site-packages/awscli/customizations/assumerole.py", line 5, in <module>
    from botocore.credentials import JSONFileCache

以完整路径运行aws

# /usr/local/aws/bin/aws
usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:

  aws help
  aws <command> help
  aws <command> <subcommand> help
aws: error: too few arguments

更新环境变量中的路径并不能解决问题。

任何想法

1 个答案:

答案 0 :(得分:0)

我的问题以两种方式保存。 我删除了名为aws cli的厨师食谱

为解决未来的问题,我更新了路径,但这次我添加了路径的开头(不是结束),因为安装了2个版本的AWScli

我没有意识到路径变量是从头到尾读取的,它正在读取较旧的AWS cli的路径环境变量而不是导致我出现问题的新路径变量,将新的awscli路径移动到开头路径变量解决了它