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

Fix boolean error in warning; error out if only one of --version and --codename is supplied for an ansible-core release #105

Merged
merged 3 commits into from
Mar 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/105-version-codename.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- "When releasing ansible-core and only one of ``--version`` and ``--codename`` is supplied, error out instead of ignoring the supplied value (https://github.com/ansible-community/antsibull-changelog/issues/104, https://github.com/ansible-community/antsibull-changelog/pull/105)."
8 changes: 7 additions & 1 deletion src/antsibull_changelog/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def set_paths(force: str | None = None,
raise ChangelogError( # pylint: disable=raise-missing-from
"Only the 'init' command can be used outside an Ansible checkout and outside a "
"collection repository, or inside one without changelogs/config.yaml.\n"
"If you are in a collection without galaxy.yml, specify `--is-collection no` "
"If you are in a collection without galaxy.yml, specify `--is-collection yes` "
"on the command line.")


Expand Down Expand Up @@ -486,6 +486,12 @@ def _get_version_and_codename(paths: PathsConfig, config: ChangelogConfig,
codename: str | None = args.codename

if not config.is_collection and not config.is_other_project and not (version and codename):
if version or codename:
# Only one is supplied: error out instead of simply ignoring that one
raise ChangelogError(
'For ansible-core releases both --version and --codename must be supplied if at'
' least one of them has been supplied'
)
# Both version and codename are required for ansible-core
try:
return get_ansible_release()
Expand Down