Bug 1319919

Summary: [RFE] get_file doesn't work in the global environment
Product: Red Hat OpenStack Reporter: Eric Rich <erich>
Component: openstack-heatAssignee: Zane Bitter <zbitter>
Status: CLOSED WONTFIX QA Contact: Ronnie Rasouli <rrasouli>
Severity: high Docs Contact:
Priority: low    
Version: 7.0 (Kilo)CC: achernet, dhill, jcoufal, jruzicka, mburns, rhel-osp-director-maint, sbaker, sclewis, shardy, srevivo, zbitter
Target Milestone: Upstream M3Keywords: FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-06-14 15:54:30 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Eric Rich 2016-03-21 20:04:40 UTC
Description of problem:

https://bugs.launchpad.net/heat/+bug/1454401


Version-Release number of selected component (if applicable): 7.0


How reproducible: 100% 

Steps to Reproduce:

  user_data:
    type: string
    default: "file:///root/heat-templates/samples/user_data.sh"

resources:

  instance:
    #depends_on: [network_port_resource]
    type: OS::Nova::Server
    properties:
      name: { get_param: instance_name }
      key_name: { get_param: ssh_key_name }
      image: { get_param: image_name }
      flavor: { get_param: image_flavor }
      networks:
        - port: { get_param: network_port_resource }
      availability_zone: { get_param: az }
      user_data_format: RAW
      user_data:
        #get_file: "file:///root/heat-templates/samples/user_data.sh" ### Works
        get_file: { get_param: user_data }   
          ### Does not work (its precised because of the note in http://docs.openstack.org/developer/heat/template_guide/hot_spec.html#get-file)

Actual results: Fails to Create Instance, "No content found in the "files" section for get_file path when" Error

Expected results: Suscessfull Stack creation with a customizable cloud-init file. 

Additional info:

Comment 2 Zane Bitter 2016-03-21 20:22:52 UTC
It works fine AFAIK. What doesn't work is that the client doesn't automatically upload the file in question the way it does if a filename appears directly within the {get_file: <filename>} intrinsic in the template. It pretty much can't know without completely executing heat-engine's environment and parameter resolution code in the client, and even then there are circumstances that it may not be able to for lack of data (e.g. PATCH update, where some of the parameter values are not known to the client).

It'd be nice to have a way of forcing extra file inclusions on the CLI for those who do want to use this pattern. The server side will certainly accept any files you want to upload there.

Comment 3 Zane Bitter 2016-03-21 20:29:17 UTC
Sorry, ignore previous comment, this RFE refers to the *global* environment, not the environment passed by the user. So the note in http://docs.openstack.org/developer/heat/template_guide/hot_spec.html#get-file has nothing to do with it.

This seems inherently insecure to me.

Comment 4 Steve Baker 2016-03-21 21:27:14 UTC
There is an upstream change, but it needs work and is currently looking likely to miss mitaka-rc2

Comment 9 Zane Bitter 2017-01-13 17:15:14 UTC
Current status: upstream reviews are still ongoing.

Comment 11 Zane Bitter 2017-01-26 15:08:44 UTC
Didn't make upstream feature freeze for Ocata, so bumping to OSP 12.

Comment 18 Jaromir Coufal 2019-06-14 15:54:30 UTC
Obsolete RFE without enough of backed demand.