aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSawyer Bergeron <sbergeron@iol.unh.edu>2023-10-03 18:24:17 +0000
committerGerrit Code Review <gerrit@opnfv.org>2023-10-03 18:24:17 +0000
commit1e87ea9e9c047960e490f684b0a05fa526037182 (patch)
tree8f5ce84884f7bf8643dcd25a7828e57fe4ab562f /src
parentca3d57fbcbee0ae979d3c3c02ef9866e820579a5 (diff)
parent2c32af27e330be22b16eceb14784dfdb4f331ba9 (diff)
Merge "bare minimum fix" into liblaas-mvp
Diffstat (limited to 'src')
-rw-r--r--src/api/utils.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/api/utils.py b/src/api/utils.py
index d6aa68a..9a9c260 100644
--- a/src/api/utils.py
+++ b/src/api/utils.py
@@ -64,11 +64,17 @@ def get_ipa_migration_form(user, profile):
"button": "Submit"
}
+# Removes leading and trailing white space from a list of ssh keys and returns the cleaned list
+def clean_ssh_keys(ssh_key_list):
+ cleaned = []
+ for key in ssh_key_list:
+ cleaned.append(key.strip())
+ return cleaned
+
# Take a list of strings, sends it to liblaas, replacing the IPA keys with the new keys
def ipa_set_ssh(user_profile, ssh_key_list):
url = liblaas_base_url + "user/" + user_profile.ipa_username + "/ssh"
- print(ssh_key_list)
- print("Setting SSH keys with URL", url)
+ ssh_key_list = clean_ssh_keys(ssh_key_list)
try:
requests.post(url, data=json.dumps(ssh_key_list), headers={'Content-Type': 'application/json'})
return HttpResponse(status=200)