Skip to content

Commit

Permalink
github_repo should set repository.name
Browse files Browse the repository at this point in the history
Signed-off-by: James Tanner <[email protected]>
  • Loading branch information
jctanner committed Oct 31, 2023
1 parent bca4db9 commit 0c6abf6
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion galaxy_ng/app/api/v1/viewsets/roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,22 @@ def update(self, request, pk=None):
changed['repository'] = {}
role.full_metadata['repository'] = {}
for subkey, subval in newval.items():
print(f'{key}.{subkey} {role.full_metadata[key].get(subkey)} --> {subval}')
if role.full_metadata.get(key, {}).get(subkey) != subval:
if key not in changed:
changed[key] = {}
role.full_metadata[key][subkey] = subval
changed[key][subkey] = subval
continue

# github_repo should set repository.name?
if key == 'github_repo':
if not role.full_metadata.get('repository'):
changed['repository'] = {}
role.full_metadata['repository'] = {}
old_name = role.full_metadata['repository'].get('name')
role.full_metadata['repository']['name'] = newval
role.full_metadata['repository']['original_name'] = old_name

if role.full_metadata.get(key) != newval:
role.full_metadata[key] = newval
changed[key] = newval
Expand Down

0 comments on commit 0c6abf6

Please sign in to comment.