Bug 1252433 - [Director] YAML Mapping values are not allowed in this context
[Director] YAML Mapping values are not allowed in this context
Status: CLOSED CURRENTRELEASE
Product: Red Hat OpenStack
Classification: Red Hat
Component: documentation (Show other bugs)
7.0 (Kilo)
Unspecified Unspecified
high Severity high
: z1
: 7.0 (Kilo)
Assigned To: Dan Macpherson
: Documentation, Reopened, ZStream
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-08-11 08:04 EDT by Dariusz Smigiel
Modified: 2016-03-17 23:17 EDT (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-03-17 23:17:19 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Dariusz Smigiel 2015-08-11 08:04:32 EDT
Description of problem:
Cannot deploy overcloud

How reproducible:
100%

Steps to Reproduce:
0. Following documentation: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux_OpenStack_Platform/7/html/Director_Installation_and_Usage/sect-Advanced-Scenario_3_Using_the_CLI_to_Create_an_Advanced_Overcloud_with_Ceph_Nodes.html
1. Configure Undercloud
2. Configure heat templates for deploying overcloud
3. Run `[stack@gklab-17-081 templates]$ openstack --debug overcloud deploy --templates ~/templates/my-overcloud -e ~/templates/my-overcloud/environments/network-isolation.yaml -e ~/templates/network-environment.yaml -e ~/templates/storage-environment.yaml --control-scale 3 --compute-scale 3 --ceph-storage-scale 3 --control-flavor control --compute-flavor compute --ceph-storage-flavor ceph-storage --ntp-server corp.intel.com --neutron-network-type gre --neutron-tunnel-types gre`

Actual results:
Traceback

Deploying templates in the directory /home/stack/templates/my-overcloud
DEBUG: rdomanager_oscplugin.v1.overcloud_deploy.DeployOvercloud Creating Environment file
DEBUG: rdomanager_oscplugin.v1.overcloud_deploy.DeployOvercloud Creating Keystone certificates
DEBUG: os_cloud_config.keystone_pki Generated CA key.
DEBUG: os_cloud_config.keystone_pki Generated CA certificate.
DEBUG: os_cloud_config.keystone_pki Generated signing key.
DEBUG: os_cloud_config.keystone_pki Generated signing certificate.
DEBUG: os_cloud_config.keystone_pki Wrote key/certs into '/home/stack/overcloud-env.json'.
DEBUG: rdomanager_oscplugin.v1.overcloud_deploy.DeployOvercloud Processing environment files
> /usr/lib/python2.7/site-packages/heatclient/common/environment_format.py(33)parse()
-> raise ValueError(yea)
(Pdb) c
ERROR: openstack mapping values are not allowed in this context
  in "<byte string>", line 28, column 40
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/cliff/app.py", line 295, in run_subcommand
    result = cmd.run(parsed_args)
  File "/usr/lib/python2.7/site-packages/cliff/command.py", line 53, in run
    self.take_action(parsed_args)
  File "/usr/lib/python2.7/site-packages/rdomanager_oscplugin/v1/overcloud_deploy.py", line 864, in take_action
    self._deploy_tripleo_heat_templates(stack, parsed_args)
  File "/usr/lib/python2.7/site-packages/rdomanager_oscplugin/v1/overcloud_deploy.py", line 535, in _deploy_tripleo_heat_templates
    parsed_args.timeout)
  File "/usr/lib/python2.7/site-packages/rdomanager_oscplugin/v1/overcloud_deploy.py", line 435, in _heat_deploy
    environments))
  File "/usr/lib/python2.7/site-packages/heatclient/common/template_utils.py", line 166, in process_multiple_environments_and_files
    template_url)
  File "/usr/lib/python2.7/site-packages/heatclient/common/template_utils.py", line 188, in process_environment_and_files
    env = environment_format.parse(raw_env)
  File "/usr/lib/python2.7/site-packages/heatclient/common/environment_format.py", line 33, in parse
    raise ValueError(yea)
ValueError: mapping values are not allowed in this context
  in "<byte string>", line 28, column 40
DEBUG: openstackclient.shell clean_up DeployOvercloud
DEBUG: openstackclient.shell got an error: mapping values are not allowed in this context
  in "<byte string>", line 28, column 40
ERROR: openstackclient.shell Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/openstackclient/shell.py", line 176, in run
    return super(OpenStackShell, self).run(argv)
  File "/usr/lib/python2.7/site-packages/cliff/app.py", line 230, in run
    result = self.run_subcommand(remainder)
  File "/usr/lib/python2.7/site-packages/cliff/app.py", line 295, in run_subcommand
    result = cmd.run(parsed_args)
  File "/usr/lib/python2.7/site-packages/cliff/command.py", line 53, in run
    self.take_action(parsed_args)
  File "/usr/lib/python2.7/site-packages/rdomanager_oscplugin/v1/overcloud_deploy.py", line 864, in take_action
    self._deploy_tripleo_heat_templates(stack, parsed_args)
  File "/usr/lib/python2.7/site-packages/rdomanager_oscplugin/v1/overcloud_deploy.py", line 535, in _deploy_tripleo_heat_templates
    parsed_args.timeout)
  File "/usr/lib/python2.7/site-packages/rdomanager_oscplugin/v1/overcloud_deploy.py", line 435, in _heat_deploy
    environments))
  File "/usr/lib/python2.7/site-packages/heatclient/common/template_utils.py", line 166, in process_multiple_environments_and_files
    template_url)
  File "/usr/lib/python2.7/site-packages/heatclient/common/template_utils.py", line 188, in process_environment_and_files
    env = environment_format.parse(raw_env)
  File "/usr/lib/python2.7/site-packages/heatclient/common/environment_format.py", line 33, in parse
    raise ValueError(yea)
