get_file doesn't work in the global environment

Bug #1454401 reported by Steven Hardy on 2015-05-12
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.

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) on 2015-06-17
Changed in heat:
assignee: nobody → Rico Lin (rico-lin)

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

Changed in heat:
status: Triaged → In Progress
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.

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

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)

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
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/

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.

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.

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) on 2016-01-20
Changed in heat:
milestone: next → mitaka-3
Changed in heat:
milestone: mitaka-3 → mitaka-rc1
Changed in heat:
milestone: mitaka-rc1 → newton-1

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

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) on 2016-06-01
Changed in heat:
milestone: newton-1 → newton-2
Thomas Herve (therve) on 2016-07-12
Changed in heat:
milestone: newton-2 → newton-3
Thomas Herve (therve) on 2016-09-01
Changed in heat:
milestone: newton-3 → next
Zane Bitter (zaneb) on 2016-12-14
Changed in heat:
milestone: next → ocata-3
Rabi Mishra (rabi) on 2017-01-25
Changed in heat:
milestone: ocata-3 → ocata-rc1
Rabi Mishra (rabi) on 2017-02-02
Changed in heat:
milestone: ocata-rc1 → pike-1
Rico Lin (rico-lin) on 2017-04-11
Changed in heat:
milestone: pike-1 → pike-2
Rico Lin (rico-lin) on 2017-06-07
Changed in heat:
milestone: pike-2 → next

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  Edit
Everyone can see this information.

Other bug subscribers