Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Add 'uninstall' subcommand to 'ansible-galaxy collection' #73464

Closed

Conversation

s-hertel
Copy link
Contributor

@s-hertel s-hertel commented Feb 3, 2021

SUMMARY

Fixes #67759

ISSUE TYPE
  • Feature Pull Request

@ansibot ansibot added WIP This issue/PR is a work in progress. Nevertheless it was shared for getting input from peers. affects_2.11 feature This issue/PR relates to a feature request. needs_triage Needs a first human triage before being processed. support:community This issue/PR relates to code supported by the Ansible community. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Feb 3, 2021
@s-hertel s-hertel force-pushed the ansible-galaxy_collection_uninstall branch 2 times, most recently from 8499da4 to 9f9ebf9 Compare February 3, 2021 18:49
@ansibot

This comment has been minimized.

@ansibot ansibot added the needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html label Feb 3, 2021
Copy link
Member

@webknjaz webknjaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't looked through everything, but here's a few things I noticed.

lib/ansible/cli/galaxy.py Outdated Show resolved Hide resolved
Comment on lines 290 to 291
remove_parser.add_argument('-n', '--no-deps', dest='no_deps', action='store_true', default=False,
help="Skip dependencies of the collection(s) to remove")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would we remove the deps by default? If anything, I'd require users to add --depclean (it's an actual argument name from Gentoo's emerge and is usually quite expensive). Do we track that those deps aren't required by anything else?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed this to be opt-in. I am checking if the collections (deps and otherwise) are used by anything else (unless --force is used).

lib/ansible/cli/galaxy.py Outdated Show resolved Hide resolved
lib/ansible/galaxy/collection/__init__.py Outdated Show resolved Hide resolved
lib/ansible/galaxy/collection/__init__.py Outdated Show resolved Hide resolved
@s-hertel
Copy link
Contributor Author

s-hertel commented Feb 3, 2021

Just adding a note to this, that we aren't going to rush it into 2.11.

@s-hertel s-hertel removed the needs_triage Needs a first human triage before being processed. label Feb 3, 2021
@webknjaz webknjaz marked this pull request as draft February 3, 2021 22:42
@ansibot ansibot removed the needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html label Feb 3, 2021
@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Feb 11, 2021
@s-hertel s-hertel closed this Apr 16, 2021
@ansible ansible locked and limited conversation to collaborators May 14, 2021
@s-hertel s-hertel reopened this Nov 19, 2021
@s-hertel s-hertel force-pushed the ansible-galaxy_collection_uninstall branch from 9f9ebf9 to 86bdaa7 Compare November 19, 2021 13:17
@ansibot ansibot removed the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Nov 19, 2021
@ansibot
Copy link
Contributor

ansibot commented Nov 19, 2021

The test ansible-test sanity --test package-data [explain] failed with the error:

Command "/root/.ansible/test/venv/sanity.package-data/3.10/ed96082c/bin/python /root/ansible/test/sanity/code-smell/package-data.py" returned exit status 1.
>>> Standard Error
Traceback (most recent call last):
  File "/root/ansible/test/sanity/code-smell/package-data.py", line 401, in <module>
    main()
  File "/root/ansible/test/sanity/code-smell/package-data.py", line 378, in main
    sdist_path = create_sdist(tmp_dir)
  File "/root/ansible/test/sanity/code-smell/package-data.py", line 185, in create_sdist
    raise Exception('make snapshot failed:\n%s' % stderr)
Exception: make snapshot failed:
Traceback (most recent call last):
  File "/tmp/tmpzo95q8in/hacking/build-ansible.py", line 103, in <module>
    main()
  File "/tmp/tmpzo95q8in/hacking/build-ansible.py", line 92, in main
    retval = command.main(args)
  File "/tmp/tmpzo95q8in/hacking/build_library/build_ansible/command_plugins/generate_man.py", line 279, in main
    allvars[cli_name] = opts_docs(cli_class_name, cli_name)
  File "/tmp/tmpzo95q8in/hacking/build_library/build_ansible/command_plugins/generate_man.py", line 211, in opts_docs
    action_depth = get_actions(cli.parser, docs)
  File "/tmp/tmpzo95q8in/hacking/build_library/build_ansible/command_plugins/generate_man.py", line 205, in get_actions
    depth = 1 + get_actions(parser, action_info)
  File "/tmp/tmpzo95q8in/hacking/build_library/build_ansible/command_plugins/generate_man.py", line 179, in get_actions
    action_info['desc'] = trim_docstring(getattr(cli, 'execute_%s' % action).__doc__)
