def get_current_config(): ensure_bombardier_config_dir() if os.path.isfile(CONFIG_FILE): current_config = yaml_load(open(CONFIG_FILE).read()) if type(current_config) == type({}): return current_config else: return None
def get_manifest_data(file_name, logger): manifest_path = make_path(get_base_path(file_name), MANIFEST_FILE) #manifest_path = make_path(MANIFEST_FILE) logger.info("manifest_path: %s" % (manifest_path)) md5_dict = {} if os.path.isfile(manifest_path): md5_string = open(manifest_path, 'r').read() md5_dict = yaml_load(md5_string) if type(md5_dict) != type({}): logger.info("NOT A DICTIONARY") md5_dict = {} else: logger.info("FILE DOESN'T EXIST") return md5_dict
def _prepare_restore(self, obj, restore_path): """ Command to deal with setting up the environment prior to a restore action obj -- package object which owns methods for restoring, etc. restore_path -- place where restore files have been dropped """ if hasattr(obj, "pre_restore_cmd"): pre_backup_cmd = obj.pre_backup_cmd status = self._find_cmd(obj.pre_restore_cmd) if status != OK: erstr = "%s: restore FAILED because %s failed." Logger.error(erstr % (self.full_name, pre_backup_cmd)) return FAIL backup_data = yaml_load(open(make_path(restore_path, "backup_info.yml")).read()) for backup_target in backup_data: if backup_target.startswith("__"): continue md5_data = backup_data[backup_target].get("md5", {}) backup_file_name = backup_data[backup_target].get("backup_file", '') if not md5_data or not backup_file_name: Logger.error("Corrupted backup data for %s, aborting." % (backup_target)) return FAIL source_file = make_path(restore_path, rpartition(backup_target, os.path.sep)[0][1:], backup_file_name) destination_file = make_path(restore_path, backup_target[1:]) Logger.debug("=================================") Logger.debug("backup_target: %s..." % (backup_target)) Logger.debug("current directory: %s" % (restore_path)) Logger.debug("backup_file_name: %s..." % (backup_file_name)) Logger.debug("destination_file: %s..." % (destination_file)) Logger.debug("source_file: %s" % (source_file)) Logger.debug("=================================") if not os.path.isfile(source_file): Logger.error("Restore file %s does not exist, aborting" % (source_file)) return FAIL rfp = ReversePluggableFileProcessor(source_file, destination_file, md5_data, Logger) rfp.process_all()
billData = {"system": {"serviceuser": "******"}, "include": ["frank"]} frankData = {"system": {"servicepasswd": "foomanchoo"}} indexData = {"testsystem": { "contact": {"ownedclients": ["peter"]}, "hardware": {"client": ["testhw"]}, "project": {"clients":["bombardier"]}} } bombardierProjectData = yaml_load('{"start": "2005-07-22", "contactid": '\ '"bbutterfield", "clients": ["kwmge01", "kwmge02", "kwmqadb01", '\ '"kwmqadb03", "kwmqadkey01", "kwmqaweb01", "kwmqaweb02", '\ '"kwmqaweb03", "kwmqawebtest", "uspsupernet"], "data": '\ '{"configItem": ["foo", "bar"]}, "finish": "2005-10-30"}') testhw = yaml_load('{"data": {"configItem2": ["spam", "eggs"]}, '\ '"description": "secure net for stuff"}') repodata1 = {"localhost": {"address": "http://127.0.0.1", "networks": ["0.0.0.0/0"], "username": "******", "password": "******"}} repodata2 = {"QA": {"address": "http://172.77.51.57", "username": "******", "password": "******", "proxy": {"address": "None",