Bug 1388547

Summary: MappingToUCSMDeploymentsController is failing with SyntaxError: invalid syntax
Product: Red Hat OpenStack Reporter: kamil.rogon
Component: openstack-tripleo-heat-templatesAssignee: Emilien Macchi <emacchi>
Status: CLOSED ERRATA QA Contact: Gurenko Alex <agurenko>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.0 (Liberty)CC: aschultz, jdonohue, jschluet, mburns, rhel-osp-director-maint, rnishtal
Target Milestone: rcKeywords: Triaged
Target Release: 11.0 (Ocata)   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: openstack-tripleo-heat-templates-6.0.0-0.6.el7ost Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1427712 (view as bug list) Environment:
Last Closed: 2017-05-17 19:36:48 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:
Embargoed:
Bug Depends On:    
Bug Blocks: 1400606, 1427712    

Description kamil.rogon 2016-10-25 15:28:20 UTC
Description of problem:
The bug occurs when "openstack vercloud deploy" command is executed multiple times (in case of upgrade). The script in resource MappingToNexusConfig open some files with append mode, while it writes complete json with single operation.

When the resource MappingToNexusDeploymentsController tries to validate the temporary files they are not json anymore (there are multiple json not separated with any character).

Oct 20 16:51:32 overcloud-controller-0.localdomain os-collect-config[23431]: [2016-10-20 16:51:32,098] (heat-config) [DEBUG] [2016-10-20 16:51:32,064] (heat-config) [INFO] ucsm_config=00:25:B5:00:00:5C:Openstack_Compute_Node1,00:25:b5:00:00:69:Openstack_Compute_Node2,00:25:b5:00:00:1c:Openstack_Compute_Node3,00:25:b5:00:00:1d:Openstack_Compute_Node4,00:25:b5:00:00:5b:Openstack_Compute_Node5,00:25:b5:00:00:4a:Openstack_Compute_Node6,00:25:b5:00:00:3f:Openstack_Controller_Node1,00:25:b5:00:00:5d:Openstack_Controller_Node2,00:25:b5:00:00:2e:Openstack_Controller_Node3
Oct 20 16:51:32 overcloud-controller-0.localdomain os-collect-config[23431]: [2016-10-20 16:51:32,065] (heat-config) [INFO] deploy_server_id=29a0ae31-e787-4eee-b076-2df88f9f2319
Oct 20 16:51:32 overcloud-controller-0.localdomain os-collect-config[23431]: [2016-10-20 16:51:32,065] (heat-config) [INFO] deploy_action=CREATE
Oct 20 16:51:32 overcloud-controller-0.localdomain os-collect-config[23431]: [2016-10-20 16:51:32,065] (heat-config) [INFO] deploy_stack_id=overcloud-AllNodesExtraConfig-7n5jhwud7mjf/65ef44ff-36eb-4f81-9077-45acd46e6042
Oct 20 16:51:32 overcloud-controller-0.localdomain os-collect-config[23431]: [2016-10-20 16:51:32,065] (heat-config) [INFO] deploy_resource_name=MappingToUCSMDeploymentsController
Oct 20 16:51:32 overcloud-controller-0.localdomain os-collect-config[23431]: [2016-10-20 16:51:32,065] (heat-config) [INFO] deploy_signal_transport=CFN_SIGNAL
Oct 20 16:51:32 overcloud-controller-0.localdomain os-collect-config[23431]: [2016-10-20 16:51:32,065] (heat-config) [INFO] deploy_signal_id=http://10.22.110.26:8000/v1/signal/arn%3Aopenstack%3Aheat%3A%3A0174ec2ae42e4e8ea14bcb7a05f77d06%3Astacks%2Fovercloud-AllNodesExtraConfig-7n5jhwud7mjf%2F65ef44ff-36eb-4f81-9077-45acd46e6042%2Fresources%2FMappingToUCSMDeploymentsController?Timestamp=2016-10-06T15%3A16%3A28Z&SignatureMethod=HmacSHA256&AWSAccessKeyId=577da1aed2024c72ad1816425fccdb75&SignatureVersion=2&Signature=EqsZDjYdQl49s6Fx5Xd0qaTlRTO7%2FegbU2dwlBOEp%2Fc%3D
Oct 20 16:51:32 overcloud-controller-0.localdomain os-collect-config[23431]: [2016-10-20 16:51:32,065] (heat-config) [INFO] deploy_signal_verb=POST
Oct 20 16:51:32 overcloud-controller-0.localdomain os-collect-config[23431]: [2016-10-20 16:51:32,065] (heat-config) [DEBUG] Running /var/lib/heat-config/heat-config-script/62035d90-d21f-4d23-8a31-2492273577f3
Oct 20 16:51:32 overcloud-controller-0.localdomain os-collect-config[23431]: [2016-10-20 16:51:32,094] (heat-config) [INFO]
Oct 20 16:51:32 overcloud-controller-0.localdomain os-collect-config[23431]: [2016-10-20 16:51:32,094] (heat-config) [DEBUG] Traceback (most recent call last):
Oct 20 16:51:32 overcloud-controller-0.localdomain os-collect-config[23431]: File "/var/lib/heat-config/heat-config-script/62035d90-d21f-4d23-8a31-2492273577f3", line 6, in <module>
Oct 20 16:51:32 overcloud-controller-0.localdomain os-collect-config[23431]: m2h=ast.literal_eval(s)
Oct 20 16:51:32 overcloud-controller-0.localdomain os-collect-config[23431]: File "/usr/lib64/python2.7/ast.py", line 49, in literal_eval
Oct 20 16:51:32 overcloud-controller-0.localdomain os-collect-config[23431]: node_or_string = parse(node_or_string, mode='eval')
Oct 20 16:51:32 overcloud-controller-0.localdomain os-collect-config[23431]: File "/usr/lib64/python2.7/ast.py", line 37, in parse
Oct 20 16:51:32 overcloud-controller-0.localdomain os-collect-config[23431]: return compile(source, filename, mode, PyCF_ONLY_AST)
Oct 20 16:51:32 overcloud-controller-0.localdomain os-collect-config[23431]: File "<unknown>", line 1
[...]
Oct 20 16:51:32 overcloud-controller-0.localdomain os-collect-config[23431]: 0:1a': u'overcloud-compute-2.localdomain', u'26:66:84:74:6b:4d': u'overcloud-compute-3.localdomain', u'04:62:73:60:82:6f': u'overcloud-cephstorage-2.localdomain', u'04:62:73:60:82:6e': u'overclo
ud-cephstorage-2.localdomain', u'32:bf:c1:a3:67:a4': u'overcloud-compute-5.localdomain', u'a2:10:08:22:14:30': u'overcloud-controller-2.localdomain', u'00:25:b5:00:00:7e': u'overcloud-controller-1.localdomain'}
Oct 20 16:51:32 overcloud-controller-0.localdomain os-collect-config[23431]: ^
Oct 20 16:51:32 overcloud-controller-0.localdomain os-collect-config[23431]: SyntaxError: invalid syntax
Oct 20 16:51:32 overcloud-controller-0.localdomain os-collect-config[23431]: [2016-10-20 16:51:32,094] (heat-config) [ERROR] Error running /var/lib/heat-config/heat-config-script/62035d90-d21f-4d23-8a31-2492273577f3. [1]


