[2.9] collection: Provide additional info about collection name restriction (#65276)

Fixes: #65151

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
(cherry picked from commit 9dca2bd3c4)
pull/65504/head
Abhijeet Kasurde 5 years ago committed by Matt Davis
parent 4b9644c00b
commit 5a48f7ea6b

@ -0,0 +1,2 @@
minor_changes:
- Provides additional information about collection namespace name restrictions (https://github.com/ansible/ansible/issues/65151).

@ -453,7 +453,10 @@ def validate_collection_name(name):
if AnsibleCollectionRef.is_valid_collection_name(collection): if AnsibleCollectionRef.is_valid_collection_name(collection):
return name return name
raise AnsibleError("Invalid collection name '%s', name must be in the format <namespace>.<collection>." % name) raise AnsibleError("Invalid collection name '%s', "
"name must be in the format <namespace>.<collection>. "
"Please make sure namespace and collection name contains "
"characters from [a-zA-Z0-9_] only." % name)
@contextmanager @contextmanager

@ -474,7 +474,7 @@ class AnsibleCollectionRef:
@staticmethod @staticmethod
def is_valid_collection_name(collection_name): def is_valid_collection_name(collection_name):
""" """
Validates if is string is a well-formed collection name (does not look up the collection itself) Validates if the given string is a well-formed collection name (does not look up the collection itself)
:param collection_name: candidate collection name to validate (a valid name is of the form 'ns.collname') :param collection_name: candidate collection name to validate (a valid name is of the form 'ns.collname')
:return: True if the collection name passed is well-formed, False otherwise :return: True if the collection name passed is well-formed, False otherwise
""" """

Loading…
Cancel
Save