當前位置: 首頁>>代碼示例>>Python>>正文


Python bugzilla.Bugzilla方法代碼示例

本文整理匯總了Python中bugzilla.Bugzilla方法的典型用法代碼示例。如果您正苦於以下問題:Python bugzilla.Bugzilla方法的具體用法?Python bugzilla.Bugzilla怎麽用?Python bugzilla.Bugzilla使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在bugzilla的用法示例。


在下文中一共展示了bugzilla.Bugzilla方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: one_click_report

# 需要導入模塊: import bugzilla [as 別名]
# 或者: from bugzilla import Bugzilla [as 別名]
def one_click_report(self, execution, user, args):  # pylint: disable=unused-argument
        """
            Attempt 1-click bug report! Unmodified Bugzilla requires
            *Product*, *Component*, *Version* and *Summary*!
            *OS* and *Hardware* fields are set to *All*!

            .. warning::

                This can fail due to Bugzilla requiring more fields,
                because the API user doesn't have permissions to report in
                the chosen Product, becase TC info is incomplete or because
                any of the specified fields doesn't exist!

                It is up to the Bugzilla/TCMS admin to make sure these are
                in sync! Alternatively inherit this class and override this
                method!
        """
        buginfo = args.copy()
        buginfo['op_sys'] = 'All'
        buginfo['rep_platform'] = 'All'
        return self.rpc.createbug(**buginfo).weburl 
開發者ID:kiwitcms,項目名稱:Kiwi,代碼行數:23,代碼來源:bugzilla_integration.py

示例2: __init__

# 需要導入模塊: import bugzilla [as 別名]
# 或者: from bugzilla import Bugzilla [as 別名]
def __init__(self, *args, **kwargs):
        super(Zilla, self).__init__(*args, **kwargs)
        self._stop = False
        self.thread = threading.Thread(target=self.loop, name='zilla')
        self.thread.daemon = True

        config = self.controller.config
        try:
            self.url = config.get("zilla", "url")
            self.api_key = config.get("zilla", "api_key")
            self.interval = config.getint("zilla", "interval")
            self.channel = config.get('zilla', 'channel')
        except AttributeError:
            _log.warning("Couldn't load the Zilla module, check your configuration.")
            self.url = "https://example.com"
            self.api_key = "DEADBEEF"
            self.interval = 9999999
            self.channel = '#test'

        self._bugzilla = bugzilla.Bugzilla(url=self.url + 'rest/', api_key=self.api_key)

        _log.info("zilla module initialized for {}, pooling every {} seconds.".format(self.url, self.interval)) 
開發者ID:mozilla,項目名稱:MozDef,代碼行數:24,代碼來源:zilla.py

示例3: bugzilla_init

# 需要導入模塊: import bugzilla [as 別名]
# 或者: from bugzilla import Bugzilla [as 別名]
def bugzilla_init(apiurl):
    bugzilla_api = bugzilla.Bugzilla(apiurl)
    if not bugzilla_api.logged_in:
        print('Bugzilla credentials required to create bugs.')
        bugzilla_api.interactive_login()
    return bugzilla_api 
開發者ID:openSUSE,項目名稱:openSUSE-release-tools,代碼行數:8,代碼來源:issue-diff.py

示例4: bugzillas

# 需要導入模塊: import bugzilla [as 別名]
# 或者: from bugzilla import Bugzilla [as 別名]
def bugzillas():
    bzapi = bugzilla.Bugzilla(BUGZILLA)
    query = bzapi.build_query(product='Fedora')
    query['blocks'] = FTI_TRACKER
    bugz = {}
    for bug in sorted(bzapi.query(query), key=lambda b: -b.id):
        if bug.resolution == 'DUPLICATE':
            continue
        if bug.component not in bugz:
            bugz[bug.component] = bug
    return bugz 
開發者ID:fedora-python,項目名稱:portingdb,代碼行數:13,代碼來源:check_fti.py

示例5: api

# 需要導入模塊: import bugzilla [as 別名]
# 或者: from bugzilla import Bugzilla [as 別名]
def api(self):
        if self._api is None:
            self._api = XMLRPCBugzilla(url=self.url, api_key=self._api_key)
            try:
                if not self._api.logged_in:
                    raise ValueError("Empty or invalid Bugzilla api_key")
            except Fault as exc:
                raise ValueError(exc.faultString)
        return self._api 
開發者ID:packit-service,項目名稱:packit-service,代碼行數:11,代碼來源:psbugzilla.py

示例6: test_bugzilla_create_bug

