[PATCH] Improved support for koji profiles.

Pavol Babincak pbabinca at redhat.com
Tue Jul 14 09:26:31 UTC 2015


On 06/26/2015 10:00 AM, Daniel Mach wrote:
> ---
>   cli/koji         | 137 ++++++++++++-------------------------------------------
>   docs/profiles    |  57 +++++++++++++++++++++++
>   koji/__init__.py | 130 ++++++++++++++++++++++++++++++++++++++++++++++++++++
>   3 files changed, 215 insertions(+), 109 deletions(-)
>   create mode 100644 docs/profiles
>
> diff --git a/cli/koji b/cli/koji
> index f521d6d..29f26bb 100755
> --- a/cli/koji
> +++ b/cli/koji
> @@ -186,88 +186,9 @@ def get_options():
>           list_commands()
>           parser.error('Unknown command: %s' % args[0])
>           assert False
> -    # load local config
> -    defaults = {
> -        'server' : 'http://localhost/kojihub',
> -        'weburl' : 'http://localhost/koji',
> -        'topurl' : None,
> -        'pkgurl' : None,
> -        'topdir' : '/mnt/koji',
> -        'max_retries' : None,
> -        'retry_interval': None,
> -        'anon_retry' : None,
> -        'offline_retry' : None,
> -        'offline_retry_interval' : None,
> -        'keepalive' : True,
> -        'timeout' : None,
> -        'use_fast_upload': False,
> -        'poll_interval': 5,
> -        'krbservice': 'host',
> -        'cert': '~/.koji/client.crt',
> -        'ca': '~/.koji/clientca.crt',
> -        'serverca': '~/.koji/serverca.crt',
> -        'authtype': None
> -        }
This part of code was just moved between python modules (cli/koji -> 
koji/__init__.py). I believe it deserves its own commit where this will 
be obvious.

It seems you forget to rewrite koji.PathInfo in 
anon_handle_download_build().

> diff --git a/docs/profiles b/docs/profiles
> new file mode 100644
> index 0000000..2f21723
> --- /dev/null
> +++ b/docs/profiles
I believe this file should have .rst or .txt extension.

> diff --git a/koji/__init__.py b/koji/__init__.py
> index c0d5a30..dae52fc 100644
> --- a/koji/__init__.py
> +++ b/koji/__init__.py

> +def config_directory_contents(dir_name):
> +    configs = []
> +    try:
> +        conf_dir_contents = os.listdir(dir_name)
> +    except OSError, exception:
> +        if exception.errno != errno.ENOENT:
> +            raise
> +    else:
> +        for name in sorted(conf_dir_contents):
> +            if not name.endswith('.conf'):
> +                continue
> +            config_full_name = os.path.join(dir_name, name)
> +            configs.append(config_full_name)
> +    return configs
This function already exists in the same module.

I believe more obvious would have s/koji./koji_profile_module./ in the 
separate commit.

Because cli/koji isn't extensible python way we import the binary and 
add/modify some of the attributes (see [1]). It isn't obvious that I 
need to define global koji_profile_module otherwise some functions will 
fail. See for example linked_upload() or _printTaskInfo() functions.

[1] 
https://github.com/release-engineering/koji-containerbuild/blob/master/cli/koji-containerbuild
-- 
Pavol Babincak
Release Engineering, Red Hat


More information about the buildsys mailing list