import pprint import log_config from python_mms_api.mms_client import MMSClient from isdb.job_helpers import * from isdb.snapshot_helpers import * from private_conf import config logger = logging.getLogger("qa") if __name__ == "__main__": log_config.config(logger) parser = argparse.ArgumentParser(description="Test integrity check job") parser.add_argument(dest='group_id', type=ObjectId, help="The group id to utilize") parser.add_argument(dest='rs_id', type=str, help="The existing rsId.") args = parser.parse_args() mms_client = MMSClient(config['mms_api_base_url'], config['mms_api_username'], config['mms_api_key']) host_client = mms_client.get_host_client() # while True: # cluster_id = cluster_client.get_cluster_for_replica_set(args.group_id, args.rs_id) # if cluster_id is not None: # break # logger.info("clusterId " + str(cluster_id)) host = host_client.get_primary_host_by_group_and_rs_id( args.group_id, args.rs_id) logger.info("host {}".format(host)) host_conn = pymongo.MongoClient(host=host["hostname"], port=host["port"]) host_conn.foo.bar.insert({})
logger = logging.getLogger("qa") if __name__ == "__main__": log_config.config(logger) parser = argparse.ArgumentParser(description="Test pull restore job") parser.add_argument(dest="group_id", type=ObjectId, help="The group id to utilize") parser.add_argument(dest="hostname", type=str, help="The previously provisioned hostname.") parser.add_argument("-c", dest="cluster_id", type=ObjectId, help="Cluster to work upon. If blank, will create one.") parser.add_argument("-wt", dest="wired_tiger", action="store_const", const=True, help="Start backup as Wired Tiger.") args = parser.parse_args() mms_client = MMSClient( config['mms_api_base_url'], config['mms_api_username'], config['mms_api_key'] ) automation_client = mms_client.get_automation_client() backup_client = mms_client.get_backup_client() cluster_client = mms_client.get_cluster_client() snapshot_client = mms_client.get_snapshot_client() restore_client = mms_client.get_restore_client() host_client = mms_client.get_host_client() isdb_client = pymongo.MongoClient(host=config["mms_backup_db_host"], port=config["mms_backup_db_port"]) group_id = args.group_id hostname = args.hostname cluster_id = args.cluster_id wired_tiger = args.wired_tiger ## SET UP A BACKUP
import pprint import log_config from python_mms_api.mms_client import MMSClient from isdb.job_helpers import * from isdb.snapshot_helpers import * from private_conf import config logger = logging.getLogger("qa") if __name__ == "__main__": log_config.config(logger) parser = argparse.ArgumentParser(description="Test integrity check job") parser.add_argument(dest='group_id', type=ObjectId, help="The group id to utilize") parser.add_argument(dest='rs_id', type=str, help="The existing rsId.") args = parser.parse_args() mms_client = MMSClient( config['mms_api_base_url'], config['mms_api_username'], config['mms_api_key'] ) host_client = mms_client.get_host_client() # while True: # cluster_id = cluster_client.get_cluster_for_replica_set(args.group_id, args.rs_id) # if cluster_id is not None: # break # logger.info("clusterId " + str(cluster_id)) host = host_client.get_primary_host_by_group_and_rs_id(args.group_id, args.rs_id) logger.info("host {}".format(host)) host_conn = pymongo.MongoClient(host=host["hostname"], port=host["port"]) host_conn.foo.bar.insert({})
last_integrity_check_ms, 600 * 1000): return caching_enabled == desired_caching return False if __name__ == "__main__": log_config.config(logger) parser = argparse.ArgumentParser(description="Test integrity check job") parser.add_argument(dest='group_id', type=ObjectId, help="The group id to utilize") parser.add_argument(dest='hostname', type=str, help="The previously provisioned hostname.") args = parser.parse_args() mms_client = MMSClient(config['mms_api_base_url'], config['mms_api_username'], config['mms_api_key']) automation_client = mms_client.get_automation_client() backup_client = mms_client.get_backup_client() cluster_client = mms_client.get_cluster_client() isdb_client = pymongo.MongoClient(host=config["mms_backup_db_host"], port=config["mms_backup_db_port"]) # Provision machines, and set up hosts before this rs_id = add_replica_set_to_group(automation_client, args.hostname, args.group_id, run_id) logger.info("rsId " + rs_id) block_on_automation_finishing(automation_client, args.group_id) cluster_id = get_cluster_id_for_rs(cluster_client, args.group_id, rs_id) logger.info("clusterId " + str(cluster_id)) time.sleep(20) # give it a moment for le pings. success = start_backup(backup_client, args.group_id, cluster_id)
from python_mms_api.mms_client import MMSClient from automation_helper import * import log_config from private_conf import config run_id = random.randint(0,1000) logger = logging.getLogger("qa.scripts.cluster_test") logger.setLevel(logging.DEBUG) if __name__ == "__main__": log_config.config(logger) parser = argparse.ArgumentParser(description="Test lib for createing cluster configs.") parser.add_argument(dest='group_id', type=ObjectId, help="The group id to utilize") parser.add_argument(dest='hostname', type=str, help="The previously provisioned hostname.") args = parser.parse_args() mms_client = MMSClient( config['mms_api_base_url'], config['mms_api_username'], config['mms_api_key'] ) automation_client = mms_client.get_automation_client() old_config = automation_client.get_config(args.group_id) add_new_cluster(old_config, "cluster_test", args.hostname, 3, 3, run_id) # logger.info(pprint.pformat(old_config)) automation_client.update_config(args.group_id, old_config) while automation_client.automation_working(args.group_id): time.sleep(10) logger.debug("polling automation")