File tree Expand file tree Collapse file tree 2 files changed +27
-7
lines changed Expand file tree Collapse file tree 2 files changed +27
-7
lines changed Original file line number Diff line number Diff line change @@ -175,6 +175,23 @@ def prune_databag(databag):
175
175
return pruned
176
176
177
177
178
+ def verify_databag (databag , repo_names ):
179
+ """
180
+ Ensure all repository names are accurate.
181
+ """
182
+ for project in databag ["projects" ]:
183
+ databag_repos = project ["repos" ].split ("," )
184
+ for databag_repo in databag_repos :
185
+ if databag_repo not in repo_names :
186
+ logger .log (
187
+ logging .ERROR ,
188
+ f'"{ project ["name" ]} " contains invalid reposiotry:'
189
+ f' "{ databag_repo } "' ,
190
+ )
191
+ sys .exit (1 )
192
+ return databag
193
+
194
+
178
195
def get_custom_field (task , field_name ):
179
196
"""
180
197
Gets the value of a custom field
@@ -187,5 +204,9 @@ def get_custom_field(task, field_name):
187
204
return field ["text_value" ]
188
205
189
206
190
- def get_community_team_data (asana_client ):
191
- return prune_databag (sort_databag (generate_databag (asana_client )))
207
+ def get_community_team_data (asana_client , repo_names ):
208
+ databag = generate_databag (asana_client )
209
+ databag = prune_databag (databag )
210
+ databag = verify_databag (databag , repo_names )
211
+ databag = sort_databag (databag )
212
+ return databag
Original file line number Diff line number Diff line change 14
14
get_community_team_data ,
15
15
setup_asana_client ,
16
16
)
17
- from ccos .data .get_repo_data import get_repo_data
17
+ from ccos .data .get_repo_data import get_repo_data , get_repo_names
18
18
from ccos .data .push_data_via_git import push_data
19
19
20
20
DAILY_DATABAGS = ["repos" , "community_team_members" ]
@@ -57,10 +57,9 @@ def main():
57
57
push_data (get_repo_data (), "repos.json" )
58
58
if "community_team_members" in args .databags :
59
59
logger .log (logging .INFO , "community_team_members.json" )
60
- push_data (
61
- get_community_team_data (asana_client ),
62
- "community_team_members.json" ,
63
- )
60
+ repo_names = get_repo_names ()
61
+ community_data = get_community_team_data (asana_client , repo_names )
62
+ push_data (community_data , "community_team_members.json" )
64
63
65
64
66
65
if __name__ == "__main__" :
You can’t perform that action at this time.
0 commit comments