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

weird namespacing generated for local collection #68

Closed
SHxKM opened this issue Dec 5, 2021 · 19 comments · Fixed by #69
Closed

weird namespacing generated for local collection #68

SHxKM opened this issue Dec 5, 2021 · 19 comments · Fixed by #69

Comments

@SHxKM
Copy link

SHxKM commented Dec 5, 2021

Hi,

We're developing and testing a (new) local collection. We have renamed the collection (not the namespace) it but AFAIK have adjusted folder names, etc...we have also deleted changelogs and README.rst, and ran:

antsibull-changelog init .

Again, from the collection's root folder.

But now when we do:

antsibull-changelog release

The README.rst and changelogs.yml point to weird namespaces, example:

ancestor: null
releases:
  1.0.0:
    modules:
    - description: My Description
      name: my_module
      namespace: private.var.folders.gq.57xs6vj148b94dc95gw5m2980000gp.T.antsibull-changelog7zl7hgq9.collections.ansible_collections.mycompany.mynamespace.plugins.modules

I wonder if this is because I'm running antsibull from the same Python env where I also have the collection installed locally, so it is finding the wrong path somehow??

@SHxKM
Copy link
Author

SHxKM commented Dec 5, 2021

Running antribull release --version X.X.X does yields the same weird file paths from outside the virtualenv as well as inside.

@SHxKM
Copy link
Author

SHxKM commented Dec 5, 2021

Actually the namespacing with weird paths seems normal, the problem is that is also getting rendered in the README.rst file, which doesn’t seem normal.

This only seems to apply when all modules have the same ‘version_added’ as the version that we are releasing. Any insights as to why?

@SHxKM
Copy link
Author

SHxKM commented Dec 5, 2021

Hmm, utterly confused now - looking at other collections that utilize this library, I don't think these make much sense:

private.var.folders.gq.57xs6vj148b94dc95gw5m2980000gp.T.antsibull-changelog7zl7hgq9.collections.ansible_collections.mycompany.mynamespace.plugins.modules

What am I doing wrong?

@SHxKM
Copy link
Author

SHxKM commented Dec 5, 2021

I've tried deleting private.var.folders.gq.57xs6vj148b94dc95gw5m2980000gp and re-running the commands - same result.

@felixfontein
Copy link
Collaborator

I'm not sure what you mean with README.rst. antsibull-changelog does not have to do anything with README.rst - except if you configured the changleog .rst file to be README.rst? Is that the case?

Which version of ansible-core do you have installed? Is it also installed in the venv, and/or also outside the venv? Do you have symlinks in your Ansible collection paths? Anything that will help me reproduce this would be useful.

In any case, you can always modify the generated changelogs/changelog.yaml by replacing this wrong namespace with '', and then running antsibull-changelog generate to update the RST file.

@SHxKM
Copy link
Author

SHxKM commented Dec 5, 2021

I'm not sure what you mean with README.rst. antsibull-changelog does not have to do anything with README.rst - except if you configured the changleog .rst file to be README.rst? Is that the case?

Yes, I think that's what you mean?

# config.yml
changelog_filename_template: ../CHANGELOG.rst

Which version of ansible-core do you have installed?

2.11.6 in the venv. 2.11.2 outside.

Do you have symlinks in your Ansible collection paths?

No idea how to check that, shouldn't have, but could be.

In any case, you can always modify the generated changelogs/changelog.yaml by replacing this wrong namespace with '', and then running antsibull-changelog generate to update the RST file.

I'll try that.

Thanks @felixfontein !

@felixfontein
Copy link
Collaborator

Another question: which version of antsibull-changelog are you using?

@felixfontein
Copy link
Collaborator

(And is antsibull-changelog installed in the venv, outside the venv, or both?)

@SHxKM
Copy link
Author

SHxKM commented Dec 5, 2021

Another question: which version of antsibull-changelog are you using?

(And is antsibull-changelog installed in the venv, outside the venv, or both?)

Both

antsibull-changelog in venv:
0.12.0

antsibull-changelog global:
0.12.0

@SHxKM
Copy link
Author

SHxKM commented Dec 12, 2021

In any case, you can always modify the generated changelogs/changelog.yaml by replacing this wrong namespace with '', and then running antsibull-changelog generate to update the RST file.

This workaround is OK, but we're still having .plugin-cache.yaml get updated each time with a long, random string like mentioned above. @felixfontein - is this file OK to be excluded from SC?

@felixfontein
Copy link
Collaborator

@SHxKM that file is a local cache, there is no reason to check it in at all (see for example https://github.com/ansible-collections/collection_template/blob/main/.gitignore#L2).

@felixfontein
Copy link
Collaborator

Can you check whether #69 fixes the strange namespace issues you are getting?

@SHxKM
Copy link
Author

SHxKM commented Dec 13, 2021

Running:

antsibull-changelog release --version 1.0.1 -v

Yields the following error:

Traceback (most recent call last):
  File "REDACT/site-packages/antsibull_changelog/cli.py", line 239, in run
    return arguments.func(arguments)
  File "REDACT/antsibull_changelog/cli.py", line 454, in command_release
    use_ansible_doc=args.use_ansible_doc)
  File "REDACT/antsibull_changelog/plugins.py", line 405, in load_plugins
    if version != plugins_data['version']:
TypeError: 'NoneType' object is not subscriptable

EDIT, had to run this since I nuked the plugin-cache.yml file:

antsibull-changelog release --version 1.0.0 -v --reload-plugins

Will update

@SHxKM
Copy link
Author

SHxKM commented Dec 13, 2021

@felixfontein seems to fix it, just want to verify with you the following:

  • In CHANGELOG.rst (changelog_filename_template), under new modules, the FQCN should appear.

  • In changelog.yml, the namespace is empty like so:

 - description: Create event subscription for resource
      name: event_subscription
      namespace: ''
  • In .plugin-cache.yml, the namespace is empty like so:
    event_subscription:
      description: Create event subscription for resource
      name: event_subscription
      namespace: ''
      version_added: 1.0.0

If this looks OK to you then I think we got a solution!

@felixfontein
Copy link
Collaborator

@felixfontein seems to fix it, just want to verify with you the following:

* In `CHANGELOG.rst` (`changelog_filename_template`), under new modules, the FQCN should appear.

When you set use_fqcn: true in the config file (https://github.com/ansible-community/antsibull-changelog/blob/main/docs/changelog-configuration.rst#use-fqcn-boolean), that should be the case.

* In `changelog.yml`, the namespace is empty like so:
 - description: Create event subscription for resource
      name: event_subscription
      namespace: ''
* In  `.plugin-cache.yml`, the namespace is empty like so:
    event_subscription:
      description: Create event subscription for resource
      name: event_subscription
      namespace: ''
      version_added: 1.0.0

If this looks OK to you then I think we got a solution!

Looks good an as expected! The namespace in .plugin-cache.yml and in changelogs/changelog.yaml should always be empty or not present/null for plugins, except in collections like community.general and community.network which split up their plugins/modules folders.

@SHxKM
Copy link
Author

SHxKM commented Dec 13, 2021

The namespace in .plugin-cache.yml and in changelogs/changelog.yaml should always be empty or not present/null for plugins, except in collections like community.general and community.network which split up their plugins/modules folders.

just to be completely on the safe side here. In my example above we’re talking about a module not a plugin, or is that inclusive?

@felixfontein
Copy link
Collaborator

The problem only happens with modules, so your example suffices.

@SHxKM
Copy link
Author

SHxKM commented Dec 13, 2021

The problem only happens with modules, so your example suffices.

I was referring to this line:

The namespace in .plugin-cache.yml and in changelogs/changelog.yaml should always be empty or not present/null for plugins, except in collections like community.general and community.network which split up their plugins/modules folders.

I was wondering if it should always be not-present/empty for modules.

Thanks a bunch for taking care of this!

@felixfontein
Copy link
Collaborator

It should always be empty for modules, except (as I wrote above) in collections like community.general and community.network which split up their plugins/modules/ folders.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants