def main(): args = parse_args() for filename in os.listdir(args.src): print('filename = {}'.format(filename)) filepath = os.path.join(args.src, filename) if os.path.isfile(filepath) and filepath.endswith(".yaml"): with open(filepath, "r") as f: config = yaml.load(f) if filename == "MASTER.yaml": for key in list(config): if key != 'jobs': del config[key] jobs = config.get("jobs", []) if jobs is not None: for job in jobs: job['node'] = "localhost" if 'monitoring' in job: del job['monitoring'] for action in job.get("actions", []): action['command'] = 'sleep 10s' if "node" in action: action['node'] = "localhost" for i in range(args.multiple): out_filepath = os.path.join( args.dest, 'load_testing_' + str(i) + '-' + filename) with open(out_filepath, 'w') as outf: yaml.dump(config, outf, default_flow_style=False)
def test_restore_missing_type_key(self): with open(self.filename, 'w') as fh: yaml.dump(self.test_data, fh) keys = [yamlstore.YamlKey('seven', 'a')] state_data = self.store.restore(keys) assert_equal(self.store.buffer, self.test_data) assert_equal({}, state_data)
def test_restore_missing_type_key(self): with open(self.filename, 'w') as fh: yaml.dump(self.test_data, fh) keys = [yamlstore.YamlKey('seven', 'a')] state_data = self.store.restore(keys) assert_equal(self.store.buffer, self.test_data) assert_equal({}, state_data)
def test_restore(self): with open(self.filename, 'w') as fh: yaml.dump(self.test_data, fh) keys = [yamlstore.YamlKey('one', 'a'), yamlstore.YamlKey('three', 'c')] state_data = self.store.restore(keys) assert_equal(self.store.buffer, self.test_data) expected = {keys[0]: 1, keys[1]: 3} assert_equal(expected, state_data)
def test_restore(self): with open(self.filename, 'w') as fh: yaml.dump(self.test_data, fh) keys = [yamlstore.YamlKey('one', 'a'), yamlstore.YamlKey('three', 'c')] state_data = self.store.restore(keys) assert_equal(self.store.buffer, self.test_data) expected = {keys[0]: 1, keys[1]: 3} assert_equal(expected, state_data)
def test_read_raw_config(self): name = 'name' path = os.path.join(self.temp_dir, name) manager.write(path, self.content) self.manifest.get_file_name.return_value = path config = self.manager.read_raw_config(name) assert_equal(config, yaml.dump(self.content))
def test_read_raw_config(self): name = 'name' path = os.path.join(self.temp_dir, name) manager.write(path, self.content) self.manifest.get_file_name.return_value = path config = self.manager.read_raw_config(name) assert_equal(config, yaml.dump(self.content))
def _write_buffer(self): with open(self.filename, 'w') as fh: yaml.dump(self.buffer, fh)
def write_config(config): with open(CONFIG_FILE_NAME, "w") as config_file: yaml.dump(config, config_file)
def print_status_file(status_file): yaml.dump(status_file, sys.stdout)
def write_config(config): with open(CONFIG_FILE_NAME, "w") as config_file: yaml.dump(config, config_file)
def write(path, content): with open(path, 'w') as fh: yaml.dump(content, fh)
def _write_buffer(self): with open(self.filename, 'w') as fh: yaml.dump(self.buffer, fh)
def write(path, content): with open(path, 'w') as fh: yaml.dump(content, fh)