Compare commits

...

7 Commits

2 changed files with 9 additions and 5 deletions

2
Jenkinsfile vendored
View File

@ -2,7 +2,7 @@ pipeline {
agent { label 'agent_smith' } agent { label 'agent_smith' }
stages { stages {
stage('recreate > build > reun container') { stage('recreate > build > run container') {
steps { steps {
sh "docker-compose up -d --force-recreate --build parse_saby" sh "docker-compose up -d --force-recreate --build parse_saby"
} }

View File

@ -10,7 +10,6 @@ class SimpleDB:
def __init__(self): def __init__(self):
self._create_db_pool_from_vault() self._create_db_pool_from_vault()
self.pool self.pool
#init_oracle_client() Если работает нужно убрать!
def _handle_vault_exception(self, e: Exception, message: str): def _handle_vault_exception(self, e: Exception, message: str):
""" """
@ -37,22 +36,27 @@ class SimpleDB:
Подключение к Vault и создание пула соеденения. Подключение к Vault и создание пула соеденения.
""" """
try: try:
# Подключение к Vault # Подключение к Vault
client = hvac.Client( client = hvac.Client(
url='https://vlt.dataekb.ru:8222', url='https://vlt.dataekb.ru:8222',
token=environ.get('VAULT_TOKEN'), token=environ.get('VAULT_TOKEN'),
) )
except Exception as e: except Exception as e:
self._handle_vault_exception(e, "Ошибка при создание покдлючения c Vault") self._handle_vault_exception(e, "Ошибка при создание покдлючения c Vault")
# Проверка авторизации в Vault
if not client.is_authenticated():
raise Exception("Vault authentication failed")
try: try:
# Чтение секретов из Vault # Чтение секретов из Vault
secret_read_response = client.secrets.kv.v2.read_secret_version( secret_read_response = client.secrets.kv.v2.read_secret_version(
path='oracledb', path='oracledb',
mount_point='kv' mount_point='kv'
) )
except Exception as e: except Exception as e:
self._handle_vault_exception(e, "Ошибка чтение скретов из Vault") self._handle_vault_exception(e, "Ошибка чтение скретов из Vault")
try: try:
# Создаем пул соединений # Создаем пул соединений
self.pool = create_pool( self.pool = create_pool(