Blob Blame History Raw
From 209fa56d14439e049a951995846db9a0f8551222 Mon Sep 17 00:00:00 2001
From: Rich Megginson <rmeggins@redhat.com>
Date: Tue, 9 Feb 2021 09:48:10 -0700
Subject: [PATCH] fix collection lookup problem

This fixes the following error:
```
/bin/sh: line 9: cd: /root/.ansible/collections: No such file or directory
```
The fix is to ensure the directory exists before attempting
to `cd` to the directory.

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
---
 tests/tasks/get_modules_and_utils_paths.yml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/tasks/get_modules_and_utils_paths.yml b/tests/tasks/get_modules_and_utils_paths.yml
index 2090b7e..c71f169 100644
--- a/tests/tasks/get_modules_and_utils_paths.yml
+++ b/tests/tasks/get_modules_and_utils_paths.yml
@@ -50,6 +50,7 @@
       fi
     done
     for dir in {{ collection_paths | join(" ") }}; do
+      if [ ! -d "$dir" ]; then continue; fi
       cd "$dir"
       for subdir in ansible_collections/*/*/plugins/modules; do
         if [ -f "$subdir/network_connections.py" ]; then
@@ -75,6 +76,7 @@
       fi
     done
     for dir in {{ collection_paths | join(" ") }}; do
+      if [ ! -d "$dir" ]; then continue; fi
       cd "$dir"
       for subdir in ansible_collections/*/*/plugins/module_utils; do
         if [ -d "$subdir/network_lsr" ]; then
-- 
2.29.2