Skip to content

Commit

Permalink
Instead of checking meta/main.yml, check tasks/main.yml.
Browse files Browse the repository at this point in the history
Always print ANSIBLE_COLLECTIONS_PATHS info when it needs to set.
  • Loading branch information
nhosoi committed Oct 29, 2020
1 parent 1930e21 commit 7b8f2c0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lsr_role2collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -969,12 +969,12 @@ def role2collection():
src_owner = args.src_owner
if not src_owner:
src_owner = os.path.basename(src_path)
_meta_path = src_path / "meta/main.yml"
if not _meta_path.exists():
_tasks_main = src_path / "tasks/main.yml"
if not _tasks_main.exists():
src_path = src_path / role
_meta_path = src_path / "meta/main.yml"
_tasks_main = src_path / "tasks/main.yml"

if not _meta_path.exists():
if not _tasks_main.exists():
logging.error(
f"Neither {src_path} nor {src_path.parent} is a role top directory."
)
Expand Down Expand Up @@ -1285,7 +1285,7 @@ def process_readme(src_path, filename, rolename, original=None, issubrole=False)
# suggest to run ansible-playbook with ANSIBLE_COLLECTIONS_PATHS env var.
if current_dest not in default_collections_paths_list:
ansible_collections_paths = current_dest + ":" + default_collections_paths
logging.info(
print(
f"Run ansible-playbook with environment variable ANSIBLE_COLLECTIONS_PATHS={ansible_collections_paths}"
)

Expand Down

0 comments on commit 7b8f2c0

Please sign in to comment.