nutanix / calm-dsl

Keep Calm and DSL On!

Home Page:https://nutanix.github.io/calm-dsl/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug] Unable to decompile parallel tasks back to sequential in command calm decompile bp

pipoe2h opened this issue · comments

Describe the bug
In the UI is possible to move from parallel tasks back to sequential. This is not supported with DSL, either using decompile or by creating a new one from scratch

Branch/Container
master

To Reproduce
Steps to reproduce the behavior:

  1. Create a workflow like the screenshot in the UI
  2. Decompile with DSL

Expected behavior
DSL should be able to handle this workflow

Findings/Troubleshooting Done
If there is some findings when/why it happens

Available Logs/Data

[2024-02-14 10:37:28] [INFO] [calm.dsl.decompile.decompile_render:46] Formatting blueprint file using black
Traceback (most recent call last):
  File "/usr/local/bin/calm", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/calm/dsl/cli/utils.py", line 147, in invoke
    return super().invoke(ctx)
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/calm/dsl/cli/utils.py", line 147, in invoke
    return super().invoke(ctx)
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/calm/dsl/cli/bp_commands.py", line 160, in _decompile_bp
    decompile_bp(name, bp_file, with_secrets, prefix, bp_dir, passphrase)
  File "/usr/local/lib/python3.11/site-packages/calm/dsl/cli/bps.py", line 554, in decompile_bp
    decompile_bp_from_server(
  File "/usr/local/lib/python3.11/site-packages/calm/dsl/cli/bps.py", line 582, in decompile_bp_from_server
    _decompile_bp(
  File "/usr/local/lib/python3.11/site-packages/calm/dsl/cli/bps.py", line 668, in _decompile_bp
    create_bp_dir(
  File "/usr/local/lib/python3.11/site-packages/calm/dsl/decompile/decompile_render.py", line 47, in create_bp_dir
    bp_data = format_str(bp_data, mode=FileMode())
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/black/__init__.py", line 1163, in format_str
    dst_contents = _format_str_once(src_contents, mode=mode)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/black/__init__.py", line 1173, in _format_str_once
    src_node = lib2to3_parse(src_contents.lstrip(), mode.target_versions)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/black/parsing.py", line 128, in lib2to3_parse
    raise exc from None
black.parsing.InvalidInput: Cannot parse: 64:0:                     with branch(p2):

Screenshots
image

** System Configuration:**

  • OS: Linux
  • Python: 3.11.2

Additional context
Blueprint attached
dsl_decompile_parallel.json