Пример #1
0
def remove_from_env(env_id, name):
    """Removes a repository with the given name from the env settings"""
    env_obj = Environment(env_id)
    settings = env_obj.get_settings_data()

    old_repos = settings['editable']['repo_setup']['repos']['value']
    new_repos = [x for x in old_repos if x['name'] != name]
    settings['editable']['repo_setup']['repos']['value'] = new_repos

    env_obj.set_settings_data(settings)
#    By [email protected]

import yaml
import sys, os
import logging
from fuelclient.objects import Environment
from subprocess import call

try:
    cluster_id = sys.argv[1]
except Exception:
    logging.warning('Provide cluster id as first parameter')
    sys.exit(1)

env = Environment(cluster_id)
data = env.get_settings_data()

try:
    tor_configurations = data['editable']['contrail']['metadata']['versions'][
        0]['tor_agents_configurations']['value']
except Exception:
    logging.warning('Cannot read tor agents configuration')
    sys.exit(2)

certificate_path = '/var/lib/fuel/certificates'

if not os.path.exists(certificate_path):
    os.makedirs(certificate_path)

directory = certificate_path + '/' + cluster_id + '/'