def handle_exception(e): """Return JSON instead of HTML for HTTP errors.""" # start with the correct headers and status code from the error # replace the body with JSON log_info = { "code": e.code, "title": e.name, "description": e.description, } get_logger().error('api server error %s' % e.description, extra=log_info) return jsonify({'code': 500, 'message': 'api server error'})
def __init__(self, options=None): options = options or config.jenkins['default'] options['cache'] = True self._config = options self._jenkins = Jenkins(baseurl=options.get('base_url'), username=options.get('username'), password=options.get('password')) self.logger = get_logger('console')
def __init__(self, options, build_type='job'): self.options = options repository, project, version = self.parse_repository() self.repository = repository self.project = project self.version = version self.cache_dir = Workspace().get_vcs_space('git') self.build_type = build_type self.workspace = self.cwd self.git = Git(working_dir=self.cwd) self.refs = None self.logger = get_logger('console')
import sys from eclogue.models.book import Book from eclogue.models.playbook import Playbook from eclogue.vcs.versioncontrol import GitDownload from eclogue.ansible.runer import PlayBookRunner, get_default_options from tasktiger import Task from eclogue.tasks.reporter import Reporter from eclogue.models.perform import Perform from eclogue.tasks import tiger from eclogue.lib.logger import get_logger from eclogue.lib.builder import build_book_from_db from eclogue.ansible.host import parser_inventory from ansible.cli.playbook import PlaybookCLI logger = get_logger('console') def dispatch(book_id, entry, payload): print('xxxx', book_id, entry, payload) book = Book.find_by_id(book_id) if not book: return False username = payload.get('username') run_id = payload.get('req_id') or str(uuid.uuid4()) params = [book_id, run_id] options = payload.get('options') if not entry: return False if type(options) == str:
def __init__(self, app_type, app_params=None): self.app_type = app_type self.app_params = app_params self.app = self.get_app(app_type, app_params) self.logger = get_logger('console')