Returning a json array back to mistral from a bash command

mistral

(Peter Michael Gits) #1

I have a mistral workflow where each task calls another subtask if successful. What I am trying to do is return the results back from the first bash script that is executed in a remote.cmd and be able to use that result or pass that result on to the next cmd.

When performing this operation and running in debug mode, I see the logs and the stdout but can I grab any of the values that were streamed out in the stdout log?, there is a mention in the documentation of a python example and how to obtain the python result.result…

it is plain old bash… I would like to keep state around and not have to push this state to the st2kv if possible because it seems like I should be able to do this easily.

I did see a json like element named Results… but how do I use that from my within my bash commands

follow on question, but related… I have not be able to make any of these individual commands fail. I have only been able to get each of the “tasks” to succeed, What should I be returning from bash exit -1 doesn’t seem to work. Also, strange is the fact that the entire workflow says it failed while each of the subtasks succeeds? What is up with that and how do I resolve.

Respectfully,

Peter M. Gits

below is my workflow

version: '2.0'

examples.mistral-merge-feature:
    description: A workflow that builds an image based on a change in a repo(s) and steps through each procedure individually and then calls a smoketest-hw.
    type: direct
    input:

    vars:
        st2_execution_id: <% env().st2_execution_id %>
        async_branch:  <% $.branch %>_to_integration
        leastBusyHost:  <% st2kv('system.leastBusyBuildServer') %>
        combinedCmd: <% $.swapParams %> <% $.cmd %> branch=<% $.branch %> branch_to=<% $.branch_to %> ctm_pipeline_id=<% $.ctm_pipeline_id %> hash=<% $.hash %> jira_keys=<% $.jira_keys %> jira_urls=<% $.jira_urls %> mail_to=<% $.mail_to %> package_version=<% $.package_version %> PreMergeFlag=<% $.PreMergeFlag %> project=<% $.project %> publish_results=<% $.publish_results %> repos=<% $.repos %> update_jira=<% $.update_jira %> url=<% $.url %>  st2_execution_id=<% env().st2_execution_id %> build_id=<% env().st2_execution_id %> build_name=<% $.build_name %> build_procedure=<% $.build_procedure %> key=<% $.key %> pypi_extra_index_url=<% $.pypi_extra_index_url %> pypi_index_url=<% $.pypi_index_url %> scm_branch=<% $.scm_branch %> scm_commit=<% $.scm_commit %> scm_project=<% $.scm_project %> scm_repos=<% $.scm_repos %>  scm_urls=<% $.scm_urls %> state=<% $.state %> trusted_host=<% $.trusted_host %>  stackstormServer=<% $.st2Server %> apikey=<% $.apiKey %> OS_RELEASE=<% $.OS_RELEASE %> build_url=https://<% $.st2Server %>/api/v1/executions/<% env().st2_execution_id %> EFLOW_SCRIPTS=<% $.EFLOW_SCRIPTS %> dry_run=<% $.dry_run %> build_project=<% $.build_project %>
        combinedCmdPublishNotification_1: <% $.swapParams %> <% $.cmdPublishNotification %> branch=<% $.branch %> branch_to=<% $.branch_to %> ctm_pipeline_id=<% $.ctm_pipeline_id %> hash=<% $.hash %> jira_keys=<% $.jira_keys %> jira_urls=<% $.jira_urls %> mail_to=<% $.mail_to %> package_version=<% $.package_version %> PreMergeFlag=<% $.PreMergeFlag %> project=<% $.project %> publish_results=<% $.publish_results %> repos=<% $.repos %> update_jira=<% $.update_jira %> url=<% $.url %>  st2_execution_id=<% env().st2_execution_id %> build_id=<% env().st2_execution_id %> build_name=<% $.build_name %> build_procedure=<% $.build_procedure %> key=<% $.key %> pypi_extra_index_url=<% $.pypi_extra_index_url %> pypi_index_url=<% $.pypi_index_url %> scm_branch=<% $.scm_branch %> scm_commit=<% $.scm_commit %> scm_project=<% $.scm_project %> scm_repos=<% $.scm_repos %>  scm_urls=<% $.scm_urls %> state=<% $.state %> trusted_host=<% $.trusted_host %>  stackstormServer=<% $.st2Server %> apikey=<% $.apiKey %> OS_RELEASE=<% $.OS_RELEASE %> build_url=https://<% $.st2Server %>/api/v1/executions/<% env().st2_execution_id %> EFLOW_SCRIPTS=<% $.EFLOW_SCRIPTS %> dry_run=<% $.dry_run %> build_project=<% $.build_project %>
        combinedCmdPublishNotification_2: <% $.swapParams %> <% $.cmdPublishNotification %> branch=<% $.branch %> branch_to=<% $.branch_to %> ctm_pipeline_id=<% $.ctm_pipeline_id %> hash=<% $.hash %> jira_keys=<% $.jira_keys %> jira_urls=<% $.jira_urls %> mail_to=<% $.mail_to %> package_version=<% $.package_version %> PreMergeFlag=<% $.PreMergeFlag %> project=<% $.project %> publish_results=<% $.publish_results %> repos=<% $.repos %> update_jira=<% $.update_jira %> url=<% $.url %>  st2_execution_id=<% env().st2_execution_id %> build_id=<% env().st2_execution_id %> build_name=<% $.build_name %> build_procedure=<% $.build_procedure %> key=<% $.success_flag %> pypi_extra_index_url=<% $.pypi_extra_index_url %> pypi_index_url=<% $.pypi_index_url %> scm_branch=<% $.scm_branch %> scm_commit=<% $.scm_commit %> scm_project=<% $.scm_project %> scm_repos=<% $.scm_repos %>  scm_urls=<% $.scm_urls %> state=<% $.state %> trusted_host=<% $.trusted_host %>  stackstormServer=<% $.st2Server %> apikey=<% $.apiKey %> OS_RELEASE=<% $.OS_RELEASE %> build_url=https://<% $.st2Server %>/api/v1/executions/<% env().st2_execution_id %> EFLOW_SCRIPTS=<% $.EFLOW_SCRIPTS %> dry_run=<% $.dry_run %> build_project=<% $.build_project %>
        combinedCmdCreateWorkingDir: <% $.swapParams %> <% $.cmdCreateWorkingDir %> branch=<% $.branch %> branch_to=<% $.branch_to %> ctm_pipeline_id=<% $.ctm_pipeline_id %> hash=<% $.hash %> jira_keys=<% $.jira_keys %> jira_urls=<% $.jira_urls %> mail_to=<% $.mail_to %> package_version=<% $.package_version %> PreMergeFlag=<% $.PreMergeFlag %> project=<% $.project %> publish_results=<% $.publish_results %> repos=<% $.repos %> update_jira=<% $.update_jira %> url=<% $.url %>  st2_execution_id=<% env().st2_execution_id %> build_id=<% env().st2_execution_id %> build_name=<% $.build_name %> build_procedure=<% $.build_procedure %> key=<% $.key %> pypi_extra_index_url=<% $.pypi_extra_index_url %> pypi_index_url=<% $.pypi_index_url %> scm_branch=<% $.scm_branch %> scm_commit=<% $.scm_commit %> scm_project=<% $.scm_project %> scm_repos=<% $.scm_repos %>  scm_urls=<% $.scm_urls %> state=<% $.state %> trusted_host=<% $.trusted_host %>  stackstormServer=<% $.st2Server %> apikey=<% $.apiKey %> OS_RELEASE=<% $.OS_RELEASE %> build_url=https://<% $.st2Server %>/api/v1/executions/<% env().st2_execution_id %> EFLOW_SCRIPTS=<% $.EFLOW_SCRIPTS %> dry_run=<% $.dry_run %> build_project=<% $.build_project %>
        combinedCmdArSync: <% $.swapParams %> <% $.cmdArSync %> branch=<% $.branch %> original_branch=<% $.branch %> branch_to=<% $.branch_to %> ctm_pipeline_id=<% $.ctm_pipeline_id %> hash=<% $.hash %> jira_keys=<% $.jira_keys %> jira_urls=<% $.jira_urls %> mail_to=<% $.mail_to %> package_version=<% $.package_version %> PreMergeFlag=<% $.PreMergeFlag %> project=<% $.project %> publish_results=<% $.publish_results %> repos=<% $.repos %> update_jira=<% $.update_jira %> url=<% $.url %>  st2_execution_id=<% env().st2_execution_id %> build_id=<% env().st2_execution_id %> build_name=<% $.build_name %> build_procedure=<% $.build_procedure %> key=<% $.key %> pypi_extra_index_url=<% $.pypi_extra_index_url %> pypi_index_url=<% $.pypi_index_url %> scm_branch=<% $.scm_branch %> scm_commit=<% $.scm_commit %> scm_project=<% $.scm_project %> scm_repos=<% $.scm_repos %>  scm_urls=<% $.scm_urls %> state=<% $.state %> trusted_host=<% $.trusted_host %>  stackstormServer=<% $.st2Server %> apikey=<% $.apiKey %> OS_RELEASE=<% $.OS_RELEASE %> build_url=https://<% $.st2Server %>/api/v1/executions/<% env().st2_execution_id %> EFLOW_SCRIPTS=<% $.EFLOW_SCRIPTS %> dry_run=<% $.dry_run %> build_project=<% $.build_project %>
        combinedCmdFetchRepos: <% $.swapParams %> <% $.cmdFetchRepos %> branch=<% $.branch %>_to_<% $.branch_to %> original_branch=<% $.branch %> branch_to=<% $.branch_to %> ctm_pipeline_id=<% $.ctm_pipeline_id %> hash=<% $.hash %> jira_keys=<% $.jira_keys %> jira_urls=<% $.jira_urls %> mail_to=<% $.mail_to %> package_version=<% $.package_version %> PreMergeFlag=<% $.PreMergeFlag %> project=<% $.project %> publish_results=<% $.publish_results %> repos=<% $.repos %> update_jira=<% $.update_jira %> url=<% $.url %>  st2_execution_id=<% env().st2_execution_id %> build_id=<% env().st2_execution_id %> build_name=<% $.build_name %> build_procedure=<% $.build_procedure %> key=<% $.key %> pypi_extra_index_url=<% $.pypi_extra_index_url %> pypi_index_url=<% $.pypi_index_url %> scm_branch=<% $.branch %>_to_integration scm_commit=<% $.scm_commit %> scm_project=<% $.scm_project %> scm_repos=<% $.scm_repos %>  scm_urls=<% $.scm_urls %> state=<% $.state %> trusted_host=<% $.trusted_host %>  stackstormServer=<% $.st2Server %> apikey=<% $.apiKey %> OS_RELEASE=<% $.OS_RELEASE %> build_url=https://<% $.st2Server %>/api/v1/executions/<% env().st2_execution_id %> EFLOW_SCRIPTS=<% $.EFLOW_SCRIPTS %> token=<% $.token %> server_url=<% $.server_url %> dry_run=<% $.dry_run %> build_project=<% $.build_project %>
        combinedCmdPublishNotificationPostArSync: <% $.swapParams %> <% $.cmdPublishNotificationPostArSync %> branch=<% $.branch %>_to_<% $.branch_to %> original_branch=<% $.branch %> branch_to=<% $.branch_to %> ctm_pipeline_id=<% $.ctm_pipeline_id %> hash=<% $.hash %> jira_keys=<% $.jira_keys %> jira_urls=<% $.jira_urls %> mail_to=<% $.mail_to %> package_version=<% $.package_version %> PreMergeFlag=<% $.PreMergeFlag %> project=<% $.project %> publish_results=<% $.publish_results %> repos=<% $.repos %> update_jira=<% $.update_jira %> url=<% $.url %>  st2_execution_id=<% env().st2_execution_id %> build_id=<% env().st2_execution_id %> build_name=<% $.build_name %> build_procedure=<% $.build_procedure %> key=<% $.key %> pypi_extra_index_url=<% $.pypi_extra_index_url %> pypi_index_url=<% $.pypi_index_url %> scm_branch=<% $.branch %>_to_integration original_branch=<% $.branch %> scm_commit=<% $.scm_commit %> scm_project=<% $.scm_project %> scm_repos=<% $.scm_repos %>  scm_urls=<% $.scm_urls %> state=<% $.success_flag %> trusted_host=<% $.trusted_host %>  stackstormServer=<% $.st2Server %> apikey=<% $.apiKey %> OS_RELEASE=<% $.OS_RELEASE %> build_url=https://<% $.st2Server %>/api/v1/executions/<% env().st2_execution_id %> EFLOW_SCRIPTS=<% $.EFLOW_SCRIPTS %>  dry_run=<% $.dry_run %> build_project=<% $.build_project %>

    input:
        - dry_run
        - failure_flag
        - success_flag
        - branch_to
        - async_branch
        - image_out
        - st2kv_image_name
        - image_name
        - myTransactionId
        - transactionId
        - enterprise_or_dell
        - branch
        - ctm_pipeline_id
        - username
        - private_key
        - hosts
        - swapParams
        - cmd
        - cmdPublishNotification
        - cmdSetBuildProperties
        - cmdCreateWorkingDir
        - cmdClone
        - cmdGetHashFromWorkspace
        - cmdCloneStretch
        - cmdArSync
        - cmdPublishNotificationPostArSync
        - cmdPwd
        - cmdBuildStretchUpdated
        - cmdPublishiAddMyPackageDetails
        - cmdInsertPkgToLastGoodImage
        - cmdIncrementProperty
        - cmdReviewPackageTransactionIds
        - cmdCallback
        - cmdProcessSmoketest
        - cmdPushFeature
        - cmdMergePullRequests
        - cmdPublishToArtifactory
        - cmdCleanup
        - cmdFetchRepos
        - timeout
        - cwd
        - token
        - server_url
        - hash
        - jira_keys
        - jira_urls
        - mail_to
        - package_version
        - PreMergeFlag
        - project
        - publish_results
        - update_jira
        - url
        - pypi_index_url
        - pypi_extra_index_url
        - trusted_host
        - state
        - key
        - build_project
        - build_procedure
        - build_id
        - build_name
        - scm_project
        - repos
        - scm_repos
        - scm_urls
        - scm_branch
        - scm_commit
        - apiKey
        - st2Server
        - OS_RELEASE
        - build_url
        - EFLOW_SCRIPTS

    output:
        env: <% env() %>
        url: <% $.url %>
        stdout: <% $.stdout %>
        stderr: <% $.stderr %>
        status: <% $.status %>
        last_call_was: <% $.cmd %>
        just_output_the_whole_worfklow_context: <% $ %>


    tasks:
        passed_in_command:
            action: core.remote cmd=<% $.combinedCmd %> timeout=<% $.timeout %> cwd=<% $.cwd %>  hosts=<% $.leastBusyHost %> username=<% $.username %> private_key=<% $.private_key %>
            
