Relative paths to Heat template resources do not work in horizon

Bug #1467781 reported by Ma Bo
24
This bug affects 4 people
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Invalid
Undecided
Unassigned
python-heatclient
Triaged
Medium
Unassigned

Bug Description

Steps to reproduce the problem:
1. files list
    # filename: f.yaml
    heat_template_version: 2013-05-23
    resources:
     s:
       type: s.yaml
    # filename: s.yaml
    heat_template_version: 2013-05-23
2. Put above two files in a http server, use horizon to create stack

Beside the tempalte-validate error, horizon will say `s.yaml' not found so can not create stack.

While below command works:
heat stack-create -u http://.../f.yaml f

The same situation for get file found in horizon

Yes, the bug can be fixed in horizon side but if we can fix it in heat client side it will benefit all the application based on heat.

Tags: heat
Ma Bo (mabo-1)
summary: - get file not work in horizon
+ Stack resources not work in horizon
description: updated
description: updated
description: updated
Revision history for this message
Angus Salkeld (asalkeld) wrote : Re: Stack resources not work in horizon

What do you expect the out come to be?
In this use case where is the s.yaml physically situated?

Let's say we have this:
1. in a local directory I have:
    $ ls
     s.yaml f.yaml
2. I click the upload template button and select f.yaml.
     (this AFAIK is done by horizon)
3. click "create stack"
     here heatclient does not have the original directory that f.yaml was in (afaik)

The only thing I can think of is to supply a helper function that be used to retrieve a list of required files.
But it would be good to know what would be useful from horizon's point of view.

Revision history for this message
Ma Bo (mabo-1) wrote :

s.yaml and f.yaml is put on a http server, say:
http://9.110.51.34/heat/f.yaml
http://9.110.51.34/heat/s.yaml

When I am using heat stack-create -u http://9.110.51.34/heat/f.yaml f, it works well. When I am using horizon, input http://9.110.51.34/heat/f.yaml as url input, it reports error. I checked the code and found heat CLI read the contents and do transform, and put the template contents in `template`, while horizon just put the url to `template_url` and pass it to heat. Below is code, horizon:
  kwargs = {}
        if cleaned['template_data']:
            kwargs['template'] = cleaned['template_data']
        else:
            kwargs['template_url'] = cleaned['template_url']
heat cli:
tpl_files, template = template_utils.get_template_contents(...
...
'template': template,
...

You can see horizon is passing the template_url to heat client, so heat client should know the original url. So it should work.

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

The following scenario should work once there are changes to horizon:
- The base template is a network URL
- Other referenced templates are relative URLs or network URLs

When a stack is created from a network URL, horizon needs to call template_utils.get_template_contents and template_utils.process_multiple_environments_and_files, just like the CLI stack-create does:
http://git.openstack.org/cgit/openstack/python-heatclient/tree/heatclient/v1/shell.py#n93

Then all necessary files should be collected for the stack create call.

There also needs to be some mechanism to ensure that any attempt to load a file:// URL will fail (this may require a change to heatclient to add a global or a function argument for disabled URL schemes)

Changed in python-heatclient:
status: New → Triaged
importance: Undecided → Medium
Rabi Mishra (rabi)
Changed in python-heatclient:
assignee: nobody → Rabi Mishra (rabi)
tags: added: heat
Rabi Mishra (rabi)
Changed in python-heatclient:
assignee: Rabi Mishra (rabi) → nobody
Zane Bitter (zaneb)
summary: - Stack resources not work in horizon
+ Relative paths to stack resources do not work in horizon
summary: - Relative paths to stack resources do not work in horizon
+ Relative paths to template resources do not work in horizon
summary: - Relative paths to template resources do not work in horizon
+ Relative paths to Heat template resources do not work in horizon
Zane Bitter (zaneb)
Changed in horizon:
status: New → Confirmed
Revision history for this message
Duc Truong (dkt26111) wrote :
Revision history for this message
Gary W. Smith (gary-w-smith) wrote :

Marking invalid be Duc Truong's comment. If you are able to reproduce this, then feel free to reopen it.

Changed in horizon:
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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