ValueError: mapping values are not allowed in this context
  in "<byte string>", line 28, column 40


Expected results:
Running deployment

Additional info:
Workaround.
Edit `network-environment.yaml` file and change line 28 from:
  NeutronExternalNetworkBridge: default: "br-ex"
to:
  NeutronExternalNetworkBridge:
default: "br-ex"
Comment 3 chris alfonso 2015-08-18 15:08:20 EDT
This appears to be a bug in the documentation, where the example template needs a line break.
Comment 4 Andrew Dahms 2015-08-24 07:20:10 EDT
Dear Dariusz,

Thank you for raising this bug.

Now assigning to the author of the director content for review.

Dan - could you take a look at the above?

Kind regards,

Andrew
Comment 6 Dan Macpherson 2015-09-08 21:37:42 EDT
Hi Dariusz,

I've pushed an update to the documentation with that changes the syntax of NeutronExternalNetworkBridge. The format is now just:

  # Set to "br-ex" if using floating IPs on native VLAN on bridge br-ex
  NeutronExternalNetworkBridge: "''"

This bug is also related: https://bugzilla.redhat.com/show_bug.cgi?id=1258795

Here are the links for both the Basic and Advanced Scenarios:

https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux_OpenStack_Platform/7/html/Director_Installation_and_Usage/sect-Scenario_2_Using_the_CLI_to_Create_a_Basic_Overcloud.html#sect-Isolating_the_External_Network

https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux_OpenStack_Platform/7/html/Director_Installation_and_Usage/sect-Advanced-Scenario_3_Using_the_CLI_to_Create_an_Advanced_Overcloud_with_Ceph_Nodes.html#sect-Advanced-Isolating_all_Networks_into_VLANs

I think this should correct the issue you're experiencing. Are any further changes required?
Comment 7 Dan Macpherson 2016-01-24 20:34:08 EST
No response in several months. Closing this bug, but feel free to reopen if necessary.
Comment 8 Alexandru Dan 2016-02-29 02:58:44 EST
I have this exact error in my deployment and I am using this documentation https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux_OpenStack_Platform/7/html/Director_Installation_and_Usage/chap-Installing_the_Overcloud.html to deploy an OpenStack Platform 7 for Redhat Certification Program.

My file shows:
[stack@director ~]$ grep NeutronExternalNetworkBridge templates/network-environment.yaml
  NeutronExternalNetworkBridge: "br-ex"

My error is:
  File "/usr/lib/python2.7/site-packages/heatclient/common/environment_format.py", line 32, in parse
    raise ValueError(yea)
ValueError: while parsing a block mapping
  in "<byte string>", line 1, column 1
did not find expected key
  in "<byte string>", line 28, column 3


It's not clear from the documentation how br-ex should be inserted in the file. I've tried 'br-ex' "br-ex" "'br-ex'", indenting with two spaces on the next line default: 'br-ex' and default: "br-ex". Still no success.
Comment 9 Marius Cornea 2016-02-29 04:14:56 EST
Hi Alexandru,

I suspect there is an indentation issue in your environment file. The proper format in the docs looks ok:

parameter_defaults:
  NeutronExternalNetworkBridge: "''"

Can you attach your environment file here?

Note that NeutronExternalNetworkBridge defaults to br-ex(see overcloud-without-mergepy.yaml) so you should pass it in the network-environment.yaml only if you want it customized. Setting it to an empty string is recommended since it allows creating multiple overcloud external networks (for details please see external_network_bridge in the neutron l3_agent.ini). 

Thanks,
Marius
Comment 10 Alexandru Dan 2016-02-29 04:26:16 EST
Hello Marius, thank you for your reply.

I tried also with an empty value for that line, the same error appears.

Here is the environment file:
--- BOF
resource_registry:
  OS::TripleO::BlockStorage::Net::SoftwareConfig: /home/stack/templates/nic-configs/cinder-storage.yaml
  OS::TripleO::Compute::Net::SoftwareConfig: /home/stack/templates/nic-configs/compute.yaml
  OS::TripleO::Controller::Net::SoftwareConfig: /home/stack/templates/nic-configs/controller.yaml
  OS::TripleO::ObjectStorage::Net::SoftwareConfig: /home/stack/templates/nic-configs/swift-storage.yaml
  OS::TripleO::CephStorage::Net::SoftwareConfig: /home/stack/templates/nic-configs/ceph-storage.yaml