# 需要導入模塊: import bugzilla [as 別名]
# 或者: from bugzilla import Bugzilla [as 別名]
def test_bugzilla_create_bug():
    flexmock(Bugzilla).should_receive("logged_in").and_return(True)
    flexmock(Bugzilla).should_receive("build_createbug").and_return({})
    flexmock(Bugzilla).should_receive("createbug").and_return(
        flexmock(id=1, weburl="url")
    )
    bz_id, bz_url = PSBugzilla("", "").create_bug(
        "product", "version", "component", "summary"
    )
    assert bz_id == 1
    assert bz_url == "url" 
開發者ID:packit-service,項目名稱:packit-service,代碼行數:13,代碼來源:test_psbugzilla.py

示例7: test_bugzilla_add_patch

# 需要導入模塊: import bugzilla [as 別名]
# 或者: from bugzilla import Bugzilla [as 別名]
def test_bugzilla_add_patch():
    flexmock(Bugzilla).should_receive("logged_in").and_return(True)
    flexmock(Bugzilla).should_receive("attachfile").and_return(123)
    assert PSBugzilla("", "").add_patch(666, b"") == 123 
開發者ID:packit-service,項目名稱:packit-service,代碼行數:6,代碼來源:test_psbugzilla.py

示例8: main

# 需要導入模塊: import bugzilla [as 別名]
# 或者: from bugzilla import Bugzilla [as 別名]
def main():
    yesterday = datetime.date.today() - datetime.timedelta(days=1)
    bzapi = bugzilla.Bugzilla(URL)
    bz_query_url = "https://bugs.documentfoundation.org/buglist.cgi?f1=cf_crashreport&f3=OP&f4=bug_status&f5=creation_ts&f6=cf_crashreport&j3=OR&list_id=620366&o1=isnotempty&o4=changedafter&o5=changedafter&o6=changedafter&query_format=advanced&v4=%s&v5=%s&v6=%s" % (yesterday.isoformat(), yesterday.isoformat(), yesterday.isoformat())
    query = bzapi.url_to_query(bz_query_url)

    bugs = bzapi.query(query)

    if len(bugs) == 0:
        sys.exit()

    config = configparser.ConfigParser()
    config.read(sys.argv[1])

    login_url = "http://crashreport.libreoffice.org/accounts/login/"
    user = config["CrashReport"]["User"]
    password = config["CrashReport"]["Password"]
    session = requests.session()
    session.get(login_url)
    csrftoken = session.cookies['csrftoken']

    login_data = { 'username': user,'password': password,
            'csrfmiddlewaretoken': csrftoken }
    r1 = session.post(login_url, data=login_data, headers={"Referer": login_url})

    for bug in bugs:
        bug_id = bug.id
        fixed = is_bug_report_fixed(bug)
        try:
            update_bug_stats(session, bug_id, fixed)
        except Exception as e:
            print("exception setting bug status")
            print(e) 
開發者ID:mmohrhard,項目名稱:crash,代碼行數:35,代碼來源:update_bug_report_status.py

示例9: __init__

# 需要導入模塊: import bugzilla [as 別名]
# 或者: from bugzilla import Bugzilla [as 別名]
def __init__(self, consumer, config):
        self.consumer = consumer
        self.config = config
        url = self.config["url"]
        self.username = self.config["user"]
        self.reporter = self.config["reporter"]
        password = self.config["password"]
        api_key = self.config["api_key"]
        _log.info("Using BZ URL %s" % url)

        if api_key:
            self.bugzilla = bugzilla.Bugzilla(
                url=url, api_key=api_key, cookiefile=None, tokenfile=None
            )
        elif self.username and password:
            self.bugzilla = bugzilla.Bugzilla(
                url=url,
                user=self.username,
                password=password,
                cookiefile=None,
                tokenfile=None,
            )
        else:
            self.bugzilla = bugzilla.Bugzilla(url=url, cookiefile=None, tokenfile=None)

        self.bugzilla.bug_autorefresh = True

        self.base_query["product"] = self.config["product"]
        self.base_query["email1"] = self.config["user"]

        self.new_bug["product"] = self.config["product"]
        if "keywords" in self.config:
            self.new_bug["keywords"] = self.config["keywords"]
        self.new_bug["version"] = self.config["version"]
        self.new_bug["status"] = self.config["bug_status"]

        self.short_desc_template = self.config["short_desc_template"]
        self.description_template = self.config["description_template"] 
開發者ID:fedora-infra,項目名稱:the-new-hotness,代碼行數:40,代碼來源:bz.py

示例10: server

# 需要導入模塊: import bugzilla [as 別名]
# 或者: from bugzilla import Bugzilla [as 別名]
def server(self):
        """ Connection to the server """
        if self._server is None:
            self._server = bugzilla.Bugzilla(url=self.parent.url)
        return self._server 
開發者ID:psss,項目名稱:did,代碼行數:7,代碼來源:bugzilla.py

示例11: subscribed

# 需要導入模塊: import bugzilla [as 別名]
# 或者: from bugzilla import Bugzilla [as 別名]
def subscribed(self, user):
        """ True if CC was added in given time frame """
        for who, record in self.logs:
            if (record["field_name"] == "cc" and
                    user.email in record["added"]):
                return True
        return False

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  Bugzilla Stats
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
開發者ID:psss,項目名稱:did,代碼行數:13,代碼來源:bugzilla.py

示例12: __init__

# 需要導入模塊: import bugzilla [as 別名]
# 或者: from bugzilla import Bugzilla [as 別名]
def __init__(self, option, name=None, parent=None, user=None):
        StatsGroup.__init__(self, option, name, parent, user)
        config = dict(Config().section(option))
        # Check Bugzilla instance url
        try:
            self.url = config["url"]
        except KeyError:
            raise ReportError(
                "No bugzilla url set in the [{0}] section".format(option))
        # Make sure we have prefix set
        try:
            self.prefix = config["prefix"]
        except KeyError:
            raise ReportError(
                "No prefix set in the [{0}] section".format(option))
        # Check for customized list of resolutions
        try:
            self.resolutions = [
                resolution.lower()
                for resolution in split(config["resolutions"])]
        except KeyError:
            self.resolutions = DEFAULT_RESOLUTIONS
        # Save Bug class as attribute to allow customizations by
        # descendant class and set up the Bugzilla investigator
        self.bug = Bug
        self.bugzilla = Bugzilla(parent=self)
        # Construct the list of stats
        self.stats = [
            FiledBugs(option=option + "-filed", parent=self),
            PatchedBugs(option=option + "-patched", parent=self),
            PostedBugs(option=option + "-posted", parent=self),
            FixedBugs(option=option + "-fixed", parent=self),
            ReturnedBugs(option=option + "-returned", parent=self),
            VerifiedBugs(option=option + "-verified", parent=self),
            CommentedBugs(option=option + "-commented", parent=self),
            SubscribedBugs(option=option + "-subscribed", parent=self),
            ClosedBugs(option=option + "-closed", parent=self),
            ] 
開發者ID:psss,項目名稱:did,代碼行數:40,代碼來源:bugzilla.py

示例13: __init__

# 需要導入模塊: import bugzilla [as 別名]
# 或者: from bugzilla import Bugzilla [as 別名]
def __init__(self, bug_system):
        super().__init__(bug_system)

        # directory for Bugzilla credentials
        self._bugzilla_cache_dir = getattr(
            settings,
            "BUGZILLA_AUTH_CACHE_DIR",
            tempfile.mkdtemp(prefix='.bugzilla-')
        ) 
開發者ID:kiwitcms,項目名稱:Kiwi,代碼行數:11,代碼來源:bugzilla_integration.py

示例14: _rpc_connection

# 需要導入模塊: import bugzilla [as 別名]
# 或者: from bugzilla import Bugzilla [as 別名]
def _rpc_connection(self):
        if not os.path.exists(self._bugzilla_cache_dir):
            os.makedirs(self._bugzilla_cache_dir, 0o700)

        return bugzilla.Bugzilla(
            self.bug_system.api_url,
            user=self.bug_system.api_username,
            password=self.bug_system.api_password,
            cookiefile=self._bugzilla_cache_dir + 'cookie',
            tokenfile=self._bugzilla_cache_dir + 'token',
        ) 
開發者ID:kiwitcms,項目名稱:Kiwi,代碼行數:13,代碼來源:bugzilla_integration.py

示例15: main

# 需要導入模塊: import bugzilla [as 別名]
# 或者: from bugzilla import Bugzilla [as 別名]
def main():

    result = {}

    module_args = dict(
        id=dict(type='int', required=True),
        url=dict(type='str', required=False, default=URL),
        user=dict(type='str', rebuild=False, default=None),
        password=dict(type='str', rebuild=False, default=None, no_log=True),
        sslverify=dict(type='bool', required=False, default=True),)

    module = AnsibleModule(
        argument_spec=module_args,
        supports_check_mode=False,)

    bz_id = module.params.pop('id')

    try:
        bzapi = bugzilla.Bugzilla(**module.params)
        bug = bzapi.getbug(objid=bz_id)

        result.update(
            {key: val for key, val in vars(bug).items()
             if is_serializable(val)})

    # Raised when the user is not authorized or not logged in
    except xmlrpclib.Fault as ex:
        result['msg'] = ' '.join((str(ex.faultCode), ex.faultString))
        module.fail_json(**result)
    except Exception as ex:
        result['msg'] = ex.message
        module.fail_json(**result)

    module.exit_json(**result) 
開發者ID:redhat-openstack,項目名稱:infrared,代碼行數:36,代碼來源:fetch_bz.py


注:本文中的bugzilla.Bugzilla方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。