Index: devel/Makefile =================================================================== --- devel/Makefile +++ devel/Makefile @@ -224,6 +224,7 @@ SUBDIR += build SUBDIR += buildbot SUBDIR += buildbot-console-view + SUBDIR += buildbot-grid-view SUBDIR += buildbot-pkg SUBDIR += buildbot-waterfall-view SUBDIR += buildbot-worker Index: devel/buildbot-console-view/Makefile =================================================================== --- devel/buildbot-console-view/Makefile +++ devel/buildbot-console-view/Makefile @@ -2,7 +2,7 @@ # $FreeBSD$ PORTNAME= buildbot-console-view -PORTVERSION= 0.9.10 +PORTVERSION= 0.9.11 CATEGORIES= devel python MASTER_SITES= CHEESESHOP @@ -11,27 +11,12 @@ LICENSE= GPLv2 -MY_DEPENDS= buildbot-pkg>=${PORTVERSION}:devel/buildbot-pkg -BUILD_DEPENDS= ${MY_DEPENDS} -RUN_DEPENDS= ${MY_DEPENDS} -TEST_DEPENDS= trial:devel/py-twisted \ - buildbot-worker>=${PORTVERSION}:devel/buildbot-worker \ - ${PYTHON_PKGNAMEPREFIX}mock>0.8.0:devel/py-mock \ - ${PYTHON_PKGNAMEPREFIX}boto3>0:www/py-boto3 \ - ${PYTHON_PKGNAMEPREFIX}service_identity>=16.0.0:security/py-service_identity \ - ${PYTHON_PKGNAMEPREFIX}treq>0:www/py-treq +BUILD_DEPENDS= buildbot-pkg>=${PORTVERSION}:devel/buildbot-pkg +RUN_DEPENDS= buildbot-pkg>=${PORTVERSION}:devel/buildbot-pkg -USES= python:-2.7 +USES= python USE_PYTHON= autoplist distutils NO_ARCH= yes - -post-patch: - @${FIND} ${WRKSRC} -type f | ${XARGS} -n 10 ${REINPLACE_CMD} -e \ - 's|/usr/bin/python|${PYTHON_CMD}|g' - @${FIND} ${WRKSRC} -name \*.bak -delete - -do-test: - @cd ${WRKSRC} && trial buildbot .include Index: devel/buildbot-console-view/distinfo =================================================================== --- devel/buildbot-console-view/distinfo +++ devel/buildbot-console-view/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1504051930 -SHA256 (buildbot-console-view-0.9.10.tar.gz) = ca62780a7405df761fa2d80019890c8b25d79f6b716df26fbc4ce257a21f762e -SIZE (buildbot-console-view-0.9.10.tar.gz) = 640908 +TIMESTAMP = 1506179816 +SHA256 (buildbot-console-view-0.9.11.tar.gz) = a0467c096971178462dc18b6a652b53485d1ad0f2791c19f6026a432a07d9d9b +SIZE (buildbot-console-view-0.9.11.tar.gz) = 640623 Index: devel/buildbot-console-view/pkg-descr =================================================================== --- devel/buildbot-console-view/pkg-descr +++ devel/buildbot-console-view/pkg-descr @@ -1,5 +1,5 @@ This port is the Console View Plugin for BuildBot. For the buildmaster, -install the devel/buildbot port +install the devel/buildbot port. For more information, please see: http://buildbot.net/trac Index: devel/buildbot-grid-view/Makefile =================================================================== --- /dev/null +++ devel/buildbot-grid-view/Makefile @@ -0,0 +1,21 @@ +# $FreeBSD$ + +PORTNAME= buildbot-grid-view +PORTVERSION= 0.9.11 +CATEGORIES= devel python +MASTER_SITES= CHEESESHOP + +MAINTAINER= rodrigc@FreeBSD.org +COMMENT= Continuous Integration Framework (Grid View) + +LICENSE= GPLv2 + +BUILD_DEPENDS= buildbot-pkg>=${PORTVERSION}:devel/buildbot-pkg +RUN_DEPENDS= buildbot-pkg>=${PORTVERSION}:devel/buildbot-pkg + +USES= python +USE_PYTHON= autoplist distutils + +NO_ARCH= yes + +.include Index: devel/buildbot-grid-view/distinfo =================================================================== --- /dev/null +++ devel/buildbot-grid-view/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1506180944 +SHA256 (buildbot-grid-view-0.9.11.tar.gz) = f93088ba6ac063c4bd7400b2477c94e86a7531fc614c3965c18914dcc701812b +SIZE (buildbot-grid-view-0.9.11.tar.gz) = 638818 Index: devel/buildbot-grid-view/pkg-descr =================================================================== --- /dev/null +++ devel/buildbot-grid-view/pkg-descr @@ -0,0 +1,6 @@ +This port is the Grid View Plugin for BuildBot. For the buildmaster, +install the devel/buildbot port. + +For more information, please see: http://buildbot.net/trac + +WWW: http://buildbot.net Index: devel/buildbot-pkg/Makefile =================================================================== --- devel/buildbot-pkg/Makefile +++ devel/buildbot-pkg/Makefile @@ -2,7 +2,7 @@ # $FreeBSD$ PORTNAME= buildbot-pkg -PORTVERSION= 0.9.10 +PORTVERSION= 0.9.11 CATEGORIES= devel python MASTER_SITES= CHEESESHOP @@ -11,27 +11,9 @@ LICENSE= GPLv2 -MY_DEPENDS= buildbot>=${PORTVERSION}:devel/buildbot -BUILD_DEPENDS= ${MY_DEPENDS} -RUN_DEPENDS= ${MY_DEPENDS} -TEST_DEPENDS= trial:devel/py-twisted \ - buildbot-worker>=${PORTVERSION}:devel/buildbot-worker \ - ${PYTHON_PKGNAMEPREFIX}mock>0.8.0:devel/py-mock \ - ${PYTHON_PKGNAMEPREFIX}boto3>0:www/py-boto3 \ - ${PYTHON_PKGNAMEPREFIX}service_identity>=16.0.0:security/py-service_identity \ - ${PYTHON_PKGNAMEPREFIX}treq>0:www/py-treq - -USES= python:-2.7 +USES= python USE_PYTHON= autoplist distutils NO_ARCH= yes - -post-patch: - @${FIND} ${WRKSRC} -type f | ${XARGS} -n 10 ${REINPLACE_CMD} -e \ - 's|/usr/bin/python|${PYTHON_CMD}|g' - @${FIND} ${WRKSRC} -name \*.bak -delete - -do-test: - @cd ${WRKSRC} && trial buildbot .include Index: devel/buildbot-pkg/distinfo =================================================================== --- devel/buildbot-pkg/distinfo +++ devel/buildbot-pkg/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1504051931 -SHA256 (buildbot-pkg-0.9.10.tar.gz) = 6eecdde02f98be469ec9fde47c55fe64ca04eec764a4729be2ff4faa892532d8 -SIZE (buildbot-pkg-0.9.10.tar.gz) = 4422 +TIMESTAMP = 1506179823 +SHA256 (buildbot-pkg-0.9.11.tar.gz) = 6328abfa68efba299d0309a88b8de40d71d1da4d7bc9148476fed8f393e407be +SIZE (buildbot-pkg-0.9.11.tar.gz) = 4420 Index: devel/buildbot-pkg/pkg-descr =================================================================== --- devel/buildbot-pkg/pkg-descr +++ devel/buildbot-pkg/pkg-descr @@ -1,5 +1,5 @@ This port is the Web UI part of BuildBot. For the buildmaster, install the -devel/buildbot port +devel/buildbot port. For more information, please see: http://buildbot.net/trac Index: devel/buildbot-waterfall-view/Makefile =================================================================== --- devel/buildbot-waterfall-view/Makefile +++ devel/buildbot-waterfall-view/Makefile @@ -2,7 +2,7 @@ # $FreeBSD$ PORTNAME= buildbot-waterfall-view -PORTVERSION= 0.9.10 +PORTVERSION= 0.9.11 CATEGORIES= devel python MASTER_SITES= CHEESESHOP @@ -11,27 +11,12 @@ LICENSE= GPLv2 -MY_DEPENDS= buildbot-pkg>=${PORTVERSION}:devel/buildbot-pkg -BUILD_DEPENDS= ${MY_DEPENDS} -RUN_DEPENDS= ${MY_DEPENDS} -TEST_DEPENDS= trial:devel/py-twisted \ - buildbot-worker>=${PORTVERSION}:devel/buildbot-worker \ - ${PYTHON_PKGNAMEPREFIX}mock>0.8.0:devel/py-mock \ - ${PYTHON_PKGNAMEPREFIX}boto3>0:www/py-boto3 \ - ${PYTHON_PKGNAMEPREFIX}service_identity>=16.0.0:security/py-service_identity \ - ${PYTHON_PKGNAMEPREFIX}treq>0:www/py-treq +BUILD_DEPENDS= buildbot-pkg>=${PORTVERSION}:devel/buildbot-pkg +RUN_DEPENDS= buildbot-pkg>=${PORTVERSION}:devel/buildbot-pkg -USES= python:-2.7 +USES= python USE_PYTHON= autoplist distutils NO_ARCH= yes - -post-patch: - @${FIND} ${WRKSRC} -type f | ${XARGS} -n 10 ${REINPLACE_CMD} -e \ - 's|/usr/bin/python|${PYTHON_CMD}|g' - @${FIND} ${WRKSRC} -name \*.bak -delete - -do-test: - @cd ${WRKSRC} && trial buildbot .include Index: devel/buildbot-waterfall-view/distinfo =================================================================== --- devel/buildbot-waterfall-view/distinfo +++ devel/buildbot-waterfall-view/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1504051937 -SHA256 (buildbot-waterfall-view-0.9.10.tar.gz) = c2768391d7eb92e550afe4210e3cba7b69b34a7c9a27d333582f2a04b0f8b030 -SIZE (buildbot-waterfall-view-0.9.10.tar.gz) = 714260 +TIMESTAMP = 1506179833 +SHA256 (buildbot-waterfall-view-0.9.11.tar.gz) = 54e36f8d02be7c046510173f7adb14e3eaeb912e0f41f1b7784e2ac0744799c1 +SIZE (buildbot-waterfall-view-0.9.11.tar.gz) = 713915 Index: devel/buildbot-waterfall-view/pkg-descr =================================================================== --- devel/buildbot-waterfall-view/pkg-descr +++ devel/buildbot-waterfall-view/pkg-descr @@ -1,5 +1,5 @@ This port is the Waterfall View Plugin for BuildBot. For the buildmaster, -install the devel/buildbot port +install the devel/buildbot port. For more information, please see: http://buildbot.net/trac Index: devel/buildbot-worker/Makefile =================================================================== --- devel/buildbot-worker/Makefile +++ devel/buildbot-worker/Makefile @@ -2,7 +2,7 @@ # $FreeBSD$ PORTNAME= buildbot-worker -PORTVERSION= 0.9.10 +PORTVERSION= 0.9.11 CATEGORIES= devel python MASTER_SITES= CHEESESHOP @@ -18,7 +18,7 @@ TEST_DEPENDS= trial:devel/py-twisted \ ${PYTHON_PKGNAMEPREFIX}mock>0:devel/py-mock -USES= python:-2.7 +USES= python USE_PYTHON= autoplist distutils USE_RC_SUBR= buildbot-worker Index: devel/buildbot-worker/distinfo =================================================================== --- devel/buildbot-worker/distinfo +++ devel/buildbot-worker/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1504051939 -SHA256 (buildbot-worker-0.9.10.tar.gz) = 1793631d74629cd73bc0df1fadf28fb34d87e63aa72cba82058122bde165a824 -SIZE (buildbot-worker-0.9.10.tar.gz) = 99028 +TIMESTAMP = 1506179860 +SHA256 (buildbot-worker-0.9.11.tar.gz) = 4254bf964465acb6586fda36b26a424466a265b6a5259138cf4fa63a1e9f6851 +SIZE (buildbot-worker-0.9.11.tar.gz) = 100746 Index: devel/buildbot-worker/pkg-descr =================================================================== --- devel/buildbot-worker/pkg-descr +++ devel/buildbot-worker/pkg-descr @@ -1,5 +1,5 @@ This port is the worker part of BuildBot. For the buildmaster, install the -devel/buildbot port +devel/buildbot port. For more information, please see: http://buildbot.net/trac Index: devel/buildbot-www/Makefile =================================================================== --- devel/buildbot-www/Makefile +++ devel/buildbot-www/Makefile @@ -2,7 +2,7 @@ # $FreeBSD$ PORTNAME= buildbot-www -PORTVERSION= 0.9.10 +PORTVERSION= 0.9.11 CATEGORIES= devel python MASTER_SITES= CHEESESHOP @@ -11,31 +11,17 @@ LICENSE= GPLv2 -MY_DEPENDS= buildbot>=${PORTVERSION}:devel/buildbot \ +BUILD_DEPENDS= buildbot>=${PORTVERSION}:devel/buildbot \ buildbot-pkg>=${PORTVERSION}:devel/buildbot-pkg \ ${PYTHON_PKGNAMEPREFIX}mock>0.8.0:devel/py-mock -BUILD_DEPENDS= ${MY_DEPENDS} -RUN_DEPENDS= ${MY_DEPENDS} \ - buildbot-console-view>=${PORTVERSION}:devel/buildbot-console-view \ +RUN_DEPENDS= buildbot-console-view>=${PORTVERSION}:devel/buildbot-console-view \ + buildbot-grid-view>=${PORTVERSION}:devel/buildbot-grid-view \ buildbot-waterfall-view>=${PORTVERSION}:devel/buildbot-waterfall-view \ ${PYTHON_PKGNAMEPREFIX}service_identity>=16.0.0:security/py-service_identity -TEST_DEPENDS= trial:devel/py-twisted \ - buildbot-worker>=${PORTVERSION}:devel/buildbot-worker \ - ${PYTHON_PKGNAMEPREFIX}mock>0.8.0:devel/py-mock \ - ${PYTHON_PKGNAMEPREFIX}boto3>0:www/py-boto3 \ - ${PYTHON_PKGNAMEPREFIX}treq>0:www/py-treq -USES= python:-2.7 +USES= python USE_PYTHON= autoplist distutils NO_ARCH= yes - -post-patch: - @${FIND} ${WRKSRC} -type f | ${XARGS} -n 10 ${REINPLACE_CMD} -e \ - 's|/usr/bin/python|${PYTHON_CMD}|g' - @${FIND} ${WRKSRC} -name \*.bak -delete - -do-test: - @cd ${WRKSRC} && trial buildbot .include Index: devel/buildbot-www/distinfo =================================================================== --- devel/buildbot-www/distinfo +++ devel/buildbot-www/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1504051917 -SHA256 (buildbot-www-0.9.10.tar.gz) = 9083516d702feefb8b61dd6cb351a54163f3b2d4f34b14071f77f2f550de9bf6 -SIZE (buildbot-www-0.9.10.tar.gz) = 693452 +TIMESTAMP = 1506180945 +SHA256 (buildbot-www-0.9.11.tar.gz) = af01216d543eddba0772e55a0a97a2a1d0a9b0fddc1c87dd59b449b4818893db +SIZE (buildbot-www-0.9.11.tar.gz) = 687664 Index: devel/buildbot-www/pkg-descr =================================================================== --- devel/buildbot-www/pkg-descr +++ devel/buildbot-www/pkg-descr @@ -1,5 +1,5 @@ This port is the Web UI part of BuildBot. For the buildmaster, install the -devel/buildbot port +devel/buildbot port. For more information, please see: http://buildbot.net/trac Index: devel/buildbot/Makefile =================================================================== --- devel/buildbot/Makefile +++ devel/buildbot/Makefile @@ -2,7 +2,7 @@ # $FreeBSD$ PORTNAME= buildbot -PORTVERSION= 0.9.10 +PORTVERSION= 0.9.11 CATEGORIES= devel python MASTER_SITES= CHEESESHOP @@ -26,11 +26,12 @@ ${PYTHON_PKGNAMEPREFIX}treq>0:www/py-treq TEST_DEPENDS= trial:devel/py-twisted \ buildbot-worker>=${PORTVERSION}:devel/buildbot-worker \ + buildbot-www>=${PORTVERSION}:devel/buildbot-www \ ${PYTHON_PKGNAMEPREFIX}mock>0.8.0:devel/py-mock \ ${PYTHON_PKGNAMEPREFIX}boto3>0:www/py-boto3 +USES= python USE_RC_SUBR= buildbot -USES= python:-2.7 USE_PYTHON= autoplist distutils SUB_LIST+= PYTHON_CMD=${PYTHON_CMD} Index: devel/buildbot/distinfo =================================================================== --- devel/buildbot/distinfo +++ devel/buildbot/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1504051787 -SHA256 (buildbot-0.9.10.tar.gz) = 8c5ed75f3f16f4ff0f2c9e3f9b091acb5e6e1c0ef68ffa8f687a55413a833143 -SIZE (buildbot-0.9.10.tar.gz) = 3112750 +TIMESTAMP = 1506179805 +SHA256 (buildbot-0.9.11.tar.gz) = 9be352c0aab5d1520fedac8d6b19aadda4f48763ac7f72bb00e5f8cc51107ee8 +SIZE (buildbot-0.9.11.tar.gz) = 3096455 Index: devel/buildbot/files/patch-buildbot-secrets =================================================================== --- devel/buildbot/files/patch-buildbot-secrets +++ /dev/null @@ -1,214 +0,0 @@ -diff -rNu buildbot/secrets.orig/providers/__init__.py buildbot/secrets/providers/__init__.py ---- buildbot/secrets.orig/providers/__init__.py 1970-01-01 01:00:00.000000000 +0100 -+++ buildbot/secrets/providers/__init__.py 2017-03-28 21:52:03.947803965 +0200 -@@ -0,0 +1,14 @@ -+# This file is part of Buildbot. Buildbot is free software: you can -+# redistribute it and/or modify it under the terms of the GNU General Public -+# License as published by the Free Software Foundation, version 2. -+# -+# This program is distributed in the hope that it will be useful, but WITHOUT -+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -+# details. -+# -+# You should have received a copy of the GNU General Public License along with -+# this program; if not, write to the Free Software Foundation, Inc., 51 -+# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -+# -+# Copyright Buildbot Team Members -diff -rNu buildbot/secrets.orig/providers/base.py buildbot/secrets/providers/base.py ---- buildbot/secrets.orig/providers/base.py 1970-01-01 01:00:00.000000000 +0100 -+++ buildbot/secrets/providers/base.py 2017-03-28 21:52:03.947803965 +0200 -@@ -0,0 +1,35 @@ -+# This file is part of Buildbot. Buildbot is free software: you can -+# redistribute it and/or modify it under the terms of the GNU General Public -+# License as published by the Free Software Foundation, version 2. -+# -+# This program is distributed in the hope that it will be useful, but WITHOUT -+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -+# details. -+# -+# You should have received a copy of the GNU General Public License along with -+# this program; if not, write to the Free Software Foundation, Inc., 51 -+# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -+# -+# Copyright Buildbot Team Members -+""" -+secret provider interface -+""" -+from __future__ import absolute_import -+from __future__ import print_function -+ -+import abc -+ -+from buildbot.util.service import BuildbotService -+ -+ -+class SecretProviderBase(BuildbotService): -+ """ -+ Secret provider base -+ """ -+ -+ @abc.abstractmethod -+ def get(self, *args, **kwargs): -+ """ -+ this should be an abstract method -+ """ -diff -rNu buildbot/secrets.orig/providers/file.py buildbot/secrets/providers/file.py ---- buildbot/secrets.orig/providers/file.py 1970-01-01 01:00:00.000000000 +0100 -+++ buildbot/secrets/providers/file.py 2017-03-28 21:52:03.947803965 +0200 -@@ -0,0 +1,82 @@ -+# This file is part of Buildbot. Buildbot is free software: you can -+# redistribute it and/or modify it under the terms of the GNU General Public -+# License as published by the Free Software Foundation, version 2. -+# -+# This program is distributed in the hope that it will be useful, but WITHOUT -+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -+# details. -+# -+# You should have received a copy of the GNU General Public License along with -+# this program; if not, write to the Free Software Foundation, Inc., 51 -+# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -+# -+# Copyright Buildbot Team Members -+""" -+file based provider -+""" -+from __future__ import absolute_import -+from __future__ import print_function -+ -+import os -+import stat -+ -+from buildbot import config -+from buildbot.secrets.providers.base import SecretProviderBase -+ -+ -+class SecretInAFile(SecretProviderBase): -+ """ -+ secret is stored in a separate file under the given directory name -+ """ -+ name = "SecretInAFile" -+ -+ def checkFileIsReadOnly(self, dirname, secretfile): -+ filepath = os.path.join(dirname, secretfile) -+ obs_stat = stat.S_IMODE(os.stat(filepath).st_mode) -+ if (obs_stat & 0o77) != 0 and os.name == "posix": -+ config.error("Permissions %s on file %s are too open." -+ " It is required that your secret files are NOT" -+ " accessible by others!" % (oct(obs_stat), -+ secretfile)) -+ -+ def checkSecretDirectoryIsAvailableAndReadable(self, dirname, suffixes): -+ if not os.access(dirname, os.F_OK): -+ config.error("directory %s does not exists" % dirname) -+ for secretfile in os.listdir(dirname): -+ for suffix in suffixes: -+ if secretfile.endswith(suffix): -+ self.checkFileIsReadOnly(dirname, secretfile) -+ -+ def loadSecrets(self, dirname, suffixes): -+ secrets = {} -+ for secretfile in os.listdir(dirname): -+ secretvalue = None -+ for suffix in suffixes: -+ if secretfile.endswith(suffix): -+ with open(os.path.join(dirname, secretfile)) as source: -+ secretvalue = source.read() -+ if suffix: -+ secretfile = secretfile[:-len(suffix)] -+ secrets[secretfile] = secretvalue -+ return secrets -+ -+ def checkConfig(self, dirname, suffixes=None): -+ self._dirname = dirname -+ if suffixes is None: -+ suffixes = [""] -+ self.checkSecretDirectoryIsAvailableAndReadable(dirname, -+ suffixes=suffixes) -+ -+ def reconfigService(self, dirname, suffixes=None): -+ self._dirname = dirname -+ self.secrets = {} -+ if suffixes is None: -+ suffixes = [""] -+ self.secrets = self.loadSecrets(self._dirname, suffixes=suffixes) -+ -+ def get(self, entry): -+ """ -+ get the value from the file identified by 'entry' -+ """ -+ return self.secrets.get(entry) -diff -rNu buildbot/secrets.orig/providers/vault.py buildbot/secrets/providers/vault.py ---- buildbot/secrets.orig/providers/vault.py 1970-01-01 01:00:00.000000000 +0100 -+++ buildbot/secrets/providers/vault.py 2017-03-28 21:52:03.947803965 +0200 -@@ -0,0 +1,67 @@ -+# This file is part of Buildbot. Buildbot is free software: you can -+# redistribute it and/or modify it under the terms of the GNU General Public -+# License as published by the Free Software Foundation, version 2. -+# -+# This program is distributed in the hope that it will be useful, but WITHOUT -+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -+# details. -+# -+# You should have received a copy of the GNU General Public License along with -+# this program; if not, write to the Free Software Foundation, Inc., 51 -+# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -+# -+# Copyright Buildbot Team Members -+""" -+vault based providers -+""" -+ -+from __future__ import absolute_import -+from __future__ import print_function -+ -+from twisted.internet import defer -+ -+from buildbot import config -+from buildbot.secrets.providers.base import SecretProviderBase -+from buildbot.util import httpclientservice -+ -+ -+class HashiCorpVaultSecretProvider(SecretProviderBase): -+ """ -+ basic provider where each secret is stored in Vault -+ """ -+ -+ name = 'SecretInVault' -+ -+ def checkConfig(self, vaultServer=None, vaultToken=None, secretsmount=None): -+ if not isinstance(vaultServer, str): -+ config.error("vaultServer must be a string while it is %s" % (type(vaultServer,))) -+ if not isinstance(vaultToken, str): -+ config.error("vaultToken must be a string while it is %s" % (type(vaultToken,))) -+ -+ @defer.inlineCallbacks -+ def reconfigService(self, vaultServer=None, vaultToken=None, secretsmount=None): -+ if secretsmount is None: -+ self.secretsmount = "secret" -+ else: -+ self.secretsmount = secretsmount -+ self.vaultServer = vaultServer -+ self.vaultToken = vaultToken -+ if vaultServer.endswith('/'): -+ vaultServer = vaultServer[:-1] -+ self._http = yield httpclientservice.HTTPClientService.getService( -+ self.master, self.vaultServer, headers={'X-Vault-Token': self.vaultToken}) -+ -+ @defer.inlineCallbacks -+ def get(self, entry): -+ """ -+ get the value from vault secret backend -+ """ -+ path = self.secretsmount + '/' + entry -+ proj = yield self._http.get('/v1/{0}'.format(path)) -+ code = yield proj.code -+ if code != 200: -+ raise KeyError("The key %s does not exist in Vault provider: request" -+ " return code:%d." % (entry, code)) -+ json = yield proj.json() -+ defer.returnValue(json.get(u'data', {}).get('value'))