Example #1
0
from collections import OrderedDict
from collections import defaultdict
from pprint import pprint
from functools import lru_cache

from github import Github  # pygithub
from logzero import logger

import ansibullbot.constants as C
from ansibullbot.utils.component_tools import AnsibleComponentMatcher
from ansibullbot.utils.git_tools import GitRepoWrapper
from ansibullbot.utils.logs import set_logger
from ansibullbot.utils.galaxy import GalaxyQueryTool

set_logger(debug=True)

GITHUB_TOKEN = os.getenv('GITHUB_TOKEN')
if GITHUB_TOKEN is None:
    GITHUB_TOKEN = C.DEFAULT_GITHUB_TOKEN
assert GITHUB_TOKEN, "GITHUB_TOKEN env var must be set to an oauth token with repo:read from https://github.com/settings/"


class AnsibotShim:
    '''A shim wrapper for ansibot's builtin functions'''
    def __init__(self):
        self.cachedir = '/tmp/ansibot.cache'
        self.gitrepo = GitRepoWrapper(
            cachedir=self.cachedir,
            repo='https://github.com/ansible/ansible',
            commit='a76d78f6919f62698341be2f102297a2ce30897c')
Example #2
0
 def set_logger(self):
     set_logger(debug=self.debug, logfile=self.logfile)
Example #3
0
import copy
import datetime
import glob
import json
import os

from ansibullbot.triagers.plugins.collection_facts import get_collection_facts
from ansibullbot.utils.component_tools import AnsibleComponentMatcher
from ansibullbot.parsers.botmetadata import BotMetadataParser
from ansibullbot.utils.git_tools import GitRepoWrapper
from ansibullbot.wrappers.historywrapper import HistoryWrapper
from ansibullbot.triagers.plugins.component_matching import get_component_match_facts
from ansibullbot.triagers.plugins.collection_facts import get_collection_facts

from ansibullbot.utils.logs import set_logger
set_logger()

from pprint import pprint


class MockActor:
    def __init__(self, event):
        self._event = event

    @property
    def id(self):
        import epdb
        epdb.st()

    @property
    def login(self):