#            publish:
#                stdout:  "{{ task('passed_in_command').result.stdout }}"
#                status: <% task(passed_in_command).result.result.stderr %>
            on-success:
                - sub_publish_notification_1
            on-error:
                - sub_cleanup

        sub_publish_notification_1:
            action: core.remote cmd=<% $.combinedCmdPublishNotification_1 %> timeout=<% $.timeout %> cwd=<% $.cwd %>  hosts=<% $.leastBusyHost %> username=<% $.username %> private_key=<% $.private_key %>
            
#            publish:
#                stdout:  "{{ task('sub_publish_notification_1').result.stdout }}"
#                stderr:  "{{ task('sub_publish_notification_1').result.stdout }}"
            on-success:
                - sub_create_working_dir
            on-error:
                - sub_cleanup

        sub_create_working_dir:
            action: core.remote cmd=<% $.combinedCmdCreateWorkingDir %> timeout=<% $.timeout %> cwd=<% $.cwd %>  hosts=<% $.leastBusyHost %> username=<% $.username %> private_key=<% $.private_key %>
            
#            publish:
#                stdout:  "{{ task('sub_create_working_dir').result.stdout }}"
#                stderr: <% task(sub_create_working_dir).result.stderr %>
            on-success:
                - sub_ar_sync
            on-error:
                - sub_cleanup

        sub_ar_sync:
            action: core.remote cmd=<% $.combinedCmdArSync %> timeout=<% $.timeout %> cwd=<% $.cwd %>  hosts=<% $.leastBusyHost %> username=<% $.username %> private_key=<% $.private_key %>
            
