Skip to content

Commit

Permalink
Merge pull request #3 from SlothCroissant/staging
Browse files Browse the repository at this point in the history
Fixing removal of [custom] TOML table #patch
  • Loading branch information
SlothCroissant authored Sep 26, 2024
2 parents 07d3a98 + 1930f4e commit 0869e5c
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions app/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@ def lookup_answer_for_mac(mac: str) -> tomlkit.TOMLDocument | None:

def process_custom_gh_username(toml_data: tomlkit.TOMLDocument):
if 'custom' in toml_data:
toml_data['custom'] = tomlkit.table()

if 'gh_username' in toml_data['custom']:

# Extract the custom.gh_username string value
Expand All @@ -96,16 +94,16 @@ def process_custom_gh_username(toml_data: tomlkit.TOMLDocument):
f"Failed to fetch keys for {gh_username}. Response from GitHub: HTTP/{response.status_code}: {response.reason}"
)
keys = response.text.splitlines()

# Append keys to global.root_ssh_keys
if 'global' not in toml_data:
toml_data['global'] = tomlkit.table()
if 'root_ssh_keys' not in toml_data['global']:
toml_data['global']['root_ssh_keys'] = tomlkit.array()
toml_data['global']['root_ssh_keys'].extend(keys)

# Remove custom/custom.gh_username
del toml_data['custom']['gh_username']
if not toml_data['custom']:
del toml_data['custom']
toml_data.pop('custom')
return toml_data


Expand Down

0 comments on commit 0869e5c

Please # to comment.