[Openstack] [Heat] Error - Template not in valid format

Therese Persson therese.persson at ericsson.com
Fri Nov 1 08:35:50 UTC 2013


Thank you for your answer Angus.

I tried to remove the parameters from the file as you suggested and tried to create a stack with horizon, but I seem to have an authorization problem.

This is shown in my heat-engine.log file:

2013-11-01 09:21:09.978 16039 ERROR heat.engine.parser [-] Authorization Failed: The resource could not be found. (HTTP 404)
2013-11-01 09:21:09.978 16039 TRACE heat.engine.parser Traceback (most recent call last):
2013-11-01 09:21:09.978 16039 TRACE heat.engine.parser   File "/usr/lib/python2.7/dist-packages/heat/engine/parser.py", line 308, in validate
2013-11-01 09:21:09.978 16039 TRACE heat.engine.parser     result = res.validate()
2013-11-01 09:21:09.978 16039 TRACE heat.engine.parser   File "/usr/lib/python2.7/dist-packages/heat/engine/resources/server.py", line 371, in validate
2013-11-01 09:21:09.978 16039 TRACE heat.engine.parser     nova_utils.get_keypair(self.nova(), key_name)
2013-11-01 09:21:09.978 16039 TRACE heat.engine.parser   File "/usr/lib/python2.7/dist-packages/heat/engine/resource.py", line 315, in nova
2013-11-01 09:21:09.978 16039 TRACE heat.engine.parser     return self.stack.clients.nova(service_type)
2013-11-01 09:21:09.978 16039 TRACE heat.engine.parser   File "/usr/lib/python2.7/dist-packages/heat/engine/clients.py", line 111, in nova
2013-11-01 09:21:09.978 16039 TRACE heat.engine.parser     management_url = self.url_for(service_type=service_type)
2013-11-01 09:21:09.978 16039 TRACE heat.engine.parser   File "/usr/lib/python2.7/dist-packages/heat/engine/clients.py", line 86, in url_for
2013-11-01 09:21:09.978 16039 TRACE heat.engine.parser     return self.keystone().url_for(**kwargs)
2013-11-01 09:21:09.978 16039 TRACE heat.engine.parser   File "/usr/lib/python2.7/dist-packages/heat/common/heat_keystoneclient.py", line 309, in url_for
2013-11-01 09:21:09.978 16039 TRACE heat.engine.parser     return self.client_v2.service_catalog.url_for(**kwargs)
2013-11-01 09:21:09.978 16039 TRACE heat.engine.parser   File "/usr/lib/python2.7/dist-packages/heat/common/heat_keystoneclient.py", line 73, in client_v2
2013-11-01 09:21:09.978 16039 TRACE heat.engine.parser     self._client_v2 = self._v2_client_init()
2013-11-01 09:21:09.978 16039 TRACE heat.engine.parser   File "/usr/lib/python2.7/dist-packages/heat/common/heat_keystoneclient.py", line 103, in _v2_client_init
2013-11-01 09:21:09.978 16039 TRACE heat.engine.parser     client_v2 = kc.Client(**kwargs)
2013-11-01 09:21:09.978 16039 TRACE heat.engine.parser   File "/usr/lib/python2.7/dist-packages/keystoneclient/v2_0/client.py", line 139, in __init__
2013-11-01 09:21:09.978 16039 TRACE heat.engine.parser     self.authenticate()
2013-11-01 09:21:09.978 16039 TRACE heat.engine.parser   File "/usr/lib/python2.7/dist-packages/keystoneclient/httpclient.py", line 458, in authenticate
2013-11-01 09:21:09.978 16039 TRACE heat.engine.parser     resp, body = self.get_raw_token_from_identity_service(**kwargs)
2013-11-01 09:21:09.978 16039 TRACE heat.engine.parser   File "/usr/lib/python2.7/dist-packages/keystoneclient/v2_0/client.py", line 166, in get_raw_token_from_identity_service
2013-11-01 09:21:09.978 16039 TRACE heat.engine.parser     "%s" % e)
2013-11-01 09:21:09.978 16039 TRACE heat.engine.parser AuthorizationFailure: Authorization Failed: The resource could not be found. (HTTP 404)
2013-11-01 09:21:09.978 16039 TRACE heat.engine.parser
2013-11-01 09:21:09.980 16039 ERROR heat.openstack.common.rpc.amqp [-] Exception during message handling
2013-11-01 09:21:09.980 16039 TRACE heat.openstack.common.rpc.amqp Traceback (most recent call last):
2013-11-01 09:21:09.980 16039 TRACE heat.openstack.common.rpc.amqp   File "/usr/lib/python2.7/dist-packages/heat/openstack/common/rpc/amqp.py", line 461, in _process_data
2013-11-01 09:21:09.980 16039 TRACE heat.openstack.common.rpc.amqp     **args)
2013-11-01 09:21:09.980 16039 TRACE heat.openstack.common.rpc.amqp   File "/usr/lib/python2.7/dist-packages/heat/openstack/common/rpc/dispatcher.py", line 172, in dispatch
2013-11-01 09:21:09.980 16039 TRACE heat.openstack.common.rpc.amqp     result = getattr(proxyobj, method)(ctxt, **kwargs)
2013-11-01 09:21:09.980 16039 TRACE heat.openstack.common.rpc.amqp   File "/usr/lib/python2.7/dist-packages/heat/engine/service.py", line 60, in wrapped
2013-11-01 09:21:09.980 16039 TRACE heat.openstack.common.rpc.amqp     return func(self, ctx, *args, **kwargs)
2013-11-01 09:21:09.980 16039 TRACE heat.openstack.common.rpc.amqp   File "/usr/lib/python2.7/dist-packages/heat/engine/service.py", line 281, in create_stack
2013-11-01 09:21:09.980 16039 TRACE heat.openstack.common.rpc.amqp     stack.validate()
2013-11-01 09:21:09.980 16039 TRACE heat.openstack.common.rpc.amqp   File "/usr/lib/python2.7/dist-packages/heat/engine/parser.py", line 314, in validate
2013-11-01 09:21:09.980 16039 TRACE heat.openstack.common.rpc.amqp     raise StackValidationFailed(message=str(ex))
2013-11-01 09:21:09.980 16039 TRACE heat.openstack.common.rpc.amqp StackValidationFailed: Authorization Failed: The resource could not be found. (HTTP 404)
2013-11-01 09:21:09.980 16039 TRACE heat.openstack.common.rpc.amqp
2013-11-01 09:21:09.981 16039 ERROR heat.openstack.common.rpc.common [-] Returning exception Authorization Failed: The resource could not be found. (HTTP 404) to caller


