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

ansible-galaxy: add collection init sub command #57106

Open
wants to merge 16 commits into
base: devel
from

Conversation

@jborean93
Copy link
Contributor

commented May 29, 2019

SUMMARY

Add the command ansible-galaxy collection init to create an initial skeleton of a collections directory. This also adds all the ansible-galaxy ... commands under ansible-galaxy role ... for backwards compatibility.

TODO: Fix the cli doc generation to handle nested sub commands. Right now the docs only show the role and collection sub command. Edit: Done

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

ansible-galaxy

@ansibot

This comment was marked as outdated.

Copy link
Contributor

commented May 29, 2019

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

Command "/usr/bin/python3.6 test/sanity/code-smell/docs-build.py" returned exit status 1.
>>> Standard Error
Command 'make singlehtmldocs' failed with status code: 2
--> Standard Output
PYTHONPATH=../../lib ../bin/dump_config.py --template-file=../templates/config.rst.j2 --output-dir=rst/reference_appendices/ -d ../../lib/ansible/config/base.yml
mkdir -p rst/cli
PYTHONPATH=../../lib ../bin/generate_man.py --template-file=../templates/cli_rst.j2 --output-dir=rst/cli/ --output-format rst ../../lib/ansible/cli/*.py
Makefile:83: recipe for target 'cli' failed
--> Standard Error
Traceback (most recent call last):
  File "../bin/generate_man.py", line 253, in <module>
    allvars[cli_name] = opts_docs(cli_class_name, cli_name)
  File "../bin/generate_man.py", line 171, in opts_docs
    action_info['desc'] = trim_docstring(getattr(cli, 'execute_%s' % action).__doc__)
AttributeError: 'GalaxyCLI' object has no attribute 'execute_role'
make: *** [cli] Error 1

The test ansible-test sanity --test changelog [explain] failed with 1 error:

changelogs/fragments/galaxy-collection-init.yaml:0:0: invalid section: minor_features

The test ansible-test sanity --test pep8 [explain] failed with 2 errors:

lib/ansible/cli/galaxy.py:95:9: E303 too many blank lines (2)
lib/ansible/cli/galaxy.py:140:45: E128 continuation line under-indented for visual indent

click here for bot help

@ansibot ansibot added needs_revision and removed core_review labels May 29, 2019

@goneri goneri removed the needs_triage label May 30, 2019

@jborean93 jborean93 force-pushed the jborean93:collection-init branch from 9b9eaec to c4a2599 May 30, 2019

@ansibot ansibot added core_review and removed needs_revision labels May 30, 2019

@jborean93 jborean93 force-pushed the jborean93:collection-init branch from c4a2599 to 2864ce5 Jun 3, 2019

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Jun 4, 2019

@ansibot

This comment was marked as outdated.

Copy link
Contributor

commented Jun 6, 2019

The test ansible-test sanity --test compile --python 2.6 [explain] failed with 1 error:

lib/ansible/galaxy/collection.py:194:50: SyntaxError: dependencies = {name: {'version': version} for name, version in dependencies.items()}

click here for bot help

@samccann
Copy link
Contributor

left a comment

just a few nits :-)

Show resolved Hide resolved changelogs/fragments/galaxy-collection-init.yaml Outdated
Show resolved Hide resolved lib/ansible/cli/galaxy.py Outdated
Show resolved Hide resolved lib/ansible/cli/galaxy.py Outdated
Show resolved Hide resolved lib/ansible/cli/galaxy.py Outdated
Show resolved Hide resolved lib/ansible/cli/galaxy.py Outdated
Show resolved Hide resolved lib/ansible/config/base.yml Outdated
Show resolved Hide resolved lib/ansible/galaxy/data/default/collection/galaxy.yml.j2 Outdated
@samccann

This comment has been minimized.

Copy link
Contributor

commented Jun 6, 2019

One other doc nit - the top of the html page has the following text:
Perform various Role related operations.

Can you change that to say collection and role related operations?

Also would be good to have collections appear before roles if possible (to make it alphabetical) on the rendered ansible-galaxy cli page.

@alikins

This comment has been minimized.

Copy link
Contributor

commented Jun 10, 2019

I take it this means 'collection init' is no longer the responsibility of molecule?

@webknjaz

This comment has been minimized.

Copy link
Member

commented Jun 10, 2019

Well, ansible/molecule#2014 was never merged

Show resolved Hide resolved test/units/cli/test_galaxy.py Outdated
Show resolved Hide resolved test/units/cli/test_galaxy.py Outdated
Show resolved Hide resolved test/units/cli/test_galaxy.py Outdated

jborean93 added some commits May 29, 2019

@jborean93 jborean93 force-pushed the jborean93:collection-init branch from 13aec3d to ad057a8 Jun 16, 2019

jborean93 added some commits Jun 16, 2019

@webknjaz webknjaz self-requested a review Jun 17, 2019

Show resolved Hide resolved test/units/cli/test_galaxy.py Outdated
Show resolved Hide resolved test/units/cli/test_galaxy.py Outdated
Show resolved Hide resolved test/units/cli/test_galaxy.py Outdated
Show resolved Hide resolved test/units/cli/test_galaxy.py Outdated
Show resolved Hide resolved test/units/cli/test_galaxy.py Outdated


def test_publish_not_a_tarball():
expected = "The collection path specified '{0}' is not a tarball, use 'ansible-galaxy collection build' to " \

This comment has been minimized.

Copy link
@webknjaz

webknjaz Jun 17, 2019

Member

I recommend using braces instead of escaping EOL.

Suggested change
expected = "The collection path specified '{0}' is not a tarball, use 'ansible-galaxy collection build' to " \
expected = (
"The collection path specified '{0}' is not a tarball, "
"use 'ansible-galaxy collection build' to "
"create a proper release artifact."
)

This comment has been minimized.

Copy link
@jborean93

jborean93 Jun 17, 2019

Author Contributor

Personal preference really, I'm more of a fan of the other direction.

jborean93 added some commits Jun 17, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.