Skip to content

aws codeartifact login does not work with PyYAML v6 #8046

@agoblet

Description

@agoblet

Describe the bug

Recently, support for PyYAML v6 has been added. Some parts of the awscli do not work with that PyYAML version though. When trying to login to CodeArtifact, awscli raises an exception. This does not happen when downgrading to PyYAML v5.4.

Expected Behavior

I expected awscli to just login to codeartifact without any errors, like it does when PyYAML v5.4 is installed.

Current Behavior

Traceback (most recent call last):
  File "/opt/conda/bin/aws", line 27, in <module>
    sys.exit(main())
  File "/opt/conda/bin/aws", line 23, in main
    return awscli.clidriver.main()
  File "/opt/conda/lib/python3.7/site-packages/awscli/clidriver.py", line 69, in main
    driver = create_clidriver()
  File "/opt/conda/lib/python3.7/site-packages/awscli/clidriver.py", line 79, in create_clidriver
    event_hooks=session.get_component('event_emitter'))
  File "/opt/conda/lib/python3.7/site-packages/awscli/plugin.py", line 44, in load_plugins
    modules = _import_plugins(plugin_mapping)
  File "/opt/conda/lib/python3.7/site-packages/awscli/plugin.py", line 61, in _import_plugins
    module = __import__(path, fromlist=[module])
  File "/opt/conda/lib/python3.7/site-packages/awscli/handlers.py", line 27, in <module>
    from awscli.customizations.cloudformation import initialize as cloudformation_init
  File "/opt/conda/lib/python3.7/site-packages/awscli/customizations/cloudformation/__init__.py", line 13, in <module>
    from awscli.customizations.cloudformation.package import PackageCommand
  File "/opt/conda/lib/python3.7/site-packages/awscli/customizations/cloudformation/package.py", line 22, in <module>
    from awscli.customizations.cloudformation.artifact_exporter import Template
  File "/opt/conda/lib/python3.7/site-packages/awscli/customizations/cloudformation/artifact_exporter.py", line 27, in <module>
    from awscli.customizations.cloudformation.yamlhelper import yaml_dump, \
  File "/opt/conda/lib/python3.7/site-packages/awscli/customizations/cloudformation/yamlhelper.py", line 17, in <module>
    from yaml.resolver import ScalarNode, SequenceNode
ModuleNotFoundError: No module named 'yaml.resolver'

Reproduction Steps

aws codeartifact login --tool pip --domain abc --domain-owner 123456789012 --repository abcd

Possible Solution

make the yamlhelper compatible with PyYAML v6

Additional Information/Context

It would be great if awscli would support PyYAML v6, because other AWS packages such as sagemaker depend on PyYAML v6.

CLI version used

1.29.5

Environment details (OS name and version, etc.)

AWS Sagemaker SparkMagic kernel, awscli==1.29.5, PyYAML==6.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    codeartifactp3This is a minor priority issueresponse-requestedWaiting on additional info and feedback. Will move to "closing-soon" in 7 days.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions