Return template a specific stack (heat stack-template)

    name
        Name of the stack

    profile
        Profile to use

    CLI Example:

    .. code-block:: bash

        salt '*' heat.template_stack name=mystack profile=openstack1

def template_stack(name=None, profile=None):
    '''
    Return template a specific stack (heat stack-template)

    name
        Name of the stack

    profile
        Profile to use

    CLI Example:

    .. code-block:: bash

        salt '*' heat.template_stack name=mystack profile=openstack1
    '''
    h_client = _auth(profile)

    if not name:
        return {
            'result': False,
            'comment':
                'Parameter name missing or None'
            }
    try:
        get_template = h_client.stacks.template(name)
    except heatclient.exc.HTTPNotFound:
        return {
            'result': False,
            'comment': 'No stack with {0}'.format(name)
            }
    except heatclient.exc.BadRequest:
        return {
            'result': False,
            'comment': 'Bad request fot stack {0}'.format(name)
            }
    if 'heat_template_version' in get_template:
        template = salt.utils.yaml.safe_dump(get_template)
    else:
        template = jsonutils.dumps(get_template, indent=2, ensure_ascii=False)

    checksum = __salt__['hashutil.digest'](template)
    ret = {
        'template': template,
        'result': True,
        'checksum': checksum
    }
    return ret