【问题标题】:AWS cli and boto versions - Multiple versions and aws cli not workingAWS cli 和 boto 版本 - 多个版本和 aws cli 不起作用
【发布时间】:2018-04-19 22:23:47
【问题描述】:

我们有一个安装了 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

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

任何想法

【问题讨论】:

  • 为了提供一些上下文,我们让 chef 在这个实例上运行,并使用调用 aws cli 的说明书。由于这些食谱不需要定义 aws cli 路径,因为通常 aws 会默认解析为 cli,因此 Chef 现在在此特定实例上失败

标签: amazon-web-services chef-infra boto botocore


【解决方案1】:

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

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-05-06
    • 2017-08-09
    • 2021-09-11
    • 2018-01-03
    • 2021-11-18
    • 2015-01-27
    • 2021-10-06
    相关资源
    最近更新 更多