#            publish:
#                stdout:  "{{ task('sub_ar_sync').result.stdout }}"
#                stderr: <% task(sub_ar_sync).result.stderr %>
            on-success:
                - sub_fetch_repos
            on-error:
                - sub_cleanup

        sub_fetch_repos:
            action: core.remote cmd=<% $.combinedCmdFetchRepos %> timeout=<% $.timeout %> cwd=<% $.cwd %>  hosts=<% $.leastBusyHost %> username=<% $.username %> private_key=<% $.private_key %>
            
#            publish:
#                stdout:  "{{ task('sub_ar_sync').result.stdout }}"
#                stderr: <% task(sub_ar_sync).result.stderr %>
            on-success:
                - sub_publish_notification_post_ar_sync
            on-error:
                - sub_cleanup

        sub_publish_notification_post_ar_sync:
            action: core.remote cmd=<% $.combinedCmdPublishNotificationPostArSync %> timeout=<% $.timeout %> cwd=<% $.cwd %>  hosts=<% $.leastBusyHost %> username=<% $.username %> private_key=<% $.private_key %>
            
#            publish:
#                stdout:  "{{ task('sub_publish_notification_post_ar_sync').result.stdout }}"
#                stderr:  "{{ task('sub_publish_notification_post_ar_sync').result.stdout }}"
            on-success:
                - sub_set_build_properties
            on-error:
                - sub_cleanup

        sub_set_build_properties:
            action: core.remote cmd=<% $.combinedCmdSetBuildProperties %> timeout=<% $.timeout %> cwd=<% $.cwd %>  hosts=<% $.leastBusyHost %> username=<% $.username %> private_key=<% $.private_key %>
            
