Skip to content

Commit 2199bb7

Browse files
authored
Merge pull request #266 from StewartW/issue-265
adding recursive search to deployment_map processor
2 parents 0155398 + 1ea1c59 commit 2199bb7

1 file changed

Lines changed: 15 additions & 6 deletions

File tree

  • src/lambda_codebase/initial_commit/bootstrap_repository/adf-build/shared

src/lambda_codebase/initial_commit/bootstrap_repository/adf-build/shared/deployment_map.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,26 @@ def _get_all(self):
8181
self.map_contents = {}
8282
self.map_contents['pipelines'] = []
8383
if os.path.isdir(self.map_dir_path):
84-
for file in os.listdir(self.map_dir_path):
85-
if file.endswith(".yml") and file != 'example-deployment_map.yml':
86-
self.determine_extend_map(
87-
self._read('{0}/{1}'.format(self.map_dir_path, file))
88-
)
84+
self._process_dir(self.map_dir_path)
8985
self.determine_extend_map(
90-
self._read() # Calling with default no args to get deployment_map.yml in root if it exists
86+
self._read() # Calling with default no args to get deployment_map.yml in root if it exists
9187
)
9288
if not self.map_contents['pipelines']:
9389
LOGGER.error(
9490
"No Deployment Map files found, create a deployment_map.yml file in the root of the repository to create pipelines. "
9591
"You can create additional deployment maps if required in a folder named deployment_maps with any name (ending in .yml)"
9692
)
9793
raise InvalidDeploymentMapError("No Deployment Map files found..") from None
94+
95+
def _process_dir(self, path):
96+
files = [os.path.join(path, f) for f in os.listdir(path)]
97+
for filename in files:
98+
LOGGER.info(f"Processing {filename} in path {path}")
99+
if os.path.isdir(filename):
100+
self._process_dir(filename)
101+
elif filename.endswith(".yml") and filename != "example-deployment_map.yml":
102+
self.determine_extend_map(
103+
self._read(filename)
104+
)
105+
else:
106+
LOGGER.warning(f"{filename} is not a directory and doesn't end in.yml")

0 commit comments

Comments
 (0)