summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Clay <matt@mystile.com>2023-05-03 18:41:25 -0700
committerGitHub <noreply@github.com>2023-05-03 18:41:25 -0700
commit7eada15d1e9470e010f1c13b52450b01d8e46930 (patch)
tree42266bc3e6f8357affaa8a75b5510a3ef0318270
parentd12aa7f69cefddf8b849a93186d4afd8e6615bc5 (diff)
downloadansible-7eada15d1e9470e010f1c13b52450b01d8e46930.tar.gz
Remove unused code from lib/ansible/collections/ (#80712)
-rw-r--r--lib/ansible/collections/__init__.py29
-rw-r--r--lib/ansible/collections/list.py36
2 files changed, 0 insertions, 65 deletions
diff --git a/lib/ansible/collections/__init__.py b/lib/ansible/collections/__init__.py
index 97126c0926..e69de29bb2 100644
--- a/lib/ansible/collections/__init__.py
+++ b/lib/ansible/collections/__init__.py
@@ -1,29 +0,0 @@
-# (c) 2019 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 os
-
-from ansible.module_utils.common.text.converters import to_bytes
-
-B_FLAG_FILES = frozenset([b'MANIFEST.json', b'galaxy.yml'])
-
-
-def is_collection_path(path):
- """
- Verify that a path meets min requirements to be a collection
- :param path: byte-string path to evaluate for collection containment
- :return: boolean signifying 'collectionness'
- """
-
- is_coll = False
- b_path = to_bytes(path)
- if os.path.isdir(b_path):
- for b_flag in B_FLAG_FILES:
- if os.path.exists(os.path.join(b_path, b_flag)):
- is_coll = True
- break
-
- return is_coll
diff --git a/lib/ansible/collections/list.py b/lib/ansible/collections/list.py
index 4c1e5502be..dd428e11f8 100644
--- a/lib/ansible/collections/list.py
+++ b/lib/ansible/collections/list.py
@@ -1,16 +1,10 @@
# (c) 2019 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 os
-
from ansible.errors import AnsibleError
from ansible.cli.galaxy import with_collection_artifacts_manager
from ansible.galaxy.collection import find_existing_collections
from ansible.module_utils.common.text.converters import to_bytes
-from ansible.utils.collection_loader import AnsibleCollectionConfig
from ansible.utils.collection_loader._collection_finder import _get_collection_name_from_path
from ansible.utils.display import Display
@@ -27,36 +21,6 @@ def list_collections(coll_filter=None, search_paths=None, dedupe=True, artifacts
return collections
-def list_valid_collection_paths(search_paths=None, warn=False):
- """
- Filter out non existing or invalid search_paths for collections
- :param search_paths: list of text-string paths, if none load default config
- :param warn: display warning if search_path does not exist
- :return: subset of original list
- """
-
- if search_paths is None:
- search_paths = []
-
- search_paths.extend(AnsibleCollectionConfig.collection_paths)
-
- for path in search_paths:
-
- b_path = to_bytes(path)
- if not os.path.exists(b_path):
- # warn for missing, but not if default
- if warn:
- display.warning("The configured collection path {0} does not exist.".format(path))
- continue
-
- if not os.path.isdir(b_path):
- if warn:
- display.warning("The configured collection path {0}, exists, but it is not a directory.".format(path))
- continue
-
- yield path
-
-
@with_collection_artifacts_manager
def list_collection_dirs(search_paths=None, coll_filter=None, artifacts_manager=None, dedupe=True):
"""