#            publish:
#                stdout:  "{{ task('sub_set_build_properties').result.stdout }}"
#                stderr: <% task(sub_set_build_properties).result.stderr %>
            on-success:
                - sub_clone
            on-error:
                - sub_cleanup

        sub_clone:
            action: core.remote cmd=<% $.combinedCmdClone %> timeout=<% $.timeout %> cwd=<% $.cwd %>  hosts=<% $.leastBusyHost %> username=<% $.username %> private_key=<% $.private_key %>
            
#            publish:
#                stdout:  "{{ task('sub_clone').result.stdout }}"
#                stderr: <% task(sub_clone).result.stderr %>
            on-success:
                - sub_get_hash_from_workspace
            on-error:
                - sub_cleanup

        sub_get_hash_from_workspace:
            action: core.remote cmd=<% $.combinedCmdGetHashFromWorkspace %> timeout=<% $.timeout %> cwd=<% $.cwd %>  hosts=<% $.leastBusyHost %> username=<% $.username %> private_key=<% $.private_key %>
            
#            publish:
#                stdout:  "{{ task('sub_get_hash_from_workspace').result.stdout }}"
#                stderr: <% task(sub_get_hash_from_workspace).result.stderr %>
            on-success:
                - sub_clone_stretch
            on-error:
                - sub_cleanup

        sub_clone_stretch:
            action: core.remote cmd=<% $.combinedCmdCloneStretch %> timeout=<% $.timeout %> cwd=<% $.cwd %>  hosts=<% $.leastBusyHost %> username=<% $.username %> private_key=<% $.private_key %>
            
