collection: Provide additional info about collection name restriction (#65250)

Fixes: #65151

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
Abhijeet Kasurde 2019-11-26 06:59:13 +05:30 committed by Jordan Borean
parent cd8b42c376
commit 9dca2bd3c4
3 changed files with 7 additions and 2 deletions

View file

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

View file

@ -454,7 +454,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

View file

@ -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
""" """