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

Improve galaxy_transform.py #48

Closed
wants to merge 1 commit into from

Conversation

nhosoi
Copy link
Contributor

@nhosoi nhosoi commented Feb 11, 2021

If the value of "dependencies" is empty, it fails in ansible-generator
with "AttributeError: 'NoneType' object has no attribute 'items'".

@nhosoi nhosoi requested a review from pcahyna February 11, 2021 23:15
If the value of "dependencies" is empty, it fails in ansible-generator
with "AttributeError: 'NoneType' object has no attribute 'items'".
@pcahyna
Copy link
Member

pcahyna commented Feb 11, 2021

Why is this needed? If the value was empty, wouldn't even the original file before the transform fail in the same way?

@nhosoi
Copy link
Contributor Author

nhosoi commented Feb 11, 2021

Why is this needed? If the value was empty, wouldn't even the original file before the transform fail in the same way?

Maybe the key is there for a placeholder? >> @richm?

@richm
Copy link
Contributor

richm commented Feb 11, 2021

Why is this needed? If the value was empty, wouldn't even the original file before the transform fail in the same way?

Maybe the key is there for a placeholder? >> @richm?

I have no idea. Not sure if it is required for Galaxy or Automation Hub upload.

@pcahyna
Copy link
Member

pcahyna commented Feb 11, 2021

@nhosoi what is the problem you are trying to fix - what is the problematic input file? galaxy.yml in the same repository? And is the problem present only in the converted file and not in the original file?
EDIT: and what is ansible-generator?

@nhosoi
Copy link
Contributor Author

nhosoi commented Feb 11, 2021

Why is this needed? If the value was empty, wouldn't even the original file before the transform fail in the same way?

Maybe the key is there for a placeholder? >> @richm?

I have no idea. Not sure if it is required for Galaxy or Automation Hub upload.

At least, Automation Hub upload does not require the field dependencies.

Do you happen to know how the galaxy.yml file was generated?

$ git log galaxy.yml
commit 5b4c617be67385df7c9dae5d37ce4aa1f4d51920 (origin/pr/30)
Author: Rich Megginson <[email protected]>
Date:   Tue Nov 17 16:27:37 2020 -0700
    Collection release scripts, data, docs

@nhosoi
Copy link
Contributor Author

nhosoi commented Feb 11, 2021

@nhosoi what is the problem you are trying to fix - what is the problematic input file? galaxy.yml in the same repository? And is the problem present only in the converted file and not in the original file?

Well, I thought we don't want to touch a file already being used by someone. It may introduce some unknown error. But if it's not, I have no objection to modify galaxy.yml.

EDIT: and what is ansible-generator?

Not fully understood yet, but for galaxy.yml, it is transformed to MANIFEST.json.

@pcahyna
Copy link
Member

pcahyna commented Feb 12, 2021

@nhosoi what is the problem you are trying to fix - what is the problematic input file? galaxy.yml in the same repository? And is the problem present only in the converted file and not in the original file?

Well, I thought we don't want to touch a file already being used by someone. It may introduce some unknown error. But if it's not, I have no objection to modify galaxy.yml.

Are you trying to fix some problem? Apparently yes, so how to reproduce it? I have not understood it from the original description, sorry. You say "It fails". What fails? galaxy_transform.py fails?

EDIT: and what is ansible-generator?

Not fully understood yet, but for galaxy.yml, it is transformed to MANIFEST.json.

And what is it, ansible-generator? Is it a command that you are trying to run? Or something else?

@pcahyna
Copy link
Member

pcahyna commented Feb 12, 2021

Sorry, I see that the reproducer was mentioned in #46 (comment)

@nhosoi
Copy link
Contributor Author

nhosoi commented Feb 12, 2021

@pcahyna, here's more complete snippet. If we don't have the empty value, we don't get the Traceback.

