On Thu, Mar 7, 2013 at 2:16 PM, Nishanth Aravamudan
<[email protected]> wrote:
> Use an RPC call, just like for specific hosts, for finding all possible
> profiles. We let the user shoot themselves in the foot (that is, they
> might select a profile that doesn't apply to that server), but that's
> the nature of selecting by label -- unless the label is a platform, we
> won't be able to do the lookup anyways in the install server.
>
> Update the create_job interface appropriately.
>
> Signed-off-by: Nishanth Aravamudan <[email protected]>
>
> ---
> I have not tested the cli submission of jobs yet. I *think* it should
> work similar to the regular host. But I need to look into it still.
>
>
> diff --git a/frontend/afe/rpc_interface.py b/frontend/afe/rpc_interface.py
> index e316af9..8308e1e 100644
> --- a/frontend/afe/rpc_interface.py
> +++ b/frontend/afe/rpc_interface.py
> @@ -264,6 +264,50 @@ def get_num_hosts(multiple_labels=(), 
> exclude_only_if_needed_labels=False,
>      return hosts.count()
>
>
> +def get_profiles():
> +    install_server = None
> +    install_server_info = get_install_server_info()
> +    install_server_type = install_server_info.get('type', None)
> +    install_server_url = install_server_info.get('xmlrpc_url', None)
> +
> +    if install_server_type == 'cobbler' and install_server_url:
> +        install_server = xmlrpclib.ServerProxy(install_server_url)
> +
> +    error_encountered = True
> +    profile_dicts = []
> +    if install_server is not None:
> +        profiles = install_server.get_item_names('profile')
> +
> +        if len(profiles) < 1:
> +            msg = 'No profiles defined on install server'
> +            rpc_logger = logging.getLogger('rpc_logger')
> +            rpc_logger.info(msg, host_dict['hostname'])
> +
> +        else:
> +            error_encountered = False
> +            # not sorted
> +            profiles.sort()
> +            profile_dicts.append(dict(name="Do_not_install"))
> +            for profile in profiles:
> +                profile_dicts.append(dict(name=profile))
> +
> +    if error_encountered:
> +       profile_dicts.append(dict(name="N/A"))

^ My scripts caught this, indentation slightly wrong.

_______________________________________________
Autotest-kernel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/autotest-kernel

Reply via email to