From 86d26bd8769c19128636f65ff1dcfe0eb5c5178e Mon Sep 17 00:00:00 2001 From: Michal Minar Date: Thu, 8 Aug 2013 10:15:24 +0200 Subject: software: let's not presume, that any url is associated with repo Fixed UnboundLocalError, when expecting, that at least mirror_list or some base_url of repository is available. --- src/software/lmi/software/core/IdentityResource.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/software') diff --git a/src/software/lmi/software/core/IdentityResource.py b/src/software/lmi/software/core/IdentityResource.py index 0853442..6ef21f7 100644 --- a/src/software/lmi/software/core/IdentityResource.py +++ b/src/software/lmi/software/core/IdentityResource.py @@ -551,6 +551,7 @@ def _fill_non_keys(repo, model): Fills into the model of instance all non-key properties. """ model['AccessContext'] = Values.AccessContext.Other + access_info = None if repo.mirror_list: access_info = repo.mirror_list elif repo.base_urls: @@ -559,10 +560,9 @@ def _fill_non_keys(repo, model): LOG().warn('multiple base urls found for repository "%s",' ' selecting the last one', repo) access_info = repo.base_urls[-1] - else: - LOG().error('no base url found for repository "%s"', repo) - access_info = pywbem.CIMProperty('AccessInfo', - None, type='string') + if access_info is None: + LOG().error('no base url found for repository "%s"', repo) + access_info = pywbem.CIMProperty('AccessInfo', None, type='string') model["AccessInfo"] = access_info model['AvailableRequestedStates'] = [ Values.AvailableRequestedStates.Enabled, -- cgit