def c_export_juju_env(name, filename): """export juju environment to given yaml file """ jujuenv = JujuEnvironment(name) environment = {} environment['environment'] = jujuenv.return_environment() with open(filename, 'w+') as o_file: o_file.write(yaml.dump(environment, default_flow_style=False))
def c_export(name, path): """Export Tengu with given NAME""" jujuenv = JujuEnvironment(name) config = jujuenv.return_environment() files = { "tengu-env-conf": env_conf_path(name), } env_conf = init_environment_config(name) env = PROVIDER.get(env_conf) files.update(env.files) for f_name, f_path in files.iteritems(): with open(f_path, 'r') as f_file: config[f_name] = base64.b64encode(f_file.read()) config['emulab-project-name'] = global_conf['project-name'] export = {str(name): config} with open(path, 'w+') as outfile: outfile.write(yaml.dump(export))
def c_export_model(model, path): """Export the config of the model with given NAME""" jujuenv = JujuEnvironment(model) config = jujuenv.return_environment() files = { "tengu-env-conf": env_conf_path(model), } env_conf = init_environment_config(model) env = get_provider(env_conf).get(env_conf) files.update(env.files) for f_name, f_path in files.iteritems(): with open(f_path, 'r') as f_file: config[f_name] = base64.b64encode(f_file.read()) config['emulab-project-name'] = GLOBAL_CONF['project-name'] export = {str(model): config} with open(path, 'w+') as outfile: outfile.write(yaml.dump(export))
def c_export(name, path): """Export Tengu with given NAME""" jujuenv = JujuEnvironment(name) config = jujuenv.return_environment() files = { "tengu-env-conf" : env_conf_path(name), } env_conf = init_environment_config(name) env = PROVIDER.get(env_conf) files.update(env.files) for f_name, f_path in files.iteritems(): with open(f_path, 'r') as f_file: config[f_name] = base64.b64encode(f_file.read()) config['emulab-project-name'] = global_conf['project-name'] export = { str(name) : config } with open(path, 'w+') as outfile: outfile.write(yaml.dump(export))