I have two list of dicts say :
rds_detail:
[ { 'rds_name': u'emsclassicldap', 'rds_type': u'db.m3.medium'},
{ 'rds_name': u'fra01-devops-KPX', 'rds_type': u'db.t2.medium'},
{ 'rds_name': u'prodreplica', 'rds_type': u'db.t2.medium'}
]
cloudwatch_detail:
[ { 'alarm_name': u'emsclassicldap_db_connections', 'alarm_threshold': 380.0},
{ 'alarm_name': u'fra01-devops-KPX_db_connection',
'alarm_threshold': 266.0},
{ 'alarm_name': u'prodreplica_db_connections',
'alarm_threshold': 266.0},
]
The alarm_name
actually has rds_name
as its substring ;I need to actually combine these two list into one based this condition so that the final result should look like
[
{ 'rds_name': u'emsclassicldap', 'rds_type': u'db.m3.medium','alarm_name': u'classicldap_db_connections', 'alarm_threshold': 380.0}
.
.
So on
.
.
]
i am writing a simple def to combine :
def combine_rds_cloudwatch(rds_detail,cloudwatch_detail):
print rds_detail,cloudwatch_detail
for rds in rds_detail:
for alarm in cloudwatch_detail:
if ????????????
Not sure how to do so