Beispiel #1
0
    def create_generated_yml(self):
        generated_variables = {
            'deploy_env':
            self.meta_config.deploy_env,
            'env_monitoring_id':
            self.meta_config.env_monitoring_id,
            'dev_users':
            self.users_config.dev_users.to_json(),
            'authorized_keys_dir':
            '{}/'.format(os.path.realpath(self.paths.authorized_keys_dir)),
            'known_hosts_file':
            self.paths.known_hosts,
            'commcarehq_repository':
            self.fab_settings_config.code_repo,
            'ES_SETTINGS':
            self.elasticsearch_config.settings.to_json(),
            'py3_include_venv':
            self.fab_settings_config.py3_include_venv,
        }
        generated_variables.update(
            self.app_processes_config.to_generated_variables())
        generated_variables.update(
            self.postgresql_config.to_generated_variables(self))
        generated_variables.update(self.proxy_config.to_generated_variables())
        generated_variables.update(constants.to_json())

        if os.path.exists(self.paths.dimagi_key_store_vault):
            generated_variables.update(
                {'keystore_file': self.paths.dimagi_key_store_vault})

        with open(self.paths.generated_yml, 'w') as f:
            f.write(yaml.safe_dump(generated_variables))
Beispiel #2
0
    def create_generated_yml(self):
        generated_variables = {
            'deploy_env': self.meta_config.deploy_env,
            'env_monitoring_id': self.meta_config.env_monitoring_id,
            'dev_users': self.users_config.dev_users.to_json(),
            'authorized_keys_dir': '{}/'.format(os.path.realpath(self.paths.authorized_keys_dir)),
            'known_hosts_file': self.paths.known_hosts,
            'commcarehq_repository': (
                self.fab_settings_config.code_repo
                if not self.meta_config.bare_non_cchq_environment else {}
            ),
            'ES_SETTINGS': (
                self.elasticsearch_config.settings.to_json()
                if not self.meta_config.bare_non_cchq_environment else {}
            ),
            'new_release_name': datetime.utcnow().strftime('%Y-%m-%d_%H.%M'),
        }
        if not self.meta_config.bare_non_cchq_environment:
            generated_variables.update(self.app_processes_config.to_generated_variables())
            generated_variables.update(self.postgresql_config.to_generated_variables(self))
            generated_variables.update(self.proxy_config.to_generated_variables())
        generated_variables.update(constants.to_json())

        if os.path.exists(self.paths.dimagi_key_store_vault):
            generated_variables.update({'keystore_file': self.paths.dimagi_key_store_vault})

        with open(self.paths.generated_yml, 'w') as f:
            f.write(yaml.safe_dump(generated_variables))
Beispiel #3
0
    def create_generated_yml(self):
        generated_variables = {
            'deploy_env':
            self.meta_config.deploy_env,
            'env_monitoring_id':
            self.meta_config.env_monitoring_id,
            'dev_users':
            self.users_config.dev_users.to_json(),
            'authorized_keys_dir':
            '{}/'.format(os.path.realpath(self.paths.authorized_keys_dir)),
            'known_hosts_file':
            self.paths.known_hosts,
            'env_files_dir':
            self.paths.files_dir,
            'commcarehq_repository':
            (self.fab_settings_config.code_repo
             if not self.meta_config.bare_non_cchq_environment else {}),
            'ES_SETTINGS':
            (self.elasticsearch_config.settings.to_json()
             if not self.meta_config.bare_non_cchq_environment else {}),
            'new_release_name':
            self.new_release_name(),
            'git_repositories': [
                repo.to_generated_variables()
                for repo in self.meta_config.git_repositories
            ],
            'deploy_keys':
            dict(self.meta_config.deploy_keys.items()),
        }
        if not self.meta_config.bare_non_cchq_environment:
            generated_variables.update(
                self.app_processes_config.to_generated_variables())
            generated_variables.update(
                self.postgresql_config.to_generated_variables(self))
            generated_variables.update(
                self.proxy_config.to_generated_variables())
            if self.prometheus_config:
                generated_variables.update(
                    self.prometheus_config.to_generated_variables())

        generated_variables.update(constants.to_json())

        if os.path.exists(self.paths.dimagi_key_store_vault):
            generated_variables.update(
                {'keystore_file': self.paths.dimagi_key_store_vault})

        generated_variables.update(
            self.secrets_backend.get_generated_variables())

        with open(self.paths.generated_yml, 'w', encoding='utf-8') as f:
            f.write(yaml.dump(generated_variables,
                              Dumper=PreserveUnsafeDumper))
Beispiel #4
0
    def create_generated_yml(self):
        self._run_last_minute_checks()
        generated_variables = {
            'deploy_env': self.meta_config.deploy_env,
            'env_monitoring_id': self.meta_config.env_monitoring_id,
            'dev_users': self.users_config.dev_users.to_json(),
            'authorized_keys_dir':
            '{}/'.format(self.paths.authorized_keys_dir),
            'known_hosts_file': self.paths.known_hosts,
        }
        generated_variables.update(
            self.app_processes_config.to_generated_variables())
        generated_variables.update(
            self.postgresql_config.to_generated_variables())
        generated_variables.update(self.proxy_config.to_generated_variables())
        generated_variables.update(constants.to_json())

        with open(self.paths.generated_yml, 'w') as f:
            f.write(yaml.safe_dump(generated_variables))
Beispiel #5
0
    def create_generated_yml(self):
        self._run_last_minute_checks()
        generated_variables = {
            'deploy_env': self.meta_config.deploy_env,
            'env_monitoring_id': self.meta_config.env_monitoring_id,
            'dev_users': self.users_config.dev_users.to_json(),
            'authorized_keys_dir': '{}/'.format(os.path.realpath(self.paths.authorized_keys_dir)),
            'known_hosts_file': self.paths.known_hosts,
            'commcarehq_repository': self.fab_settings_config.code_repo,
            'ES_SETTINGS': self.elasticsearch_config.settings.to_json(),
            'py3_include_venv': self.fab_settings_config.py3_include_venv,
        }
        generated_variables.update(self.app_processes_config.to_generated_variables())
        generated_variables.update(self.postgresql_config.to_generated_variables())
        generated_variables.update(self.proxy_config.to_generated_variables())
        generated_variables.update(constants.to_json())

        if os.path.exists(self.paths.dimagi_key_store_vault):
            generated_variables.update({'keystore_file': self.paths.dimagi_key_store_vault})

        with open(self.paths.generated_yml, 'w') as f:
            f.write(yaml.safe_dump(generated_variables))