In my heat-api.log file:

2013-11-01 09:21:09.984 15997 ERROR root [-] Unexpected error occurred serving API: Authorization Failed: The resource could not be found. (HTTP 404)
2013-11-01 09:21:09.984 15997 TRACE root Traceback (most recent call last):
2013-11-01 09:21:09.984 15997 TRACE root   File "/usr/lib/python2.7/dist-packages/heat/common/wsgi.py", line 661, in __call__
2013-11-01 09:21:09.984 15997 TRACE root     request, **action_args)
2013-11-01 09:21:09.984 15997 TRACE root   File "/usr/lib/python2.7/dist-packages/heat/common/wsgi.py", line 729, in dispatch
2013-11-01 09:21:09.984 15997 TRACE root     return method(*args, **kwargs)
2013-11-01 09:21:09.984 15997 TRACE root   File "/usr/lib/python2.7/dist-packages/heat/api/openstack/v1/util.py", line 30, in handle_stack_method
2013-11-01 09:21:09.984 15997 TRACE root     return handler(controller, req, **kwargs)
2013-11-01 09:21:09.984 15997 TRACE root   File "/usr/lib/python2.7/dist-packages/heat/api/openstack/v1/stacks.py", line 221, in create
2013-11-01 09:21:09.984 15997 TRACE root     data.args())
2013-11-01 09:21:09.984 15997 TRACE root   File "/usr/lib/python2.7/dist-packages/heat/rpc/client.py", line 88, in create_stack
2013-11-01 09:21:09.984 15997 TRACE root     params=params, files=files, args=args))
2013-11-01 09:21:09.984 15997 TRACE root   File "/usr/lib/python2.7/dist-packages/heat/openstack/common/rpc/proxy.py", line 126, in call
2013-11-01 09:21:09.984 15997 TRACE root     result = rpc.call(context, real_topic, msg, timeout)
2013-11-01 09:21:09.984 15997 TRACE root   File "/usr/lib/python2.7/dist-packages/heat/openstack/common/rpc/__init__.py", line 141, in call
2013-11-01 09:21:09.984 15997 TRACE root     return _get_impl().call(CONF, context, topic, msg, timeout)
2013-11-01 09:21:09.984 15997 TRACE root   File "/usr/lib/python2.7/dist-packages/heat/openstack/common/rpc/impl_kombu.py", line 816, in call
2013-11-01 09:21:09.984 15997 TRACE root     rpc_amqp.get_connection_pool(conf, Connection))
2013-11-01 09:21:09.984 15997 TRACE root   File "/usr/lib/python2.7/dist-packages/heat/openstack/common/rpc/amqp.py", line 574, in call
2013-11-01 09:21:09.984 15997 TRACE root     rv = list(rv)
2013-11-01 09:21:09.984 15997 TRACE root   File "/usr/lib/python2.7/dist-packages/heat/openstack/common/rpc/amqp.py", line 539, in __iter__
2013-11-01 09:21:09.984 15997 TRACE root     raise result
2013-11-01 09:21:09.984 15997 TRACE root StackValidationFailed_Remote: Authorization Failed: The resource could not be found. (HTTP 404)
2013-11-01 09:21:09.984 15997 TRACE root Traceback (most recent call last):
2013-11-01 09:21:09.984 15997 TRACE root
2013-11-01 09:21:09.984 15997 TRACE root   File "/usr/lib/python2.7/dist-packages/heat/openstack/common/rpc/amqp.py", line 461, in _process_data
2013-11-01 09:21:09.984 15997 TRACE root     **args)
2013-11-01 09:21:09.984 15997 TRACE root
2013-11-01 09:21:09.984 15997 TRACE root   File "/usr/lib/python2.7/dist-packages/heat/openstack/common/rpc/dispatcher.py", line 172, in dispatch
2013-11-01 09:21:09.984 15997 TRACE root     result = getattr(proxyobj, method)(ctxt, **kwargs)
2013-11-01 09:21:09.984 15997 TRACE root
2013-11-01 09:21:09.984 15997 TRACE root   File "/usr/lib/python2.7/dist-packages/heat/engine/service.py", line 60, in wrapped
2013-11-01 09:21:09.984 15997 TRACE root     return func(self, ctx, *args, **kwargs)
2013-11-01 09:21:09.984 15997 TRACE root
2013-11-01 09:21:09.984 15997 TRACE root   File "/usr/lib/python2.7/dist-packages/heat/engine/service.py", line 281, in create_stack
2013-11-01 09:21:09.984 15997 TRACE root     stack.validate()
2013-11-01 09:21:09.984 15997 TRACE root
2013-11-01 09:21:09.984 15997 TRACE root   File "/usr/lib/python2.7/dist-packages/heat/engine/parser.py", line 314, in validate
2013-11-01 09:21:09.984 15997 TRACE root     raise StackValidationFailed(message=str(ex))
2013-11-01 09:21:09.984 15997 TRACE root
2013-11-01 09:21:09.984 15997 TRACE root StackValidationFailed: Authorization Failed: The resource could not be found. (HTTP 404)

In my heat.conf file:

[DEFAULT]
connection = mysql://heat:heat@10.10.10.51/heat

(Everything else is commented out.)

In my /etc/heat/api-paste.conf file:

# heat-api pipeline
[pipeline:heat-api]
pipeline = faultwrap versionnegotiation authtoken context apiv1app

# heat-api pipeline for standalone heat
# ie. uses alternative auth backend that authenticates users against keystone
# using username and password instead of validating token (which requires
# an admin/service token).
# To enable, in heat.conf:
#   [paste_deploy]
#   flavor = standalone
#
[pipeline:heat-api-standalone]
pipeline = faultwrap versionnegotiation authpassword context apiv1app

# heat-api pipeline for custom cloud backends
# i.e. in heat.conf:
#   [paste_deploy]
#   flavor = custombackend
#
[pipeline:heat-api-custombackend]
pipeline = faultwrap versionnegotiation context custombackendauth apiv1app

# heat-api-cfn pipeline
[pipeline:heat-api-cfn]
pipeline = cfnversionnegotiation ec2authtoken authtoken context apicfnv1app

# heat-api-cfn pipeline for standalone heat
# relies exclusively on authenticating with ec2 signed requests
[pipeline:heat-api-cfn-standalone]
pipeline = cfnversionnegotiation ec2authtoken context apicfnv1app