Process install dependency map
Starting collection install process
Installing 'redhat.rhel_system_roles:1.0.0' to '/home/nhosoi/rpmbuild/BUILDROOT/rhel-system-roles-1.0.0-26.el8.x86_64/usr/share/ansible/collections/ansible_collections/redhat/rhel_system_roles'
+ /usr/lib/rpm/find-debuginfo.sh -j4 --strict-build-id -m -i --build-id-seed 1.0.0-26.el8 --unique-debug-suffix -1.0.0-26.el8.x86_64 --unique-debug-src-base rhel-system-roles-1.0.0-26.el8.x86_64 --run-dwz --dwz-low-mem-die-limit 10000000 --dwz-max-die-limit 110000000 -S debugsourcefiles.list /home/nhosoi/builds/rhel-system-roles/auto-maintenance-20d31bf5d8e7eb67ce48af39e36c9f79d87490e3
+ /usr/lib/rpm/check-buildroot
+ /usr/lib/rpm/redhat/brp-ldconfig
+ /usr/lib/rpm/brp-compress
+ /usr/lib/rpm/brp-strip-static-archive /usr/bin/strip
+ /usr/lib/rpm/redhat/brp-python-bytecompile /usr/bin/python 1 0
+ /usr/lib/rpm/brp-python-hardlink
+ /usr/lib/rpm/redhat/brp-mangle-shebangs
mangling shebang in /usr/share/ansible/collections/ansible_collections/redhat/rhel_system_roles/tests/selinux/setup_module_utils.sh from /bin/bash to #!/usr/bin/bash
mangling shebang in /usr/share/ansible/collections/ansible_collections/redhat/rhel_system_roles/tests/storage/setup_module_utils.sh from /bin/bash to #!/usr/bin/bash
mangling shebang in /usr/share/ansible/collections/ansible_collections/redhat/rhel_system_roles/tests/nbde_server/setup_module_utils.sh from /bin/bash to #!/usr/bin/bash
mangling shebang in /usr/share/ansible/collections/ansible_collections/redhat/rhel_system_roles/tests/kernel_settings/setup_module_utils.sh from /bin/bash to #!/usr/bin/bash
mangling shebang in /usr/share/ansible/collections/ansible_collections/redhat/rhel_system_roles/tests/kernel_settings/install_ansible_for_testing.sh from /bin/bash to #!/usr/bin/bash
<< snip >>
Traceback (most recent call last):
  File "/usr/lib/rpm/ansible-generator", line 46, in <module>
    main()
  File "/usr/lib/rpm/ansible-generator", line 31, in main
    for dep, req in info.get("dependencies", {}).items():
AttributeError: 'NoneType' object has no attribute 'items'
Provides: ansible-collection(redhat.rhel_system_roles) = 1.0.0 ansible-collection-redhat-rhel_system_roles = 1.0.0-26.el8 rhel-system-roles = 1.0.0-26.el8
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires: (ansible >= 2.9.0 or ansible-base > 2.10.0) /usr/bin/bash /usr/bin/python3 /usr/bin/sh
Obsoletes: rhel-system-roles-techpreview < 1.0-3
Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/nhosoi/rpmbuild/BUILDROOT/rhel-system-roles-1.0.0-26.el8.x86_64
Wrote: /home/nhosoi/builds/rhel-system-roles/rhel-system-roles-1.0.0-26.el8.src.rpm
Wrote: /home/nhosoi/builds/rhel-system-roles/noarch/rhel-system-roles-1.0.0-26.el8.noarch.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.AwteDZ
+ umask 022
+ cd /home/nhosoi/builds/rhel-system-roles
+ cd auto-maintenance-20d31bf5d8e7eb67ce48af39e36c9f79d87490e3
+ /usr/bin/rm -rf /home/nhosoi/rpmbuild/BUILDROOT/rhel-system-roles-1.0.0-26.el8.x86_64
+ RPM_EC=0
++ jobs -p
+ exit 0

@pcahyna
Copy link
Member

pcahyna commented Feb 12, 2021

@pcahyna, here's more complete snippet. If we don't have the empty value, we don't get the Traceback.

I figured out that you are using rhpkg local. You should have said it earlier! :-)

Yes, I can reproduce your problem now, but IMO exactly the same problem would happen on Fedora with the unmodified galaxy.yml, so please do not paper over the problem by changing the innocent conversion tool.

@nhosoi
Copy link
Contributor Author

nhosoi commented Feb 12, 2021

@pcahyna, here's more complete snippet. If we don't have the empty value, we don't get the Traceback.

I figured out that you are using rhpkg local. You should have said it earlier! :-)

Yes, I can reproduce your problem now, but IMO exactly the same problem would happen on Fedora with the unmodified galaxy.yml, so please do not paper over the problem by changing the innocent conversion tool.

Sorry for my poor explanation and setting a wrong target... Closing this pr now.

@richm, is it ok to remove the empty dependencies from galaxy.yml in this repo?

@nhosoi nhosoi closed this Feb 12, 2021
@pcahyna
Copy link
Member

pcahyna commented Feb 12, 2021

@pcahyna, here's more complete snippet. If we don't have the empty value, we don't get the Traceback.

I figured out that you are using rhpkg local. You should have said it earlier! :-)

Yes, I can reproduce your problem now, but IMO exactly the same problem would happen on Fedora with the unmodified galaxy.yml, so please do not paper over the problem by changing the innocent conversion tool.

Shown by a Fedora build: http://coprbe.devel.redhat.com/results/pcahyna/rhel-system-roles-collections/fedora-33-x86_64/00062989-linux-system-roles/builder-live.log.gz

@richm
Copy link
Contributor

richm commented Feb 12, 2021

@richm, is it ok to remove the empty dependencies from galaxy.yml in this repo?

If it is not needed by Galaxy import or Automation Hub import, then yes, you can remove it.

@pcahyna
Copy link
Member

pcahyna commented Feb 12, 2021

According to https://docs.ansible.com/ansible/latest/dev_guide/collections_galaxy_meta.html#collections-galaxy-meta, this key is not among the required ones.

@nhosoi nhosoi deleted the galaxy_transform branch April 20, 2021 23:15
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 this pull request may close these issues.

3 participants