get_file doesn't work in the global environment

Bug #1454401 reported by Steven Hardy
18
This bug affects 4 people
Affects Status Importance Assigned to Milestone
OpenStack Heat
In Progress
Medium
Rico Lin

Bug Description

Because we resolve get_file references in python-heatclient, there's no way to use get_file (or other non-resource_registry template composition, e.g type: foo.yaml) in the global environment, e.g /etc/heat/environment.d/

It seems like for operators wanting to expose some non-trivial compositions of templates via global environment resource types this would be most desirable, so perhaps we need to consider including local file resolution when resolving the global environment.

Revision history for this message
Steve Baker (steve-stevebaker) wrote :

This seems reasonable. We should possibly add some extra checks to ensure no files are included from outside /etc/heat/environment.d/

Changed in heat:
status: New → Triaged
importance: Undecided → Medium
Rico Lin (rico-lin)
Changed in heat:
assignee: nobody → Rico Lin (rico-lin)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to heat (master)

Fix proposed to branch: master
Review: https://review.openstack.org/209439

Changed in heat:
status: Triaged → In Progress
Revision history for this message
Randall Burt (randall-burt) wrote :

IMO, the provider should be exposing these compositions via namespace mapping in the resource_registry of one or more global environment files which already do local file resolution.

Revision history for this message
Michal Gershenzon (michal-gershenzon) wrote :

If the difficulty is only when using python-heatclient, not API, why is this a bug?

Revision history for this message
Steven Hardy (shardy) wrote :

>If the difficulty is only when using python-heatclient, not API, why is this a bug?

It's not got anything to do with python-heatclient, it affects any users/deployers who wish to make use of the global environment (which is defined as part of the heat service config, not the user-defined environment)

Revision history for this message
Steve Baker (steve-stevebaker) wrote :

Just to reiterate, I agree that the global env should resolve get_file references, I just think it should be done with the existing heatclient utility functions

Changed in heat:
status: In Progress → Triaged
Changed in heat:
status: Triaged → In Progress
Changed in heat:
milestone: none → next
Revision history for this message
Martin Paulo (martin-paulo) wrote :

I think I've just been bitten by this :(

I have a stack with the following resource type:
    type: OS::Heat::Stack
    properties:
      template: { get_file: "https://url_to_template" }
      timeout: 60
      parameters:
        key_name: { get_param: key_name }
        image_id: { get_param: image_id }
        instance_type: { get_param: instance_type }

It works perfectly from the command line. But not from the dashboard. There I get the error "No content found in the "files" section for get_file path"... From a users point of view this is not nice: using url's should allow you to launch the template from the dashboard. You should not have to download them to your local machine and use the command line client. I'm not alone in this, btw: https://ask.openstack.org/en/question/65776/need-clarification-of-heat-template-get_file-with-http-resource/

Revision history for this message
Steve Baker (steve-stevebaker) wrote : Re: [Bug 1454401] Re: get_file doesn't work in the global environment

On 30/11/15 12:58, Martin Paulo wrote:
> I think I've just been bitten by this :(
>
> I have a stack with the following resource type:
> type: OS::Heat::Stack
> properties:
> template: { get_file: "https://url_to_template" }
> timeout: 60
> parameters:
> key_name: { get_param: key_name }
> image_id: { get_param: image_id }
> instance_type: { get_param: instance_type }
>
> It works perfectly from the command line. But not from the dashboard.
> There I get the error "No content found in the "files" section for
> get_file path"... From a users point of view this is not nice: using
> url's should allow you to launch the template from the dashboard. You
> should not have to download them to your local machine and use the
> command line client. I'm not alone in this, btw:
> https://ask.openstack.org/en/question/65776/need-clarification-of-heat-
> template-get_file-with-http-resource/
>
This is more likely a horizon issue where horizon is not calling
get_template_contents and process_multiple_environment_and_files:
https://github.com/openstack/python-heatclient/blob/master/heatclient/v1/shell.py#L103-L109

A bug should be created against horizon if it has not been already.

Revision history for this message
Rico Lin (rico-lin) wrote :

Martin: Just like what Steve said, they're different issues. Can you help to create a bug on horizon in order to cover your request?
Also you can use URL instead of local file as a workaround for your issue.

Revision history for this message
Martin Paulo (martin-paulo) wrote :

I suspect that this defect https://bugs.launchpad.net/horizon/+bug/1467781 already covers my issue...

Rico Lin (rico-lin)
Changed in heat:
milestone: next → mitaka-3
Changed in heat:
milestone: mitaka-3 → mitaka-rc1
Changed in heat:
milestone: mitaka-rc1 → newton-1
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to heat (master)

Fix proposed to branch: master
Review: https://review.openstack.org/298053

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to heat (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/298054

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to heat (master)

Fix proposed to branch: master
Review: https://review.openstack.org/300891

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on heat (master)

Change abandoned by Rico Lin (<email address hidden>) on branch: master
Review: https://review.openstack.org/298053
Reason: Move all fix to https://review.openstack.org/#/c/209439/23

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to heat (master)

Reviewed: https://review.openstack.org/300891
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=83966b7bdebb91df3752671b7326955d2b733d75
Submitter: Jenkins
Branch: master

commit 83966b7bdebb91df3752671b7326955d2b733d75
Author: ricolin <email address hidden>
Date: Mon Apr 11 16:14:59 2016 +0800

    Add `template_dir` to config

    Allow global environment contain global template files.
    This can lead to further access to global template files.
    For example a template file `my_tmpl.yaml` under global template
    directory (`/etc/heat/templates` by default) can be directly accessed in
    stack with `get_file`.
    Partial-Bug: #1454401

    Change-Id: I0a1c9d50441f88144980214fbc8e6757193cfb41

Rabi Mishra (rabi)
Changed in heat:
milestone: newton-1 → newton-2
Thomas Herve (therve)
Changed in heat:
milestone: newton-2 → newton-3
Thomas Herve (therve)
Changed in heat:
milestone: newton-3 → next
Zane Bitter (zaneb)
Changed in heat:
milestone: next → ocata-3
Rabi Mishra (rabi)
Changed in heat:
milestone: ocata-3 → ocata-rc1
Rabi Mishra (rabi)
Changed in heat:
milestone: ocata-rc1 → pike-1
Rico Lin (rico-lin)
Changed in heat:
milestone: pike-1 → pike-2
Rico Lin (rico-lin)
Changed in heat:
milestone: pike-2 → next
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on heat (master)

Change abandoned by Rico Lin (<email address hidden>) on branch: master
Review: https://review.openstack.org/209439

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.