Skip to content

Instantly share code, notes, and snippets.

@sdeaton2
sdeaton2 / dumpsecgrouprules.sh
Created January 22, 2014 16:33
Dump security group rules from nova-network in an outputted format that can be copy/pasted to create the same rules in neutron.
#!/bin/bash
group_info_field_count=5;
TENANT=$OS_TENANT_NAME;
TID=$(keystone tenant-list | awk "/${TENANT}/{print \$2}")
sec_group_names=$(mysql -BNe "select name from nova.security_groups where project_id = \"${TID}\" and deleted = 0;");
sec_group_name_count=$(mysql -BNe "select count(name) from nova.security_groups where project_id = \"${TID}\" and deleted = 0;");
echo "${sec_group_name_count} total security groups for tenant ${TID}";
for sec_group in ${sec_group_names}; do
@sdeaton2
sdeaton2 / colors.sh
Created January 16, 2014 06:12
A simple test script to display colors available as ANSI escape sequences - both foreground and background.
#!/bin/bash
#
# This is slightly altered from the original which is found here:
# http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html
#
# Each line is the color code of one foreground color, out of 17
# (default + 16 escapes), followed by a test use of that color
# on all nine background colors (default + 8 escapes).
#