#            publish:
#                stdout:  "{{ task('sub_clone_stretch').result.stdout }}"
#                stderr: <% task(sub_clone_stretch).result.stderr %>
            on-success:
                - sub_pwd
            on-error:
                - sub_cleanup

        sub_pwd:
            action: core.remote cmd=<% $.combinedCmdPwd %> timeout=<% $.timeout %> cwd=<% $.cwd %>  hosts=<% $.leastBusyHost %> username=<% $.username %> private_key=<% $.private_key %>
            
#            publish:
#                stdout:  "{{ task('sub_pwd').result.stdout }}"
#                stderr: <% task(sub_pwd).result.stderr %>
            on-success:
                - sub_build_stretch_updated
            on-error:
                - sub_cleanup

        sub_build_stretch_updated:
            action: core.remote cmd=<% $.combinedCmdBuildStretchUpdated %> timeout=<% $.timeout %> cwd=<% $.cwd %>  hosts=<% $.leastBusyHost %> username=<% $.username %> private_key=<% $.private_key %>
            
#            publish:
#                stdout:  "{{ task('sub_buile_stretch_updated').result.stdout }}"
#                stderr: <% task(sub_buile_stretch_updated).result.stderr %>
            on-success:
                - sub_publish_iAddMyPackageDetails
            on-error:
                - sub_cleanup


        sub_publish_iAddMyPackageDetails:
            action: core.remote cmd=<% $.combinedCmdPublishiAddMyPackageDetails %> timeout=<% $.timeout %> cwd=<% $.cwd %>  hosts=<% $.leastBusyHost %> username=<% $.username %> private_key=<% $.private_key %>
            
#            publish:
#                stdout:  "{{ task('sub_publish_iAddMyPackageDetails').result.stdout }}"
#                stderr: <% task(sub_publish_iAddMyPackageDetails).result.stderr %>
            on-success:
                - sub_insert_pkg_to_last_good_image
            on-error:
                - sub_cleanup

        sub_insert_pkg_to_last_good_image:
            action: core.remote cmd=<% $.combinedCmdInsertPkgToLastGoodImage %> timeout=<% $.timeout %> cwd=<% $.cwd %>  hosts=<% $.leastBusyHost %> username=<% $.username %> private_key=<% $.private_key %>
            
#            publish:
#                image_out:  "{{ task('sub_insert_pkg_to_last_good_image').result.image_name }}"
#                st2kv_image_name: "{{ st2kv.system.tftpboot_path }}"
#                myTransactionId: "{{ st2kv.system.transactionIdStretch }}"
#                stderr: <% task(sub_insert_pkg_to_last_good_image).result.stderr %>
            on-success:
                - sub_publish_notification_2
            on-error:
                - sub_cleanup

        sub_publish_notification_2:
            action: core.remote cmd=<% $.combinedCmdPublishNotification_2 %> timeout=<% $.timeout %> cwd=<% $.cwd %>  hosts=<% $.leastBusyHost %> username=<% $.username %> private_key=<% $.private_key %>
            
#            publish:
#                stdout:  "{{ task('sub_publish_notification_2').result.stdout }}"
#                stderr: <% task(sub_publish_notification_2).result.stderr %>
            on-success:
                - sub_increment_property
            on-error:
                - sub_cleanup

        sub_increment_property:
            action: core.remote cmd=<% $.combinedCmdIncrementProperty %> timeout=<% $.timeout %> cwd=<% $.cwd %>  hosts=<% $.leastBusyHost %> username=<% $.username %> private_key=<% $.private_key %>
            
#            publish:
#                stdout:  "{{ task('sub_increment_property').result.stdout }}"
#                stderr: <% task(sub_increment_property).result.stderr %>
            on-success:
                - sub_review_package_transaction_ids
            on-error:
                - sub_cleanup

        sub_review_package_transaction_ids:
            action: core.remote cmd=<% $.combinedCmdReviewPackageTransactionIds %> timeout=<% $.timeout %> cwd=<% $.cwd %>  hosts=<% $.leastBusyHost %> username=<% $.username %> private_key=<% $.private_key %>
            
#            publish:
#                stdout:  "{{ task('sub_review_package_transaction_ids').result.stdout }}"
#                stderr: <% task(sub_review_package_transaction_ids).result.stderr %>
            on-success:
                - sub_callback
            on-error:
                - sub_cleanup

        sub_callback:
            action: core.remote cmd=<% $.combinedCmdCallback %> timeout=<% $.timeout %> cwd=<% $.cwd %>  hosts=<% $.leastBusyHost %> username=<% $.username %> private_key=<% $.private_key %>
            
#            publish:
#                stdout:  "{{ task('sub_callback').result.stdout }}"
#                stderr: <% task(sub_callback).result.stderr %>
            on-success:
                - sub_process_smoketest
            on-error:
                - sub_cleanup

        sub_process_smoketest:
            action: core.remote cmd=<% $.combinedCmdProcessSmoketest %> timeout=<% $.timeout %> cwd=<% $.cwd %>  hosts=<% $.leastBusyHost %> username=<% $.username %> private_key=<% $.private_key %>
