Allow activation fails

fix-uris 0.10.8
J. Fernando Sánchez 6 years ago
parent 61181db199
commit e5662d482e

@ -0,0 +1,10 @@
version: '3'
services:
senpy:
image: "${IMAGENAME-gsiupm/senpy}:${VERSION-latest}"
entrypoint: ["/bin/bash"]
working_dir: "/senpy-plugins"
ports:
- 5000:5000
volumes:
- ".:/usr/src/app/"

@ -0,0 +1,9 @@
version: '3'
services:
test:
image: "${IMAGENAME-gsiupm/senpy}:${VERSION-dev}"
entrypoint: ["py.test"]
volumes:
- ".:/usr/src/app/"
command:
[]

@ -0,0 +1,11 @@
version: '3'
services:
senpy:
image: "${IMAGENAME-gsiupm/senpy}:${VERSION-dev}"
build:
context: .
dockerfile: Dockerfile${PYVERSION--2.7}
ports:
- 5001:5000
volumes:
- "./data:/data"

@ -105,6 +105,12 @@ def main():
action='store_true', action='store_true',
default=False, default=False,
help='Output the senpy version and exit') help='Output the senpy version and exit')
parser.add_argument(
'--allow-fail',
'--fail',
action='store_true',
default=False,
help='Do not exit if some plugins fail to activate')
args = parser.parse_args() args = parser.parse_args()
if args.version: if args.version:
print('Senpy version {}'.format(senpy.__version__)) print('Senpy version {}'.format(senpy.__version__))
@ -128,7 +134,7 @@ def main():
sp.install_deps() sp.install_deps()
if args.only_install: if args.only_install:
return return
sp.activate_all() sp.activate_all(allow_fail=args.allow_fail)
if args.only_test: if args.only_test:
easy_test(sp.plugins(), debug=args.debug) easy_test(sp.plugins(), debug=args.debug)
return return

@ -318,10 +318,15 @@ class Senpy(object):
else: else:
self._default = self._plugins[value.lower()] self._default = self._plugins[value.lower()]
def activate_all(self, sync=True): def activate_all(self, sync=True, allow_fail=False):
ps = [] ps = []
for plug in self._plugins.keys(): for plug in self._plugins.keys():
ps.append(self.activate_plugin(plug, sync=sync)) try:
self.activate_plugin(plug, sync=sync)
except Exception as ex:
if not allow_fail:
raise
logger.error('Could not activate {}: {}'.format(plug, ex))
return ps return ps
def deactivate_all(self, sync=True): def deactivate_all(self, sync=True):

Loading…
Cancel
Save