def validate_virtuoso_nyc_accounts(hostname, suffix): my_logger.debug("In validate_virtuoso_nyc_accounts()... ") print "hostname: %s" % hostname if suffix == "source": my_logger.debug("Collecting ttSettings for %s as source" % hostname) dict_ttSettings = dict_source_ttSettings #print dict_ttSettings elif suffix == "target": my_logger.debug("Collecting ttSettings for %s as target" % hostname) dict_ttSettings = dict_target_ttSettings h_subname = dict_ttSettings["Environment_Name"] #print "h_subname: %s"%h_subname h_name = "virtuoso." + h_subname #print "h_name:%s"%h_name if hostname == h_name: username = dict_ttSettings["ec2"]["username"] #print"username: %s"%username my_logger.debug("Validating accounts for host: %s and user: %s" % (hostname, username)) count_users = dict_ttSettings["virtuoso"]["users"] #print count_users #if (count_users == "None"): print "None" #else: print "Not None" if not (count_users == "None"): #print "Count_users not None" for k, v in dict_ttSettings["virtuoso"]["users"].items(): v_username = v["username"] #print "v_username: %s"%v_username v_password = v["password"] #print "v_password: %s"%v_password host_chk_cmd = "/usr/bin/isql-vt -S 1111 -U %s -P %s \"EXEC = CONNECT;\"" % ( v_username, v_password) #print "host_chk_cmd:%s"%host_chk_cmd try: v_nyc_hostname_check(username, hostname, host_chk_cmd) except: my_logger.error( "User:%s validation for Host: %s failed. Exiting!" % (username, hostname)) sys.exit( "User:%s validation for Host: %s failed. Exiting!" % (username, hostname)) my_logger.debug( "User: %s validated for Host: %s, Account_type: %s" % (username, hostname, k)) else: my_logger.error("Hostname: %s not found. Exiting!" % hostname) sys.exit("Hostname: %s not found. Exiting!" % hostname)
def validate_virtuoso_nyc_accounts(hostname, suffix): my_logger.debug("In validate_virtuoso_nyc_accounts()... ") print "hostname: %s"%hostname if suffix == "source": my_logger.debug("Collecting ttSettings for %s as source"%hostname ) dict_ttSettings = dict_source_ttSettings #print dict_ttSettings elif suffix == "target": my_logger.debug("Collecting ttSettings for %s as target"%hostname ) dict_ttSettings = dict_target_ttSettings h_subname = dict_ttSettings["Environment_Name"] #print "h_subname: %s"%h_subname h_name = "virtuoso." + h_subname #print "h_name:%s"%h_name if hostname == h_name: username = dict_ttSettings["ec2"]["username"] #print"username: %s"%username my_logger.debug("Validating accounts for host: %s and user: %s"%(hostname, username)) count_users = dict_ttSettings["virtuoso"]["users"] #print count_users #if (count_users == "None"): print "None" #else: print "Not None" if not (count_users == "None"): #print "Count_users not None" for k,v in dict_ttSettings["virtuoso"]["users"].items(): v_username = v["username"] #print "v_username: %s"%v_username v_password = v["password"] #print "v_password: %s"%v_password host_chk_cmd = "/usr/bin/isql-vt -S 1111 -U %s -P %s \"EXEC = CONNECT;\"" %(v_username, v_password) #print "host_chk_cmd:%s"%host_chk_cmd try: v_nyc_hostname_check(username, hostname, host_chk_cmd) except: my_logger.error("User:%s validation for Host: %s failed. Exiting!"%(username, hostname)) sys.exit("User:%s validation for Host: %s failed. Exiting!"%(username, hostname)) my_logger.debug("User: %s validated for Host: %s, Account_type: %s"%(username, hostname,k)) else: my_logger.error("Hostname: %s not found. Exiting!"%hostname) sys.exit("Hostname: %s not found. Exiting!"%hostname)
def validate_virtuoso_accounts(dict_ttSettings, hostname, suffix): my_logger.debug("In validate_virtuoso_aws_accounts()... ") print "hostname: %s"%hostname """ if suffix == "source": my_logger.debug("Collecting ttSettings for %s as source"%hostname ) dict_ttSettings = dict_source_ttSettings #print dict_ttSettings elif suffix == "target": my_logger.debug("Collecting ttSettings for %s as target"%hostname ) dict_ttSettings = dict_target_ttSettings """ h_subname = dict_ttSettings["Environment_Name"] #print "h_subname: %s"%h_subname h_name = "virtuoso." + h_subname #print "h_name:%s"%h_name if hostname == h_name: if "aws.3top.com" in hostname: username = dict_ttSettings["ec2"]["username"] elif "nyc.3top.com" in hostname: username = raw_input("Enter username for the host: %s: "%hostname) #print"username: %s"%username my_logger.debug("Validating accounts for host: %s and user: %s"%(hostname, username)) count_users = dict_ttSettings["virtuoso"]["users"] #print count_users #if (count_users == "None"): print "None" #else: print "Not None" if not (count_users == "None"): #print "Count_users not None" for k,v in dict_ttSettings["virtuoso"]["users"].items(): v_username = v["username"] #print "v_username: %s"%v_username v_password = v["password"] #print "v_password: %s"%v_password #host_chk_cmd = "/usr/bin/isql-vt -S 1111 -U %s -P %s \"EXEC = CONNECT;\"" %(v_username, v_password) host_chk_cmd = "/usr/local/virtuoso-opensource/bin/isql -S 1111 -U %s -P %s \"EXEC = CONNECT;\"" %(v_username, v_password) #print "host_chk_cmd:%s"%host_chk_cmd if "aws.3top.com" in hostname: keyfile=dict_ttSettings["ec2"]["cert_private_key"] try: v_aws_hostname_check(username, hostname, keyfile, host_chk_cmd) except: my_logger.error("User:%s validation for Host: %s failed. Exiting!"%(username, hostname)) sys.exit("User:%s validation for Host: %s failed. Exiting!"%(username, hostname)) elif "nyc.3top.com" in hostname: try: v_nyc_hostname_check(username, hostname, host_chk_cmd) except: my_logger.error("User:%s validation for Host: %s failed. Exiting!"%(username, hostname)) sys.exit("User:%s validation for Host: %s failed. Exiting!"%(username, hostname)) my_logger.debug("User: %s validated for Host: %s, Account_type: %s"%(username, hostname,k)) else: my_logger.error("Hostname: %s not found. Exiting!"%hostname) sys.exit("Hostname: %s not found. Exiting!"%hostname)
def validate_virtuoso_accounts(dict_ttSettings, hostname, suffix): my_logger.debug("In validate_virtuoso_aws_accounts()... ") print "hostname: %s" % hostname """ if suffix == "source": my_logger.debug("Collecting ttSettings for %s as source"%hostname ) dict_ttSettings = dict_source_ttSettings #print dict_ttSettings elif suffix == "target": my_logger.debug("Collecting ttSettings for %s as target"%hostname ) dict_ttSettings = dict_target_ttSettings """ h_subname = dict_ttSettings["Environment_Name"] #print "h_subname: %s"%h_subname h_name = "virtuoso." + h_subname #print "h_name:%s"%h_name if hostname == h_name: if "aws.3top.com" in hostname: username = dict_ttSettings["ec2"]["username"] elif "nyc.3top.com" in hostname: username = raw_input("Enter username for the host: %s: " % hostname) #print"username: %s"%username my_logger.debug("Validating accounts for host: %s and user: %s" % (hostname, username)) count_users = dict_ttSettings["virtuoso"]["users"] #print count_users #if (count_users == "None"): print "None" #else: print "Not None" if not (count_users == "None"): #print "Count_users not None" for k, v in dict_ttSettings["virtuoso"]["users"].items(): v_username = v["username"] #print "v_username: %s"%v_username v_password = v["password"] #print "v_password: %s"%v_password #host_chk_cmd = "/usr/bin/isql-vt -S 1111 -U %s -P %s \"EXEC = CONNECT;\"" %(v_username, v_password) host_chk_cmd = "/usr/local/virtuoso-opensource/bin/isql -S 1111 -U %s -P %s \"EXEC = CONNECT;\"" % ( v_username, v_password) #print "host_chk_cmd:%s"%host_chk_cmd if "aws.3top.com" in hostname: keyfile = dict_ttSettings["ec2"]["cert_private_key"] try: v_aws_hostname_check(username, hostname, keyfile, host_chk_cmd) except: my_logger.error( "User:%s validation for Host: %s failed. Exiting!" % (username, hostname)) sys.exit( "User:%s validation for Host: %s failed. Exiting!" % (username, hostname)) elif "nyc.3top.com" in hostname: try: v_nyc_hostname_check(username, hostname, host_chk_cmd) except: my_logger.error( "User:%s validation for Host: %s failed. Exiting!" % (username, hostname)) sys.exit( "User:%s validation for Host: %s failed. Exiting!" % (username, hostname)) my_logger.debug( "User: %s validated for Host: %s, Account_type: %s" % (username, hostname, k)) else: my_logger.error("Hostname: %s not found. Exiting!" % hostname) sys.exit("Hostname: %s not found. Exiting!" % hostname)