Skip to content
This repository was archived by the owner on Feb 21, 2022. It is now read-only.

Commit a1de85e

Browse files
committed
feat(entities): register entity models in admin and add logs
1 parent d4a2ed0 commit a1de85e

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

zoo/entities/admin.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from django.contrib import admin
2+
3+
from . import models
4+
5+
6+
@admin.register(models.Entity)
7+
class EntityAdmin(admin.ModelAdmin):
8+
search_fields = ("name", "owner", "kind", "type")
9+
10+
11+
@admin.register(models.Link)
12+
class LinkAdmin(admin.ModelAdmin):
13+
search_fields = ("name",)
14+
15+
16+
@admin.register(models.Group)
17+
class GroupAdmin(admin.ModelAdmin):
18+
search_fields = ("product_owner", "project_owner")

zoo/repos/tasks.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,9 @@ def sync_entity_file():
163163
for project in itertools.chain(
164164
get_github_repositories(), get_gitlab_repositories()
165165
):
166+
log.info("repos.sync_entity_yml.processing", project=project["name"])
166167
if settings.SYNC_REPOS_SKIP_FORKS and project["is_fork"]:
168+
log.info("repos.sync_entity_yml.skipping", project=project["name"])
167169
continue
168170
update_project_from_entity_file.apply_async(args=[project])
169171

@@ -182,6 +184,10 @@ def update_project_from_entity_file(proj: Dict) -> None:
182184

183185
def update_or_create_components(data: List, proj: Dict) -> None:
184186
# Skip processing the entity file if the repository is not yet synced
187+
log.info(
188+
"repos.sync_entity_yml.update_or_create_components.creating_components",
189+
project=proj["name"],
190+
)
185191
try:
186192
repository = Repository.objects.get(
187193
remote_id=int(proj["id"]), provider=proj["provider"]
@@ -204,7 +210,7 @@ def _do_cleanup():
204210

205211
def get_entity_file_content(proj: Dict) -> str:
206212
provider = get_scm_module(proj["provider"])
207-
return provider.get_file_content(proj["id"], "entities.yaml")
213+
return provider.get_file_content(proj["remote_id"], "entities.yaml")
208214

209215

210216
def sync_enviroments_from_gitlab(repo: Repository):

0 commit comments

Comments
 (0)