Skip to content

Instantly share code, notes, and snippets.

@sivel
Last active May 25, 2022 06:49
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save sivel/d904fa5570f18fd0aafce0d7f751084b to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env python
# Copyright (c) 2020 Matt Martz <matt@sivel.net>
# 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,
)
@HOSTED-POWER
Copy link

Got this after using the script and trying to install my collection: ERROR! Checksum mismatch for 'FILES.json' inside collection at

@devlifealways
Copy link

Most certainly because of your sha256 mismatch, like the message says, which you can verify here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment