Ejemplo n.º 1
0
def run_hook_script(apps_root, app_id, action):
    app_event_script, add_location_to_sys_path = get_script_path(
        apps_root, app_id, action)
    log = logger.get_logger('events')
    if isfile(app_event_script):
        log.info('executing {0}'.format(app_event_script))
        try:
            run_script(app_event_script, add_location_to_sys_path)
        except CalledProcessError, e:
            log.error('error in script: {0}'.format(e.output))
            log.error(traceback.format_exc())
            if action == 'post-install':
                raise e
Ejemplo n.º 2
0
    def __trigger_app_event(self, apps_root, event_script):
        log = logger.get_logger('events')

        for app in self.sam.installed_all_apps():
            app_id = app.app.id
            app_event_script = join(apps_root, app_id, 'bin', event_script)
            if path.isfile(app_event_script):
                log.info('executing {0}'.format(app_event_script))
                try:
                    run_script(app_event_script)
                except:
                    log.error('error in script')
                    log.error(traceback.format_exc())
            else:
                log.info('{0} not found'.format(app_event_script))
Ejemplo n.º 3
0
import sys
import logging
from syncloud_app import logger
from syncloud_platform.gaplib.scripts import run_script

logger.init(logging.DEBUG, console=True, line_format='%(message)s')
run_script(sys.argv[1])