9 exec_cmd = common.exec_cmd
12 check_file_exists = common.check_file_exists
15 class ConfigureSettings(object):
17 def __init__(self, yaml_config_dir, env_id, dea):
18 self.yaml_config_dir = yaml_config_dir
22 def download_settings(self):
23 LOG.debug('Download settings for environment %s\n' % self.env_id)
24 r, c = exec_cmd('fuel settings --env %s --download --dir %s'
25 % (self.env_id, self.yaml_config_dir))
27 def upload_settings(self):
28 LOG.debug('Upload settings for environment %s\n' % self.env_id)
29 r, c = exec_cmd('fuel settings --env %s --upload --dir %s'
30 % (self.env_id, self.yaml_config_dir))
32 def config_settings(self):
33 LOG.debug('Configure settings\n')
34 self.download_settings()
35 self.modify_settings()
36 self.upload_settings()
38 def modify_settings(self):
39 LOG.debug('Modify settings for environment %s\n' % self.env_id)
40 settings_yaml = (self.yaml_config_dir + '/settings_%s.yaml'
42 check_file_exists(settings_yaml)
44 settings = self.dea.get_settings()
46 with io.open(settings_yaml, 'w') as stream:
47 yaml.dump(settings, stream, default_flow_style=False)