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] Single VM BP does not keep dependencies in task sequence | calm create bp | calm decompile bp

glover-chris opened this issue · comments

Describe the bug
When creating a single VM bp, if you have parallel tasks that then call different sub tasks within each parallel step, all sub tasks are run from each parallel task.

Branch/Container
master

To Reproduce
Steps to reproduce the behavior:

  1. We have a single vm bp with these tasks in the GUI.
    image

  2. DSL decompile of that bp action looks like this .

@action
    def __uninstall__():
        with parallel():
            CalmTask.Exec.powershell(
                name="domain_unjoin",
                filename=os.path.join(
                    "scripts",
                    "Package_Package1_Action___uninstall___Task_domain_unjoin.ps1",
                ),
                cred=ref(BP_CRED_cred_ad),
                target=ref(Service1),
            )
            CalmTask.SetVariable.powershell(
                name="citrix_token",
                filename=os.path.join(
                    "scripts",
                    "Package_Package1_Action___uninstall___Task_citrix_token.ps1",
                ),
                cred=ref(BP_CRED_cred_citrix),
                target=ref(Service1),
                variables=["token"],
            )
        with parallel():
            CalmTask.Exec.powershell(
                name="remove_ad_object",
                filename=os.path.join(
                    "scripts",
                    "Package_Package1_Action___uninstall___Task_remove_ad_object.ps1",
                ),
                cred=ref(BP_CRED_cred_ad),
                target=ref(Service1),
            )
            CalmTask.Exec.powershell(
                name="citrix_cleanup",
                filename=os.path.join(
                    "scripts",
                    "Package_Package1_Action___uninstall___Task_citrix_cleanup.ps1",
                ),
                cred=ref(BP_CRED_cred_citrix),
                target=ref(Service1),
            )
  1. creating the bp with DSL, the tasks looks like this in the GUI. You can see the first parallel tasks run but then also call each sub task when they should only call one sub task under the parent.
    image
    with this code in the bp.
@action
    def __uninstall__():
        with parallel():
            CalmTask.Exec.powershell(
                name="domain_unjoin",
                filename=common_task_library + "windows/uninstall/domain_unjoin.ps1",
                cred=ref(BP_CRED_cred_ad),
                target=ref(Service1),
            )
            CalmTask.SetVariable.powershell(
                name="citrix_token",
                filename=common_task_library + "shared/precreate/citrix_token.ps1",
                cred=ref(BP_CRED_cred_citrix),
                target=ref(Service1),
                variables=["token"],
                target_endpoint=Endpoint.use_existing(poshendpoint),
            )
        with parallel():
            CalmTask.Exec.powershell(
                name="remove_ad_object",
                filename=common_task_library + "windows/uninstall/remove_ad_object.ps1",
                cred=ref(BP_CRED_cred_ad),
                target=ref(Service1),
                target_endpoint=Endpoint.use_existing(poshendpoint),
            )
            CalmTask.Exec.powershell(
                name="citrix_cleanup",
                filename=common_task_library + "windows/uninstall/citrix_cleanup.ps1",
                cred=ref(BP_CRED_cred_citrix),
                target=ref(Service1),
                target_endpoint=Endpoint.use_existing(poshendpoint),
            )

Expected behavior
Expecting the task dependencies and sequence to be the same as when created in the GUI versus with DSL.

** System Configuration:**

Fixed in release 3.7.0