"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "buildbot/secrets/providers/vault.py" between
buildbot-3.0.2.tar.gz and buildbot-3.1.0.tar.gz

About: Buildbot is a continuous integration testing framework (Python-based). It supports also automation of complex build systems, application deployment, and management of sophisticated software-release processes.

vault.py  (buildbot-3.0.2):vault.py  (buildbot-3.1.0)
skipping to change at line 61 skipping to change at line 61
if vaultServer.endswith('/'): if vaultServer.endswith('/'):
vaultServer = vaultServer[:-1] vaultServer = vaultServer[:-1]
self._http = yield httpclientservice.HTTPClientService.getService( self._http = yield httpclientservice.HTTPClientService.getService(
self.master, self.vaultServer, headers={'X-Vault-Token': self.vaultT oken}) self.master, self.vaultServer, headers={'X-Vault-Token': self.vaultT oken})
@defer.inlineCallbacks @defer.inlineCallbacks
def get(self, entry): def get(self, entry):
""" """
get the value from vault secret backend get the value from vault secret backend
""" """
parts = entry.split('/', maxsplit=1) parts = entry.rsplit('/', maxsplit=1)
name = parts[0] name = parts[0]
if len(parts) > 1: if len(parts) > 1:
key = parts[1] key = parts[1]
else: else:
key = 'value' key = 'value'
if self.apiVersion == 1: if self.apiVersion == 1:
path = self.secretsmount + '/' + name path = self.secretsmount + '/' + name
else: else:
path = self.secretsmount + '/data/' + name path = self.secretsmount + '/data/' + name
# note that the HTTP path contains v1 for both versions of the key-value # note that the HTTP path contains v1 for both versions of the key-value
# secret engine. Different versions of the key-value engine are # secret engine. Different versions of the key-value engine are
# effectively separate secret engines in vault, with the same base HTTP # effectively separate secret engines in vault, with the same base HTTP
# API, but with different paths within it. # API, but with different paths within it.
proj = yield self._http.get('/v1/{0}'.format(path)) proj = yield self._http.get(f"/v1/{path}")
code = yield proj.code code = yield proj.code
if code != 200: if code != 200:
raise KeyError(("The secret {} does not exist in Vault provider: req uest" raise KeyError(("The secret {} does not exist in Vault provider: req uest"
" return code: {}.").format(entry, code)) " return code: {}.").format(entry, code))
json = yield proj.json() json = yield proj.json()
if self.apiVersion == 1: if self.apiVersion == 1:
secrets = json.get('data', {}) secrets = json.get('data', {})
else: else:
secrets = json.get('data', {}).get('data', {}) secrets = json.get('data', {}).get('data', {})
try: try:
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)