-
-
Save epcim/79e9119c8968251040a5c0a80f787ae7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import getopt | |
import pycassa | |
import subprocess | |
import sys | |
from pycassa.pool import ConnectionPool | |
from pycassa.columnfamily import ColumnFamily | |
def query_typename(column, typename): | |
data = column.get(typename.replace('-', '_')) | |
for item in data: | |
(name, uuid) = item.rsplit(':', 1) | |
print name, uuid | |
def usage(): | |
print 'vnc_query typename' | |
def main(argv): | |
pool = ConnectionPool('config_db_uuid') | |
column = ColumnFamily(pool, 'obj_fq_name_table') | |
if len(argv) != 1: | |
usage() | |
sys.exit(1) | |
query_typename(column, argv[0]) | |
if __name__ == '__main__': | |
main(sys.argv[1:]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment