Skip to content

Instantly share code, notes, and snippets.

@alexharv074
Last active June 27, 2019 13:03
Show Gist options
  • Save alexharv074/42fd3ecbdfd7852e427545d8de5ff8d7 to your computer and use it in GitHub Desktop.
Save alexharv074/42fd3ecbdfd7852e427545d8de5ff8d7 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import pprint
def merge(x,y):
return dict(x, **y)
ebs_block_device = [{
'device_name': "/dev/sdg",
'volume_size': 5,
'volume_type': "gp2",
'delete_on_termination': False,
},
{
'device_name': "/dev/sdh",
'volume_size': 5,
'volume_type': "gp2",
'delete_on_termination': False,
}]
mount_point = ['/data','/home']
merged = [
merge(x, {'mount_point': mount_point[index]})
for index, x in enumerate(ebs_block_device)
]
pp = pprint.PrettyPrinter()
pp.pprint(merged)
# Output:
#
# [{'delete_on_termination': False,
# 'device_name': '/dev/sdg',
# 'mount_point': '/data',
# 'volume_size': 5,
# 'volume_type': 'gp2'},
# {'delete_on_termination': False,
# 'device_name': '/dev/sdh',
# 'mount_point': '/home',
# 'volume_size': 5,
# 'volume_type': 'gp2'}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment