Skip to content

Commit

Permalink
microservice: Fix get annotations format
Browse files Browse the repository at this point in the history
- Only split at the first occurence of '=', this allow values containing
  '=' character.
- Strip splitted parts, so we can have following forms:
  `key = value`, or `key= value `
- Also fix wrong index access annotation value, [1:-1] slices the content
  from 1 to second last, which leads to incompleted values.
  • Loading branch information
Che Vu Gia Hy committed Oct 10, 2019
1 parent f645ce1 commit 6082d33
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions python/seldon_core/microservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,10 @@ def load_annotations() -> Dict:
with open(ANNOTATIONS_FILE, "r") as ins:
for line in ins:
line = line.rstrip()
parts = line.split("=")
parts = list(map(str.strip, line.split("=", 1)))
if len(parts) == 2:
value = parts[1][1:-1]
logger.info("Found annotation %s:%s ", parts[0], value)
annotations[parts[0]] = value
logger.info("Found annotation %s:%s ", parts[0], parts[1])
annotations[parts[0]] = parts[1]
else:
logger.info("bad annotation [%s]", line)
except:
Expand Down

0 comments on commit 6082d33

Please sign in to comment.