예제 #1
0
파일: errata.py 프로젝트: vfreex/elliott
def remove_bug(advisory_id, bug_id):
    """
    Remove a bug from advisory
    Response code will return
    """
    return ErrataConnector()._post(f"/api/v1/erratum/{advisory_id}/remove_bug",
                                   data={"bug": f"{bug_id}"})
예제 #2
0
파일: errata.py 프로젝트: vfreex/elliott
def remove_jira_issue(advisory_id, jira_issue_id):
    """
    Remove a jira issue from advisory
    Response code will return
    """
    return ErrataConnector()._post(
        f"/api/v1/erratum/{advisory_id}/remove_jira_issue",
        data={'jira_issue': jira_issue_id})
예제 #3
0
파일: errata.py 프로젝트: vfreex/elliott
def add_jira_issue(advisory_id, jira_issue_id):
    """
    Attach a jira issue to advisory
    Response code will return
    """
    return ErrataConnector()._post(
        f"/api/v1/erratum/{advisory_id}/add_jira_issue",
        data={'jira_issue': jira_issue_id})
예제 #4
0
파일: errata.py 프로젝트: vfreex/elliott
def get_raw_erratum(advisory_id):
    """
    Retrieve the raw dictionary object that we get for an erratum,
    without wasting time processing it, loading builds, etc.
    """
    return ErrataConnector()._get(f"/api/v1/erratum/{advisory_id}")
예제 #5
0
    def create(klass, name, product, product_versions, type, program_manager,
               default_brew_tag, blocker_flags, ship_date=None):
        """
        Create a new release in the ET.

        See https://bugzilla.redhat.com/1401608 for background.

        Note this method enforces certain conventions:
        * Always disables PDC for a release
        * Always creates the releases as "enabled"
        * Always allows multiple advisories per package
        * Description is always the combination of the product's own
          description (for example "Red Hat Ceph Storage") with the number
          from the latter part of the release's name. So a new "rhceph-3.0"
          release will have a description "Red Hat Ceph Storage 3.0".

        :param name: short name for this release, eg "rhceph-3.0"
        :param product: short name, eg. "RHCEPH".
        :param product_versions: list of names, eg. ["RHEL-7-CEPH-3"]
        :param type: "Zstream" or "QuarterlyUpdate"
        :param program_manager: for example "anharris" (Drew Harris, Ceph PgM)
        :param default_brew_tag: for example "ceph-3.0-rhel-7-candidate"
        :param blocker_flags: for example, "ceph-3.0"
        :param ship_date: date formatted as strftime("%Y-%b-%d"). For example,
                          "2017-Nov-17". If ommitted, the ship_date will
                          be set to today's date. (This can always be updated
                          later to match the ship date value in Product
                          Pages.)
        """
        product = Product(product)

        (_, number) = name.split('-', 1)
        description = '%s %s' % (product.description, number)

        program_manager = User(program_manager)

        product_version_ids = set([])
        for pv_name in product_versions:
            pv = ProductVersion(pv_name)
            product_version_ids.add(pv.id)

        if ship_date is None:
            today = date.today()
            ship_date = today.strftime("%Y-%b-%d")

        et = ErrataConnector()
        url = et._url + '/release/create'
        payload = {
            'type': type,
            'release[allow_blocker]': 0,
            'release[allow_exception]': 0,
            'release[allow_pkg_dupes]': 1,
            'release[allow_shadow]': 0,
            'release[blocker_flags]': blocker_flags,
            'release[default_brew_tag]': default_brew_tag,
            'release[description]': description,
            'release[enable_batching]': 0,
            'release[enabled]': 1,
            'release[is_deferred]': 0,
            'release[is_pdc]': 0,
            'release[name]': name,
            'release[product_id]': product.id,
            'release[product_version_ids][]': product_version_ids,
            'release[program_manager_id]': program_manager.id,
            'release[ship_date]': ship_date,
            'release[type]': type,
        }
        result = et._post(url, data=payload)
        if (sys.version_info > (3, 0)):
            body = result.text
        else:
            # Found during live testing:
            # UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1'
            # in position 44306: ordinal not in range(128)
            # Not sure why there was a non-ascii character in the ET's HTTP
            # response, but this fixes it.
            body = result.text.encode('utf-8')
        if result.status_code != 200:
            # help with debugging:
            print(body)
        result.raise_for_status()
        # We can get a 200 HTTP status_code here even when the POST failed to
        # create the release in the ET database. (This happens, for example, if
        # there are no Approved Components defined in Bugzilla for the release
        # flag, and the ET hits Bugzilla's XMLRPC::FaultException.)
        if 'field_errors' in body:
            print(body)
            raise ReleaseCreationError('see field_errors <div>')
        return klass(name=name)
예제 #6
0
 def test_ssl_default(self):
     """Ensure that we verify SSL by default. """
     e = ErrataConnector()
     assert e.ssl_verify