Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link

@HOSTED-POWER HOSTED-POWER commented Sep 20, 2021

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

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