# heat-api-cloudwatch pipeline
[pipeline:heat-api-cloudwatch]
pipeline = versionnegotiation ec2authtoken authtoken context apicwapp

# heat-api-cloudwatch pipeline for standalone heat
# relies exclusively on authenticating with ec2 signed requests
[pipeline:heat-api-cloudwatch-standalone]
pipeline = versionnegotiation ec2authtoken context apicwapp

[app:apiv1app]
paste.app_factory = heat.common.wsgi:app_factory
heat.app_factory = heat.api.openstack.v1:API

[app:apicfnv1app]
paste.app_factory = heat.common.wsgi:app_factory
heat.app_factory = heat.api.cfn.v1:API

[app:apicwapp]
paste.app_factory = heat.common.wsgi:app_factory
heat.app_factory = heat.api.cloudwatch:API

[filter:versionnegotiation]
paste.filter_factory = heat.common.wsgi:filter_factory
heat.filter_factory = heat.api.openstack:version_negotiation_filter

[filter:faultwrap]
paste.filter_factory = heat.common.wsgi:filter_factory
heat.filter_factory = heat.api.openstack:faultwrap_filter

[filter:cfnversionnegotiation]
paste.filter_factory = heat.common.wsgi:filter_factory
heat.filter_factory = heat.api.cfn:version_negotiation_filter

[filter:cwversionnegotiation]
paste.filter_factory = heat.common.wsgi:filter_factory
heat.filter_factory = heat.api.cloudwatch:version_negotiation_filter

[filter:context]
paste.filter_factory = heat.common.context:ContextMiddleware_filter_factory

[filter:ec2authtoken]
paste.filter_factory = heat.api.aws.ec2token:EC2Token_filter_factory

# Auth middleware that validates token against keystone
[filter:authtoken]
paste.filter_factory = heat.common.auth_token:filter_factory
auth_host = 10.10.10.51
auth_port = 35357
auth_protocol = http
admin_tenant_name = service
admin_user = heat
admin_password = heat


# Auth middleware that validates username/password against keystone
[filter:authpassword]
paste.filter_factory = heat.common.auth_password:filter_factory

# Auth middleware that validates against custom backend
[filter:custombackendauth]
paste.filter_factory = heat.common.custom_backend_auth:filter_factory

/Therese


-----Original Message-----
From: Angus Salkeld [mailto:asalkeld at redhat.com] 
Sent: den 1 november 2013 00:52
To: openstack at lists.openstack.org
Subject: Re: [Openstack] [Heat] Error - Template not in valid format

On 31/10/13 15:17 +0000, Therese Persson wrote:
>Hi,
>
>I have recently upgraded to Havana and just started trying out Heat. I tried to launch a stack by using this template file:
>https://github.com/openstack/heat-templates/blob/master/hot/servers_in_
>existing_neutron_net.yaml
>
>However, I am not familiar with these type of files and I am not sure of what information I should add to the file to make it valid for Heat.
>This is what my modified file looks like:

Hi Therese,