Version-Release number of selected component (if applicable):
[stack@osp8-director ~]$ rpm -qa | grep triple
openstack-tripleo-heat-templates-kilo-0.8.14-16.el7ost.noarch
openstack-tripleo-heat-templates-liberty-2.0.0-34.el7ost.noarch
openstack-tripleo-common-2.0.0-8.el7ost.noarch
openstack-tripleo-heat-templates-2.0.0-34.el7ost.noarch
python-tripleoclient-2.0.0-3.el7ost.noarch
openstack-tripleo-0.0.8-0.2.d81bd6dgit.el7ost.noarch
openstack-tripleo-image-elements-0.9.9-6.el7ost.noarch
openstack-tripleo-puppet-elements-2.0.0-4.el7ost.noarch

Comment 1 kamil.rogon 2016-10-25 15:31:23 UTC
I have opened an upstream launchpad bug and proposed a solution which is under review.

Comment 2 kamil.rogon 2016-10-25 15:37:09 UTC
When stack is using neutron ml2 Cisco Nexus/UCSM plugin the following heat resource is included: "MappingToNexusConfig", type: OS::Heat::SoftwareConfig from /usr/share/openstack-tripleo-heat-templates/puppet/extraconfig/all_nodes/neutron-ml2-cisco-nexus-ucsm.yaml
During this resource execution it writes few files in /root directory (mac2host, controller_mappings, compute_mappings, blockstorage_mappings, objectstorage_mappings, cephstorage_mappings, nexus_config) to store temporary data. The FDs are opened in "append mode" so for each execution the same json is duplicated.

Comment 5 Gurenko Alex 2017-05-08 07:40:02 UTC
 I've ran overlcoud deploy several times with no issues, also upgrade guys are not reporting this, so I would say RC build is good.

Comment 6 errata-xmlrpc 2017-05-17 19:36:48 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2017:1245