代码之家  ›  专栏  ›  技术社区  ›  Personman

awscli iam update角色调用错误,声称缺少必需的参数

  •  2
  • Personman  · 技术社区  · 8 年前

    This AWS page 建议以下调用:

    $ aws iam update-role -–role-name ADFS-Production -–max-session-duration 14400
    

    当我运行这个(替换正确的角色名)时,我得到

    aws: error: the following arguments are required: --role-name
    

    这很令人困惑,因为论点就在那里!

    $ aws --version
    

    在我的机器上

    aws-cli/1.14.69 Python/3.6.4 Darwin/16.3.0 botocore/1.9.22
    

    我尝试使用调试器单步执行arg解析,问题似乎是option\u string\u操作列表没有正确填充:

    /usr/local/Cellar/python/3.6.4_3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/argparse.py(2093)_parse_optional()
    -> if arg_string in self._option_string_actions:
    (Pdb) l
    2088            # if it doesn't start with a prefix, it was meant to be positional
    2089            if not arg_string[0] in self.prefix_chars:
    2090                return None
    2091    
    2092            # if the option string is present in the parser, return the action
    2093 ->         if arg_string in self._option_string_actions:
    2094                action = self._option_string_actions[arg_string]
    2095                return action, arg_string, None
    2096    
    2097            # if it's just a single character, it was meant to be positional
    2098            if len(arg_string) == 1:
    (Pdb) self._option_string_actions
    {}
    

    但这很复杂,所以很难确定。有什么想法吗?

    1 回复  |  直到 8 年前
        1
  •  5
  •   krishna_mee2004    8 年前

    我执行了你的命令,但你的 -- 。你能试试下面的命令吗(除了你的 -- :

    aws iam update-role --role-name ADFS-Production --max-session-duration 14400