Exemple #1
0
def create(args):
    try:
        r = Release(name=args.name)
        print('%s is already defined at %s' % (r.name, r.url))
        sys.exit(1)
    except NoReleaseFoundError:
        pass
    if args.dry_run:
        print('DRY RUN: would create new release:')
        print('Name: %s' % args.name)
        print('Product: %s' % args.product)
        print('Product Versions: %s' % args.product_version)
        print('Type: %s' % args.type)
        print('Program manager: %s' % args.program_manager)
        print('Blocker flags: %s' % args.blocker_flags)
        print('Default Brew tag: %s' % args.default_brew_tag)
        return
    r = Release.create(
        name=args.name,
        product=args.product,
        product_versions=args.product_version,
        type=args.type,
        program_manager=args.program_manager,
        blocker_flags=args.blocker_flags,
        default_brew_tag=args.default_brew_tag,
    )
    print('created new %s release' % args.name)
    print('visit %s to edit further' % r.edit_url)
Exemple #2
0
def list_advisories(args):
    try:
        r = Release(name=args.name)
    except NoReleaseFoundError:
        print('%s release not found' % args.name)
        sys.exit(1)
    advisories = r.advisories()
    if args.status == 'OPEN':  # an alias meaning "all open statuses"
        interested_status = ['NEW_FILES', 'QE', 'REL_PREP', 'IN_PUSH']
    else:
        interested_status = [args.status]

    if args.status:
        advisories = [
            a for a in advisories if a['status'] in interested_status
        ]
        if not advisories:
            print('no %s advisories found for release %s' %
                  (args.status, args.name))
    else:
        if not advisories:
            print('no advisories found for release %s' % args.name)
    for advisory in advisories:
        # hack, avoid initializing the full Erratum class just to get the URL:
        url = posixpath.join(ErrataConnector._url, 'errata',
                             str(advisory['id']))
        print('------------------------------')
        print('URL: %s' % url)
        print('synopsis: %s' % advisory['synopsis'])
        print('status: %s' % advisory['status'])
Exemple #3
0
 def test_plus(self, monkeypatch, mock_get):
     monkeypatch.setattr(requests, 'get', mock_get)
     release = Release(name='RHEL-8.4.0.Z.MAIN+EUS')
     assert release.name == 'RHEL-8.4.0.Z.MAIN+EUS'
     assert mock_get.response.url == self.expected_url
     assert mock_get.kwargs['params']['filter[name]'] == \
         'RHEL-8.4.0.Z.MAIN+EUS'
Exemple #4
0
def get(args):
    try:
        r = Release(name=args.name)
        print('Name: %s' % r.name)
        print('Description: %s' % r.description)
        print('URL: %s' % r.url)
    except NoReleaseFoundError:
        print('%s release not found' % args.name)
        sys.exit(1)
Exemple #5
0
 def test_plus_encoded(self, monkeypatch, mock_get, recwarn):
     monkeypatch.setattr(requests, 'get', mock_get)
     release = Release(name='RHEL-8.4.0.Z.MAIN%2BEUS')
     assert release.name == 'RHEL-8.4.0.Z.MAIN+EUS'
     assert mock_get.response.url == self.expected_url
     assert mock_get.kwargs['params']['filter[name]'] == \
         'RHEL-8.4.0.Z.MAIN+EUS'
     assert len(recwarn.list) == 1
     assert recwarn.pop(DeprecationWarning)
Exemple #6
0
def list_advisories(args):
    try:
        r = Release(name=args.name)
    except NoReleaseFoundError:
        print('%s release not found' % args.name)
        sys.exit(1)
    advisories = r.advisories()
    if args.status:
        advisories = [a for a in advisories if a['status'] == args.status]
        if not advisories:
            print('no %s advisories found for release %s' % (args.status,
                                                             args.name))
    else:
        if not advisories:
            print('no advisories found for release %s' % args.name)
    for advisory in advisories:
        # hack, avoid initializing the full Erratum class just to get the URL:
        url = posixpath.join(ErrataConnector._url, 'errata',
                             str(advisory['id']))
        print('------------------------------')
        print('URL: %s' % url)
        print('synopsis: %s' % advisory['synopsis'])
        print('status: %s' % advisory['status'])
Exemple #7
0
def release(monkeypatch, mock_get):
    monkeypatch.delattr('requests.sessions.Session.request')
    monkeypatch.setattr(ErrataConnector, '_auth', None)
    monkeypatch.setattr(requests, 'get', mock_get)
    return Release(name='rhceph-3.0')