AttributeError: 'GalaxyCLI' object has no attribute 'execute_uninstall'. Did you mean: 'execute_install'?
make: *** [Makefile:147: generate_rst] Error 1

The test ansible-test sanity --test docs-build [explain] failed with the error:

Command "/root/.ansible/test/venv/sanity.docs-build/3.10/3cd8b961/bin/python /root/ansible/test/sanity/code-smell/docs-build.py" returned exit status 1.
>>> Standard Error
Command 'make core_singlehtmldocs' failed with status code: 2
--> Standard Output
Creating symlinks in core_structure
ln -sf ../rst/core_index.rst rst/index.rst
ln -sf ../sphinx_conf/core_conf.py rst/conf.py
../../hacking/build-ansible.py collection-meta --template-file=../templates/collections_galaxy_meta.rst.j2 --output-dir=rst/dev_guide/  ../../lib/ansible/galaxy/data/collections_galaxy_meta.yml
../../hacking/build-ansible.py document-config --template-file=../templates/config.rst.j2 --output-dir=rst/reference_appendices/  ../../lib/ansible/config/base.yml
mkdir -p rst/cli
../../hacking/build-ansible.py generate-man --template-file=../templates/cli_rst.j2 --output-dir=rst/cli/ --output-format rst  ../../lib/ansible/cli/*.py
--> Standard Error
Traceback (most recent call last):
  File "/root/ansible/docs/docsite/../../hacking/build-ansible.py", line 103, in <module>
    main()
  File "/root/ansible/docs/docsite/../../hacking/build-ansible.py", line 92, in main
    retval = command.main(args)
  File "/root/ansible/hacking/build_library/build_ansible/command_plugins/generate_man.py", line 279, in main
    allvars[cli_name] = opts_docs(cli_class_name, cli_name)
  File "/root/ansible/hacking/build_library/build_ansible/command_plugins/generate_man.py", line 211, in opts_docs
    action_depth = get_actions(cli.parser, docs)
  File "/root/ansible/hacking/build_library/build_ansible/command_plugins/generate_man.py", line 205, in get_actions
    depth = 1 + get_actions(parser, action_info)
  File "/root/ansible/hacking/build_library/build_ansible/command_plugins/generate_man.py", line 179, in get_actions
    action_info['desc'] = trim_docstring(getattr(cli, 'execute_%s' % action).__doc__)
AttributeError: 'GalaxyCLI' object has no attribute 'execute_uninstall'. Did you mean: 'execute_install'?
make: *** [Makefile:192: cli] Error 1

click here for bot help

@s-hertel s-hertel force-pushed the ansible-galaxy_collection_uninstall branch from 04a6ab8 to af9a474 Compare November 19, 2021 21:35
@ansibot
Copy link
Contributor

ansibot commented Nov 19, 2021

The test ansible-test sanity --test package-data [explain] failed with the error:

Command "/root/.ansible/test/venv/sanity.package-data/3.10/ed96082c/bin/python /root/ansible/test/sanity/code-smell/package-data.py" returned exit status 1.
>>> Standard Error
Traceback (most recent call last):
  File "/root/ansible/test/sanity/code-smell/package-data.py", line 401, in <module>
    main()
  File "/root/ansible/test/sanity/code-smell/package-data.py", line 378, in main
    sdist_path = create_sdist(tmp_dir)
  File "/root/ansible/test/sanity/code-smell/package-data.py", line 185, in create_sdist
    raise Exception('make snapshot failed:\n%s' % stderr)
Exception: make snapshot failed:
Traceback (most recent call last):
  File "/tmp/tmp192z58qi/hacking/build-ansible.py", line 103, in <module>
    main()
  File "/tmp/tmp192z58qi/hacking/build-ansible.py", line 92, in main
    retval = command.main(args)
  File "/tmp/tmp192z58qi/hacking/build_library/build_ansible/command_plugins/generate_man.py", line 279, in main
    allvars[cli_name] = opts_docs(cli_class_name, cli_name)
  File "/tmp/tmp192z58qi/hacking/build_library/build_ansible/command_plugins/generate_man.py", line 211, in opts_docs
    action_depth = get_actions(cli.parser, docs)
  File "/tmp/tmp192z58qi/hacking/build_library/build_ansible/command_plugins/generate_man.py", line 205, in get_actions
    depth = 1 + get_actions(parser, action_info)
  File "/tmp/tmp192z58qi/hacking/build_library/build_ansible/command_plugins/generate_man.py", line 179, in get_actions
    action_info['desc'] = trim_docstring(getattr(cli, 'execute_%s' % action).__doc__)
AttributeError: 'GalaxyCLI' object has no attribute 'execute_uninstall'. Did you mean: 'execute_install'?
make: *** [Makefile:147: generate_rst] Error 1

The test ansible-test sanity --test docs-build [explain] failed with the error:

Command "/root/.ansible/test/venv/sanity.docs-build/3.10/3cd8b961/bin/python /root/ansible/test/sanity/code-smell/docs-build.py" returned exit status 1.
>>> Standard Error
Command 'make core_singlehtmldocs' failed with status code: 2
--> Standard Output
Creating symlinks in core_structure
ln -sf ../rst/core_index.rst rst/index.rst
ln -sf ../sphinx_conf/core_conf.py rst/conf.py
../../hacking/build-ansible.py collection-meta --template-file=../templates/collections_galaxy_meta.rst.j2 --output-dir=rst/dev_guide/  ../../lib/ansible/galaxy/data/collections_galaxy_meta.yml
../../hacking/build-ansible.py document-config --template-file=../templates/config.rst.j2 --output-dir=rst/reference_appendices/  ../../lib/ansible/config/base.yml
mkdir -p rst/cli
../../hacking/build-ansible.py generate-man --template-file=../templates/cli_rst.j2 --output-dir=rst/cli/ --output-format rst  ../../lib/ansible/cli/*.py
--> Standard Error
Traceback (most recent call last):
  File "/root/ansible/docs/docsite/../../hacking/build-ansible.py", line 103, in <module>
    main()
  File "/root/ansible/docs/docsite/../../hacking/build-ansible.py", line 92, in main
    retval = command.main(args)
  File "/root/ansible/hacking/build_library/build_ansible/command_plugins/generate_man.py", line 279, in main
    allvars[cli_name] = opts_docs(cli_class_name, cli_name)
  File "/root/ansible/hacking/build_library/build_ansible/command_plugins/generate_man.py", line 211, in opts_docs
    action_depth = get_actions(cli.parser, docs)
  File "/root/ansible/hacking/build_library/build_ansible/command_plugins/generate_man.py", line 205, in get_actions
    depth = 1 + get_actions(parser, action_info)
  File "/root/ansible/hacking/build_library/build_ansible/command_plugins/generate_man.py", line 179, in get_actions
    action_info['desc'] = trim_docstring(getattr(cli, 'execute_%s' % action).__doc__)
AttributeError: 'GalaxyCLI' object has no attribute 'execute_uninstall'. Did you mean: 'execute_install'?
make: *** [Makefile:192: cli] Error 1

click here for bot help

@ansibot
Copy link
Contributor

ansibot commented Nov 20, 2021

The test ansible-test sanity --test package-data [explain] failed with the error:

Command "/root/.ansible/test/venv/sanity.package-data/3.10/ed96082c/bin/python /root/ansible/test/sanity/code-smell/package-data.py" returned exit status 1.
>>> Standard Error
Traceback (most recent call last):
  File "/root/ansible/test/sanity/code-smell/package-data.py", line 401, in <module>
    main()
  File "/root/ansible/test/sanity/code-smell/package-data.py", line 378, in main
    sdist_path = create_sdist(tmp_dir)
  File "/root/ansible/test/sanity/code-smell/package-data.py", line 185, in create_sdist
    raise Exception('make snapshot failed:\n%s' % stderr)
Exception: make snapshot failed:
Traceback (most recent call last):
  File "/tmp/tmpazruelfj/hacking/build-ansible.py", line 103, in <module>
    main()
  File "/tmp/tmpazruelfj/hacking/build-ansible.py", line 92, in main
    retval = command.main(args)
  File "/tmp/tmpazruelfj/hacking/build_library/build_ansible/command_plugins/generate_man.py", line 279, in main
    allvars[cli_name] = opts_docs(cli_class_name, cli_name)
  File "/tmp/tmpazruelfj/hacking/build_library/build_ansible/command_plugins/generate_man.py", line 211, in opts_docs
    action_depth = get_actions(cli.parser, docs)
  File "/tmp/tmpazruelfj/hacking/build_library/build_ansible/command_plugins/generate_man.py", line 205, in get_actions
    depth = 1 + get_actions(parser, action_info)
  File "/tmp/tmpazruelfj/hacking/build_library/build_ansible/command_plugins/generate_man.py", line 179, in get_actions
    action_info['desc'] = trim_docstring(getattr(cli, 'execute_%s' % action).__doc__)
AttributeError: 'GalaxyCLI' object has no attribute 'execute_uninstall'. Did you mean: 'execute_install'?
make: *** [Makefile:147: generate_rst] Error 1

The test ansible-test sanity --test docs-build [explain] failed with the error:

Command "/root/.ansible/test/venv/sanity.docs-build/3.10/3cd8b961/bin/python /root/ansible/test/sanity/code-smell/docs-build.py" returned exit status 1.
>>> Standard Error
Command 'make core_singlehtmldocs' failed with status code: 2
--> Standard Output
Creating symlinks in core_structure
ln -sf ../rst/core_index.rst rst/index.rst
ln -sf ../sphinx_conf/core_conf.py rst/conf.py
../../hacking/build-ansible.py collection-meta --template-file=../templates/collections_galaxy_meta.rst.j2 --output-dir=rst/dev_guide/  ../../lib/ansible/galaxy/data/collections_galaxy_meta.yml
../../hacking/build-ansible.py document-config --template-file=../templates/config.rst.j2 --output-dir=rst/reference_appendices/  ../../lib/ansible/config/base.yml
mkdir -p rst/cli
../../hacking/build-ansible.py generate-man --template-file=../templates/cli_rst.j2 --output-dir=rst/cli/ --output-format rst  ../../lib/ansible/cli/*.py
--> Standard Error
Traceback (most recent call last):
  File "/root/ansible/docs/docsite/../../hacking/build-ansible.py", line 103, in <module>
    main()
  File "/root/ansible/docs/docsite/../../hacking/build-ansible.py", line 92, in main
    retval = command.main(args)
  File "/root/ansible/hacking/build_library/build_ansible/command_plugins/generate_man.py", line 279, in main
    allvars[cli_name] = opts_docs(cli_class_name, cli_name)
  File "/root/ansible/hacking/build_library/build_ansible/command_plugins/generate_man.py", line 211, in opts_docs
    action_depth = get_actions(cli.parser, docs)
  File "/root/ansible/hacking/build_library/build_ansible/command_plugins/generate_man.py", line 205, in get_actions
    depth = 1 + get_actions(parser, action_info)
  File "/root/ansible/hacking/build_library/build_ansible/command_plugins/generate_man.py", line 179, in get_actions
    action_info['desc'] = trim_docstring(getattr(cli, 'execute_%s' % action).__doc__)
AttributeError: 'GalaxyCLI' object has no attribute 'execute_uninstall'. Did you mean: 'execute_install'?
make: *** [Makefile:192: cli] Error 1

click here for bot help

@ansibot ansibot added needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. labels Mar 2, 2022
@jborean93
Copy link
Contributor

Closing as per @s-hertel requests. Will need to be reworked based on recent changes.

@jborean93 jborean93 closed this Nov 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.11 feature This issue/PR relates to a feature request. needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. support:community This issue/PR relates to code supported by the Ansible community. support:core This issue/PR relates to code supported by the Ansible Engineering Team. WIP This issue/PR is a work in progress. Nevertheless it was shared for getting input from peers.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add ansible-galaxy collection uninstall
4 participants