Skip to content

Conversation

@doino-gretchenliev
Copy link

The underlaying ruamel.yaml library is wrongfully detecting ipam map as CommentedSeq and so the regex match, inside fix_sexadecimal_numbers, is failing when trying to process ordereddict([('subnet', '172.16.0.0/16')]) instead of string object. So parsing every value to str is a workaround and doesn't break any functionality. Here is the error without the fix:

Traceback (most recent call last):
  File "./bin/compose_format", line 35, in <module>
    if not formatter.format(path, replace=args.replace, strict=not args.non_strict):
  File "/usr/local/lib/python3.7/site-packages/compose_format/__init__.py", line 68, in format
    formatted = self.format_string(data, replace=replace, strict=strict)
  File "/usr/local/lib/python3.7/site-packages/compose_format/__init__.py", line 78, in format_string
    data = self.reorder(load(data, RoundTripLoader), strict=strict)
  File "/usr/local/lib/python3.7/site-packages/compose_format/__init__.py", line 99, in reorder
    ComposeFormat.reorder(item, strict)
  File "/usr/local/lib/python3.7/site-packages/compose_format/__init__.py", line 99, in reorder
    ComposeFormat.reorder(item, strict)
  File "/usr/local/lib/python3.7/site-packages/compose_format/__init__.py", line 99, in reorder
    ComposeFormat.reorder(item, strict)
  [Previous line repeated 1 more time]
  File "/usr/local/lib/python3.7/site-packages/compose_format/__init__.py", line 103, in reorder
    data[i] = ComposeFormat.fix_sexadecimal_numbers(value)
  File "/usr/local/lib/python3.7/site-packages/compose_format/__init__.py", line 114, in fix_sexadecimal_numbers
    match = re.match(SEXADECIMAL_NUMBER, value)
  File "/usr/local/lib/python3.7/re.py", line 173, in match
    return _compile(pattern, flags).match(string)
TypeError: expected string or bytes-like object

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant