Skip to content

Commit

Permalink
Only set k to lower case if it's a string
Browse files Browse the repository at this point in the history
  • Loading branch information
BitK committed Oct 28, 2021
1 parent df6b4b2 commit 8f4522b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions dockers/manager/back/app/api/traefik.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from app.utils import base64_decode, validate_node_id
from app.utils.cached import cacheMethodForQuery, no_cache
from app.exception import PMException

entrypoint_re = re.compile(
r"(?P<ip>\d+\.\d+\.\d+\.\d+)?:(?P<port>\d+)(?:/(?P<protocol>[a-z]+))?"
)
Expand All @@ -19,16 +19,17 @@

def settings_to_kv(settings, prefix=""):
for k, v in settings.items():
k = k.lower() if isinstance(k, str) else k
if v == None:
continue
if isinstance(v, dict):
yield from settings_to_kv(v, f"{prefix}/{k}")
elif isinstance(v, list):
yield from settings_to_kv(dict(enumerate(v)), f"{prefix}/{k}")
elif isinstance(v, bool):
yield f"{prefix}/{k.lower()}", str(v).lower()
yield f"{prefix}/{k}", str(v).lower()
else:
yield f"{prefix}/{k.lower()}", v
yield f"{prefix}/{k}", v


async def create_from_object(client, obj, prefix=""):
Expand Down

0 comments on commit 8f4522b

Please sign in to comment.