Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit d56e87e9 authored by Andre Marcelo FERREIRA FREIRE TEIXEIRA's avatar Andre Marcelo FERREIRA FREIRE TEIXEIRA
Browse files

remove the client bugfix

parent 1da4609d
Branches EDELIVERY-13982-upgrade-libraries-and-plugins
No related tags found
No related merge requests found
...@@ -7,7 +7,6 @@ from json import dumps as json_dumps ...@@ -7,7 +7,6 @@ from json import dumps as json_dumps
from datetime import datetime from datetime import datetime
import time import time
import sys import sys
import hvac
#from library.servicenow.env_user import http_proxy #from library.servicenow.env_user import http_proxy
class Vault(object): class Vault(object):
...@@ -15,41 +14,6 @@ class Vault(object): ...@@ -15,41 +14,6 @@ class Vault(object):
def __init__(self): def __init__(self):
self.session = requests.Session() self.session = requests.Session()
self.path_change = "apps-kv/dev/" self.path_change = "apps-kv/dev/"
#self.proxies = {'http':http_proxy , 'https': http_proxy}
self.client = client = hvac.Client(url='https://sam-hcavault.cec.eu.int/',token='hvs.CAESIAf5OKUewOGeIXP2QrUSsH-vxQ_o7MEufKxlyALb02N-GikKImh2cy45cmZWamJWQ0ZJdHZGTktlM29LWW9rbloucHhUUWIQ7IaQDw',
namespace="EC/DIGIT_C4_SNET_ADMIN-ACC", verify="/etc/ssl/certs/")
#print(f"Am I authenticated? : {client.is_authenticated()}")
#kv_configuration = client.secrets.kv.read_configuration(
# mount_point='secret/apps-kv/dev',
#)
#print(f"Configuration: {kv_configuration}")
#list_secrets_result = client.secrets.kv.v2.list_secrets(path='SNOW', mount_point='secret/apps-kv/dev')
#print(f"List of Secrets: {list_secrets_result}")
#exit(1)
#secret = 'secret/apps-kv/dev/SNOW'
#mount_point, secret_path = secret.split('/', 1)
#secret_version_response = client.secrets.kv.v2.read_secret_version(
# path=secret_path,
# mount_point=mount_point
#)
#list_secrets_result = client.secrets.kv.v2.list_secrets(path='SNOW', mount_point='secret/apps-kv')
#print(f"List of Secrets: {list_secrets_result}")
#exit(1)
# need to be checked this add the data.
def getKV(self, key, url_params={}, **json_kwargs):
log.debug('GET {}'.format(key))
try:
#key_request = self.path_change + key
key_request = "v1/apps-kv/dev/SNOW"
log.debug('GET {}'.format(key_request))
read_response = self.client.secrets.kv.read_secret_version(path='SNOW', mount_point='apps-kv/dev')
password = read_response['data']['data']['password']
except Exception as error:
raise ConnectionError("Unable to make request")
return password
def getKVViaHttp(self, key): def getKVViaHttp(self, key):
url = "https://sam-hcavault.cec.eu.int/v1/"+key url = "https://sam-hcavault.cec.eu.int/v1/"+key
...@@ -60,13 +24,6 @@ class Vault(object): ...@@ -60,13 +24,6 @@ class Vault(object):
response = requests.get(url, headers=headers) response = requests.get(url, headers=headers)
return response.json() return response.json()
def createKV(self, pathK, passwordK, url_params={}, **json_kwargs):
log.debug('GET {}'.format(url))
try:
create_response = self.client.secrets.kv.v2.create_or_update_secret(path=pathK ,secret=dict(password=passwordK))
except Exception as error:
raise ConnectionError("Unable to make request")
return create_response
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment