* ansible-galaxy collection install|verify: - Support verifying the origin of the MANIFEST.json when the Galaxy server has provided signatures. - Allow supplemental signatures to use during verification on the CLI/requirements file. * ansible-galaxy collection install: - Support disabling signature verification. This silences the warning provided by ansible-galaxy if the Galaxy server provided signatures it cannot use because no keyring is configured. - Store Galaxy server metadata alongside installed collections for provenance. This is used by 'ansible-galaxy collection verify --offline'. * Add unit tests for method that gets signatures from a Galaxy server * Add integration tests for user-provided signature sources - Test CLI option combinations - Test installing collections with valid/invalid signature sources - Test disabling GPG verification when installing collections - Test verifying collections with valid/invalid signature sources * Make signature verification advisory-by-default if signatures are provided by the Galaxy server - Make the default keyring None - Warn if the keyring is None but the Galaxy server provided signatures - Error if the keyring is None but the user supplied signatures - Error if the keyring is not None but is invalid * changelog * add ansible-galaxy user documentation for new options Co-authored-by: Matt Martz <matt@sivel.net> Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua> Co-authored-by: Martin Krizek <martin.krizek@gmail.com> Co-authored-by: Sandra McCann <samccann@redhat.com> Co-authored-by: Andy Mott <amott@redhat.com> Co-authored-by: John R Barker <john@johnrbarker.com>
35 lines
1.2 KiB
Python
35 lines
1.2 KiB
Python
# -*- coding: utf-8 -*-
|
|
# Copyright (c) 2020 Ansible Project
|
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
|
|
from __future__ import absolute_import, division, print_function
|
|
__metaclass__ = type
|
|
|
|
import pytest
|
|
|
|
from ansible.cli.galaxy import _get_collection_widths
|
|
from ansible.galaxy.dependency_resolution.dataclasses import Requirement
|
|
|
|
|
|
@pytest.fixture
|
|
def collection_objects():
|
|
collection_ham = Requirement('sandwiches.ham', '1.5.0', None, 'galaxy', None)
|
|
|
|
collection_pbj = Requirement('sandwiches.pbj', '2.5', None, 'galaxy', None)
|
|
|
|
collection_reuben = Requirement('sandwiches.reuben', '4', None, 'galaxy', None)
|
|
|
|
return [collection_ham, collection_pbj, collection_reuben]
|
|
|
|
|
|
def test_get_collection_widths(collection_objects):
|
|
assert _get_collection_widths(collection_objects) == (17, 5)
|
|
|
|
|
|
def test_get_collection_widths_single_collection(mocker):
|
|
mocked_collection = Requirement('sandwiches.club', '3.0.0', None, 'galaxy', None)
|
|
# Make this look like it is not iterable
|
|
mocker.patch('ansible.cli.galaxy.is_iterable', return_value=False)
|
|
|
|
assert _get_collection_widths(mocked_collection) == (15, 5)
|