Last active
May 25, 2022 06:49
-
-
Save sivel/d904fa5570f18fd0aafce0d7f751084b to your computer and use it in GitHub Desktop.
Script to create a MANIFEST.json and FILES.json for an Ansible collection from galaxy.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Copyright (c) 2020 Matt Martz <[email protected]> | |
# GNU General Public License v3.0+ | |
# (see https://www.gnu.org/licenses/gpl-3.0.txt) | |
import json | |
import os | |
from ansible.galaxy.collection import _build_files_manifest | |
from ansible.galaxy.collection import _build_manifest | |
from ansible.galaxy.collection import _get_galaxy_yml | |
from ansible.module_utils._text import to_bytes | |
galaxy = _get_galaxy_yml('galaxy.yml') | |
b_here = to_bytes(os.path.abspath('.')) | |
with open('MANIFEST.json', 'w+') as f: | |
json.dump( | |
_build_manifest(**galaxy), | |
f, | |
indent=4, | |
sort_keys=True, | |
) | |
with open('FILES.json', 'w+') as f: | |
json.dump( | |
_build_files_manifest( | |
b_here, | |
galaxy['namespace'], | |
galaxy['name'], | |
galaxy['build_ignore'], | |
), | |
f, | |
indent=4, | |
sort_keys=True, | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Got this after using the script and trying to install my collection: ERROR! Checksum mismatch for 'FILES.json' inside collection at