Commit 3e010c2d by MichaelRoytman Committed by GitHub

Merge pull request #3252 from edx/michael/fix-parsefiles

Fix bug where testing for membership of a file path in a set of file …
parents c20209ec afe10ee7
...@@ -59,7 +59,7 @@ def _map_roles_to_roles(graph, dirs, git_dir, key, type_1, type_2): ...@@ -59,7 +59,7 @@ def _map_roles_to_roles(graph, dirs, git_dir, key, type_1, type_2):
for item in d.iterdir(): for item in d.iterdir():
# attempts to find meta/*.yml file in item directory tree # attempts to find meta/*.yml file in item directory tree
roles = [f for f in item.glob("meta/*.yml")] roles = {f for f in item.glob("meta/*.yml")}
# if a meta/*.yml file(s) exists for a role # if a meta/*.yml file(s) exists for a role
if roles: if roles:
...@@ -169,7 +169,7 @@ def change_set_to_roles(files, git_dir, roles_dirs, playbooks_dirs, graph): ...@@ -169,7 +169,7 @@ def change_set_to_roles(files, git_dir, roles_dirs, playbooks_dirs, graph):
role_dir_path = pathlib2.Path(git_dir, role_dir) role_dir_path = pathlib2.Path(git_dir, role_dir)
# get all files in the directories containing roles (i.e. all the roles in that directory) # get all files in the directories containing roles (i.e. all the roles in that directory)
candidate_files = (f for f in role_dir_path.glob("**/*")) candidate_files = {f for f in role_dir_path.glob("**/*")}
# for all the files in the change set # for all the files in the change set
for f in files: for f in files:
...@@ -186,7 +186,7 @@ def change_set_to_roles(files, git_dir, roles_dirs, playbooks_dirs, graph): ...@@ -186,7 +186,7 @@ def change_set_to_roles(files, git_dir, roles_dirs, playbooks_dirs, graph):
# get all files in directory containing playbook that end with yml extension # get all files in directory containing playbook that end with yml extension
# (i.e. all playbooks in that directory) # (i.e. all playbooks in that directory)
candidate_files = (f for f in play_dir_path.glob("*.yml")) candidate_files = {f for f in play_dir_path.glob("*.yml")}
# for all filse in the change set # for all filse in the change set
for f in files: for f in files:
...@@ -250,7 +250,7 @@ def get_docker_plays(roles, graph): ...@@ -250,7 +250,7 @@ def get_docker_plays(roles, graph):
items = set() items = set()
docker_plays = (node.name for node in graph.nodes() if node.type == "docker_playbook") docker_plays = {node.name for node in graph.nodes() if node.type == "docker_playbook"}
for play in docker_plays: for play in docker_plays:
# all roles that are used by play # all roles that are used by play
...@@ -347,7 +347,7 @@ if __name__ == '__main__': ...@@ -347,7 +347,7 @@ if __name__ == '__main__':
# aws_plays_paths: # aws_plays_paths:
# - <all paths relative to configuration repository that contain aws Ansible playbooks> # - <all paths relative to configuration repository that contain aws Ansible playbooks>
# docker_plays_paths: # docker_plays_paths:
# - <all paths relative to configuration repositroy that contain Docker Ansible playbooks> # - <all paths relative to configuration repository that contain Docker Ansible playbooks>
# read config file # read config file
config = _open_yaml_file(CONFIG_FILE_PATH) config = _open_yaml_file(CONFIG_FILE_PATH)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment