ansible / mazer

Experimental Ansible Galaxy Content Manager
GNU General Public License v3.0
113 stars 18 forks source link

'mazer build' will not build artifacts with default license #168

Closed alikins closed 5 years ago

alikins commented 6 years ago

Bug Report

If you attempt to build an artifact of a collection with default licensing (ie, 'all rights reserved') mazer throws an error. Either for not specifying a license, or for specifying a license that mazer does not know about (like 'all rights reserved').

MAZER VERSION
name = mazer
version = 0.3.0
config_file = /home/adrian/.ansible/mazer.yml
uname = Linux, newswoop, 4.18.12-100.fc27.x86_64, #1 SMP Thu Oct 4 16:22:17 UTC 2018, x86_64
executable_location = /home/adrian/venvs/galaxy-cli-py3-2/bin/mazer
python_version = 3.6.6 (default, Jul 19 2018, 16:29:00) [GCC 7.3.1 20180303 (Red Hat 7.3.1-5)]
python_executable = /home/adrian/venvs/galaxy-cli-py3-2/bin/python
CONFIGURATION
STEPS TO REPRODUCE

all_rights_reserved/galaxy.yml with no license attribute specified

name: "testing.all_rights_reserved"
version: "1.0.0"
description: "theoretical example of a collection without an spdx license"
authors: ["Adrian Likins"]
# license: "unstated-so-all-rights-reserved-by-default"

mazer build results

(galaxy-cli-py3-2) [newswoop:F27:collection_examples (remove_spdx %)]$ cat all_rights_reserved/galaxy.yml 

(galaxy-cli-py3-2) [newswoop:F27:collection_examples (remove_spdx %)]$ cd all_rights_reserved/
(galaxy-cli-py3-2) [newswoop:F27:all_rights_reserved (remove_spdx %)]$ mazer build
Traceback (most recent call last):
  File "/home/adrian/venvs/galaxy-cli-py3-2/bin/mazer", line 11, in <module>
    load_entry_point('mazer', 'console_scripts', 'mazer')()
  File "/home/adrian/src/mazer/ansible_galaxy_cli/main.py", line 35, in main
    exit_code = cli.run()
  File "/home/adrian/src/mazer/ansible_galaxy_cli/cli/galaxy.py", line 208, in run
    return self.execute()
  File "/home/adrian/src/mazer/ansible_galaxy_cli/cli/__init__.py", line 150, in execute
    return fn()
  File "/home/adrian/src/mazer/ansible_galaxy_cli/cli/galaxy.py", line 232, in execute_build
    display_callback=self.display)
  File "/home/adrian/src/mazer/ansible_galaxy/actions/build.py", line 79, in build
    display_callback=display_callback)
  File "/home/adrian/src/mazer/ansible_galaxy/actions/build.py", line 37, in _build
    info = collection_info.load(info_fd)
  File "/home/adrian/src/mazer/ansible_galaxy/collection_info.py", line 23, in load
    collection_info = CollectionInfo(**data_dict)
  File "<attrs generated init 75552934b6b939db6ab786888145a9ffbeb9fd02>", line 15, in __init__
  File "/home/adrian/venvs/galaxy-cli-py3-2/lib/python3.6/site-packages/attrs-18.1.0-py3.6.egg/attr/_make.py", line 1668, in __call__
    v(inst, attr, value)
  File "/home/adrian/src/mazer/ansible_galaxy/models/collection_info.py", line 45, in _check_required
    self.value_error("'%s' is required" % attribute.name)
  File "/home/adrian/src/mazer/ansible_galaxy/models/collection_info.py", line 37, in value_error
    raise ValueError("Invalid collection metadata. %s" % msg)
ValueError: Invalid collection metadata. 'license' is required
EXPECTED RESULTS

I should be able to build an artifact of a collection without specifying a license or changing the licensing of my code.

alikins commented 5 years ago

'license_file' option in galaxy.yml should take care of this for now. It can point to a license file with non spdx licenses if needed.