Esempio n. 1
0
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)
Esempio n. 2
0
    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)
Esempio n. 3
0
    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)
Esempio n. 4
0
    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)
Esempio n. 5
0
    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)
Esempio n. 6
0
 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))
Esempio n. 7
0
 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))
Esempio n. 8
0
 def _write_buffer(self):
     with open(self.filename, 'w') as fh:
         yaml.dump(self.buffer, fh)
Esempio n. 9
0
def write_config(config):
    with open(CONFIG_FILE_NAME, "w") as config_file:
        yaml.dump(config, config_file)
Esempio n. 10
0
def print_status_file(status_file):
    yaml.dump(status_file, sys.stdout)
Esempio n. 11
0
def write_config(config):
    with open(CONFIG_FILE_NAME, "w") as config_file:
        yaml.dump(config, config_file)
Esempio n. 12
0
File: manager.py Progetto: Yelp/Tron
def write(path, content):
    with open(path, 'w') as fh:
        yaml.dump(content, fh)
Esempio n. 13
0
 def _write_buffer(self):
     with open(self.filename, 'w') as fh:
         yaml.dump(self.buffer, fh)
Esempio n. 14
0
def write(path, content):
    with open(path, 'w') as fh:
        yaml.dump(content, fh)