How to use the koji.encode_args function in koji

To help you get started, we’ve selected a few koji examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github koji-project / koji / tests / test_lib / test_restart_tasks.py View on Github external
def get_handler(self, *args, **kwargs):
        params = koji.encode_args(*args, **kwargs)
        handler = koji.tasks.RestartHostsTask(137, 'restartHosts', params, self.session,
                    self.options)
        handler.wait = mock.MagicMock()
        handler.subtask = mock.MagicMock()
        return handler
github koji-project / koji / tests / test_lib / test_restart_tasks.py View on Github external
def get_handler(self, *args, **kwargs):
        params = koji.encode_args(*args, **kwargs)
        handler = koji.tasks.RestartVerifyTask(137, 'restartVerify', params, self.session,
                    self.options)
        # this is a foreground task
        handler.setManager(self.manager)
        return handler
github koji-project / koji / tests / test_lib / test_restart_tasks.py View on Github external
def get_handler(self, *args, **kwargs):
        params = koji.encode_args(*args, **kwargs)
        handler = koji.tasks.RestartTask(137, 'restart', params, self.session,
                    self.options)
        # this is a foreground task
        handler.setManager(self.manager)
        return handler
github koji-project / koji / plugins / hub / runroot_hub.py View on Github external
#get all known arches for the system
        fullarches = kojihub.get_all_arches()

        tagarches = tag['arches'].split()

        # If our tag can't do all arches, then we need to
        # specify one of the arches it can do.
        if set(fullarches) - set(tagarches):
            chanarches = get_channel_arches(taskopts['channel'])
            choices = [x for x in tagarches if x in chanarches]
            if not choices:
                raise koji.GenericError('no common arches for tag/channel: %s/%s' \
                            % (tagInfo, taskopts['channel']))
            taskopts['arch'] = koji.canonArch(random.choice(choices))

    args = koji.encode_args(tagInfo, arch, command, **opts)
    return kojihub.make_task('runroot', args, **taskopts)
github koji-project / koji / plugins / hub / runroot_hub.py View on Github external
#get all known arches for the system
        fullarches = kojihub.get_all_arches()

        tagarches = tag['arches'].split()

        # If our tag can't do all arches, then we need to
        # specify one of the arches it can do.
        if set(fullarches) - set(tagarches):
            chanarches = get_channel_arches(taskopts['channel'])
            choices = [x for x in tagarches if x in chanarches]
            if not choices:
                raise koji.GenericError('no common arches for tag/channel: %s/%s' \
                            % (tagInfo, taskopts['channel']))
            taskopts['arch'] = koji.canonArch(random.choice(choices))

    args = koji.encode_args(tagInfo, arch, command, **opts)
    return kojihub.make_task('runroot', args, **taskopts)
github koji-project / koji / plugins / hub / save_failed_tree.py View on Github external
allowed_methods = '*'

    brinfo = kojihub.get_buildroot(buildrootID, strict=True)
    taskID = brinfo['task_id']
    task_info = kojihub.Task(taskID).getInfo()
    if task_info['state'] != koji.TASK_STATES['FAILED']:
        raise koji.PreBuildError("Task %s has not failed. Only failed tasks can upload their buildroots." % taskID)
    elif allowed_methods != '*' and task_info['method'] not in allowed_methods:
        raise koji.PreBuildError("Only %s tasks can upload their buildroots (Task %s is %s)." % \
               (', '.join(allowed_methods), task_info['id'], task_info['method']))
    elif task_info["owner"] != context.session.user_id and not context.session.hasPerm('admin'):
        raise koji.ActionNotAllowed("Only owner of failed task or 'admin' can run this task.")
    elif not kojihub.get_host(task_info['host_id'])['enabled']:
        raise koji.PreBuildError("Host is disabled.")

    args = koji.encode_args(buildrootID, full, **opts)
    taskopts = {
        'assign': brinfo['host_id'],
    }
    return kojihub.make_task('saveFailedTree', args, **taskopts)