It's just yaml, so I sometimes head over to http://yaml-online-parser.appspot.com/ and dump my template in there and tells you what is wrong.

Basically you are putting your parameter values in the wrong place.

instead of:
parameters:
   key_name: mykey
     type: string
     description: Name of keypair to assign to servers remove the "mykey" so it is back to:

parameters:
   key_name:
     type: string
     description: Name of keypair to assign to servers


Then start the template like this:

heat stack-create mystack --template-file=/scripts/servers_in_existing_neutron_net.yaml -P "key_name=mykey;image=Ubuntu;flavor=m1.small"

Hope that helps
-Angus

>
>heat_template_version: 2013-05-23
>
>description: >
>  HOT template to deploy two servers into an existing neutron tenant 
>network and
>  assign floating IP addresses to each server so they are routable from 
>the
>  public network.
>
>parameters:
>  key_name: mykey
>    type: string
>    description: Name of keypair to assign to servers
>  image: Ubuntu
>    type: string
>    description: Name of image to use for servers
>  flavor: m1.small
>    type: string
>    description: Flavor to use for servers
>  public_net_id: 55896cd0-040a-4e7b-8a92-cb27f32b4ad9
>    type: string
>    description: >
>      ID of public network for which floating IP addresses will be 
>allocated
>  private_net_id: 3bd4e56f-1e8c-4316-8e59-a358016e9ef8
>    type: string
>    description: ID of private network into which servers get deployed
>  private_subnet_id: f4bac2ea-b74d-47ef-a8b3-5969d60bfbba
>    type: string
>    description: ID of private sub network into which servers get 
>deployed
>
>resources:
>  server1:
>    type: OS::Nova::Server
>    properties:
>      name: Server1
>      image: { get_param: image }
>      flavor: { get_param: flavor }
>      key_name: { get_param: key_name }
>      networks:
>        - port: { get_resource: server1_port }
>
>  server1_port:
>    type: OS::Neutron::Port
>    properties:
>      network_id: { get_param: private_net_id }
>      fixed_ips:
>        - subnet_id: { get_param: private_subnet_id }
>
>  server1_floating_ip:
>    type: OS::Neutron::FloatingIP
>    properties:
>      floating_network_id: { get_param: public_net_id }
>      port_id: { get_resource: server1_port }
>
>  server2:
>    type: OS::Nova::Server
>    properties:
>      name: Server2
>      image: { get_param: image }
>      flavor: { get_param: flavor }
>      key_name: { get_param: key_name }
>      networks:
>        - port: { get_resource: server2_port }
>
>  server2_port:
>    type: OS::Neutron::Port
>    properties:
>      network_id: { get_param: private_net_id }
>      fixed_ips:
>        - subnet_id: { get_param: private_subnet_id }
>
>  server2_floating_ip:
>    type: OS::Neutron::FloatingIP
>    properties:
>      floating_network_id: { get_param: public_net_id }
>      port_id: { get_resource: server2_port }
>
>outputs:
>  server1_private_ip:
>    description: IP address of server1 in private network
>    value: { get_attr: [ server1, first_address ] }
>  server1_public_ip:
>    description: Floating IP address of server1 in public network
>    value: { get_attr: [ server1_floating_ip, floating_ip_address ] }
>  server2_private_ip:
>    description: IP address of server2 in private network
>    value: { get_attr: [ server2, first_address ] }
>  server2_public_ip:
>    description: Floating IP address of server2 in public network
>    value: { get_attr: [ server2_floating_ip, floating_ip_address ] }
>
>
>When I try to run the command:
>heat stack-create mystack 
>--template-file=/scripts/servers_in_existing_neutron_net.yaml
>
>I get the following error:
>ERROR: Template not in valid format
>
>
>Any ideas?
>
>Therese

>_______________________________________________
>Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
>Post to     : openstack at lists.openstack.org
>Unsubscribe : 
>http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack


_______________________________________________
Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
Post to     : openstack at lists.openstack.org
Unsubscribe : http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack




More information about the Openstack mailing list