parameter_defaults:
  ExternalNetCidr: 192.0.1.0/24
  ExternalAllocationPools: [{'start': '192.0.1.10', 'end': '192.0.1.50'}]
  ExternalNetworkVlanID: 100
  # Set to the router gateway on the external network
  ExternalInterfaceDefaultRoute: 192.0.1.2
  # Gateway router for the provisioning network (or Undercloud IP)
  ControlPlaneDefaultRoute: 192.0.2.1
  # The IP address of the EC2 metadata server. Generally the IP of the Undercloud
  EC2MetadataIp: 192.0.2.1
  # Define the DNS servers (maximum 2) for the overcloud nodes
  DnsServers: ["8.8.8.8","8.8.4.4"]
  # Set to "br-ex" if using floating IPs on native VLAN on bridge br-ex
  NeutronExternalNetworkBridge: "'br-ex'"
--- EOF

I am trying to create a basic overcloud just for a certification, the default external network is fine and there is no need for customization.
Comment 11 Marius Cornea 2016-02-29 04:43:01 EST
This looks ok to me as long as the yaml indentation is right(no trailing white spaces or similar). Typically the error that you get indicate this kind of error in the environment file(s). If you need NeutronExternalNetworkBridge set to br-ex you can try removing it from the environment as it defaults to br-ex.
Comment 12 Alexandru Dan 2016-02-29 04:50:05 EST
Removing the line has no effect. I am starting to believe there is problem in the tripleo templates.

Here is the full command and output with --debug:
http://paste.openstack.org/show/488515/
Comment 13 Marius Cornea 2016-02-29 04:57:11 EST
OK, I see you are passing multiple environment files including the ones for enabling SSL. Please make sure those are formatted correctly or paste them so I can have a quick look.
Comment 14 Alexandru Dan 2016-02-29 05:06:20 EST
Hello Marius, 

Thank you! Here are all the files pasted one by one.

http://paste.openstack.org/show/488522/
Comment 15 Marius Cornea 2016-02-29 05:31:52 EST
At a quick glance they look ok so I'd still blame bad formatting. In order to identify the bad environment file you could try eliminating them one by one from the deploy command and see when the deployment goes further.
Comment 16 Dan Macpherson 2016-02-29 20:46:07 EST
Re-opening as this case.
Comment 17 Dan Macpherson 2016-03-01 00:10:07 EST
(In reply to Dan Macpherson from comment #16)
> Re-opening as this case.

I meant, "Re-opening this case."
Comment 18 Dan Macpherson 2016-03-16 00:44:28 EDT
Hi Alexandru,

Did you manage to get your issue resolved?

- Dan
Comment 19 Alexandru Dan 2016-03-16 04:52:06 EDT
I managed to get the issue solved by doing several actions:

1. I have used this line in network_environment.yaml
  NeutronExternalNetworkBridge: "br-ex"

2. Later I received errors and the only way I could find to get passed it was to use another line in the same file:
   ExternalIpSubnet: 255.255.255.0

3. In templates/nic-configs/compute.yaml in routes: section of the second interface I had to insert statically next_hop line using the real gateway. This in my case wasn't a blocker but I needed external connectivity for this compute node in particular. 

4. After deployment I needed to create external connectivity but tripleo deploys the IP addresses for ha and api endpoints directly on the external interface (nic2 in my case) so steps I needed to take:
  - removed IP configuration in ifcfg-<external-nic>:
DEVICE=<external-nic>
ONBOOT=yes
HOTPLUG=no
NM_CONTROLLED=no
DEVICETYPE=ovs
TYPE=OVSPort
OVS_BRIDGE=br-public
BOOTPROTO=none
  - create file ifcfg-br-public:
DEVICE=br-public
BOOTPROTO=static
IPADDR=<external_reachable_IP>
NETMASK=<netmask>
ONBOOT=yes
HOTPLUG=no
NM_CONTROLLED=no
DEVICETYPE=ovs
TYPE=OVSBridge
OVSBOOTPROTO=dhcp
OVSDHCPINTERFACES="<external-nic>"
OVS_EXTRA="set bridge br-public other-config:hwaddr=<mac-address-of-external-nic>"
  - create and add default routes in route-br-public file
  - create the br-public ovs bridge: ovs-vsctl add-br br-public
  - add the <external_nic> port to br-public: ovs-vsctl add-port br-public <external_nic>
  - change the bridge_mappings directive in /etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini:
    bridge_mappings =datacentre:br-public
  - I rebooted the controller


I need to remind everyone that my external_nic is native vlan and my whole environment was created in vmware workstation using bridged networking for the external nics and host-only networking for the openstack networks.
Comment 20 Alexandru Dan 2016-03-16 04:57:16 EDT
Sorry for my last comment, I've mixed up the BZ :)

The issue was in this file: templates/cloudname.yaml, the directive DnsServers should be of this form:
  DnsServers: ['8.8.8.8']

Note You need to log in before you can comment on or make changes to this bug.