From a1cd16e25afe57cfa6a28e96baa40e087fdf866a Mon Sep 17 00:00:00 2001 From: sarchen Date: Thu, 9 Jan 2020 11:59:55 +0000 Subject: [PATCH] Add validation to remove empty strings from the path split --- betterboto/organizations.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/betterboto/organizations.py b/betterboto/organizations.py index 840fb95..fb986b3 100644 --- a/betterboto/organizations.py +++ b/betterboto/organizations.py @@ -175,7 +175,8 @@ def convert_path_to_ou(self, path): root = response.get('Roots')[0] return root.get('Id') else: - parts = path.split("/") + # You get the name of the ou back, including /'s + parts = list(filter(None, path.split("/"))) parts.reverse() parts.pop() part_looking_for = parts.pop()