#            parameters: {
#                "image_out":  "{{ st2kv.system.tftp_boot }},
#                "st2kv_image_name": "{{ st2kv.system.tftpboot_path }}"
#                "myTransactionId": "{{ st2kv.system.transactionIdStretch }}"
#            } 
            on-success:
                - sub_push_feature
            on-error:
                - sub_cleanup

        sub_push_feature:
            action: core.remote cmd=<% $.combinedCmdPushFeature %> timeout=<% $.timeout %> cwd=<% $.cwd %>  hosts=<% $.leastBusyHost %> username=<% $.username %> private_key=<% $.private_key %>
#            parameters: {
#                "image_out":  "{{ st2kv.system.tftp_boot }},
#                "st2kv_image_name": "{{ st2kv.system.tftpboot_path }}"
#                "myTransactionId": "{{ st2kv.system.transactionIdStretch }}"
#            } 
            on-success:
                - sub_merge_pull_requests
            on-error:
                - sub_cleanup

        sub_merge_pull_requests:
            action: core.remote cmd=<% $.combinedCmdMergePullRequests %> timeout=<% $.timeout %> cwd=<% $.cwd %>  hosts=<% $.leastBusyHost %> username=<% $.username %> private_key=<% $.private_key %>
#            parameters: {
#                "image_out":  "{{ st2kv.system.tftp_boot }},
#                "st2kv_image_name": "{{ st2kv.system.tftpboot_path }}"
#                "myTransactionId": "{{ st2kv.system.transactionIdStretch }}"
#            } 
            on-success:
                - sub_publish_to_artifactory
            on-error:
                - sub_cleanup

        sub_publish_to_artifactory:
            action: core.remote cmd=<% $.combinedCmdPublishToArtifactory %> timeout=<% $.timeout %> cwd=<% $.cwd %>  hosts=<% $.leastBusyHost %> username=<% $.username %> private_key=<% $.private_key %>
#            parameters: {
#                "image_out":  "{{ st2kv.system.tftp_boot }},
#                "st2kv_image_name": "{{ st2kv.system.tftpboot_path }}"
#                "myTransactionId": "{{ st2kv.system.transactionIdStretch }}"
#            } 
            on-success:
                - sub_cleanup
            on-error:
                - sub_cleanup

        sub_cleanup:
            action: core.remote cmd=<% $.combinedCmdCleanup %> timeout=<% $.timeout %> cwd=<% $.cwd %>  hosts=<% $.leastBusyHost %> username=<% $.username %> private_key=<% $.private_key %>
#            parameters: {
#                "image_out":  "{{ st2kv.system.tftp_boot }},
#                "st2kv_image_name": "{{ st2kv.system.tftpboot_path }}"
#                "myTransactionId": "{{ st2kv.system.transactionIdStretch }}"
#            } 
            on-success:
                - send_success_email
            on-error:
                - send_error_email


        send_error_email:
                action: send_email to_addrs=['peter.gits@dell.com'] body='Failed <% $.combinedCmd %> '

        send_success_email:
            action: send_email to_addrs=['peter.gits@dell.com'] body='smoke test successfully ran and its id <% $.combinedCmd %>'

(Lindsay Hill) #2

Usually that means that you have some sort of YAQL rendering failure, or syntax issue at a higher level. From a very quick skim, you have two input: sections for your workflow.

Start by fixing that, then start checking your output: section - do all of those variables exist at the end of the workflow?

If you look at the details for the overall workflow, via either CLI or Web UI, you should see the error message.


(Lindsay Hill) #3

Look at this example line here for getting the result.stdout from a core.remote action


(Peter Michael Gits) #4

Thanks Lindsay. I have checked the mistral logs to see if I had done something wrong, but will start with removing the double input section…


(Peter Michael Gits) #5

Thanks Lindsay, I would not have come up with
publish:
15. distro: <% task(get_distro).result.get($.host).stdout %>


(Lindsay Hill) #6

Yeah, it’s a bit tricky when you’re running core.remote, because the hosts parameter takes multiple hosts. So it returns an array of results, one per host. Makes sense if you are running an action on 3 hosts, but not always so obvious if you’re just running an action against one host.


(Lindsay Hill) #7

My guess is that it’s almost certainly something related to your outputs: section. It’s probably running all the tasks, but something’s wrong with one of the outputs. You could try simplifying your outputs section, adding back in one variable at a time until you see which one is causing problems. My guess is that something’s not initialized.