core (memory): fixed a case where getProfileName was returning an empty string instead of raising an errror
This commit is contained in:
parent
8e4180237f
commit
736dbfa1b4
1 changed files with 3 additions and 2 deletions
|
|
@ -194,7 +194,8 @@ class Params(object):
|
||||||
C.PROF_KEY_DEFAULT for default profile
|
C.PROF_KEY_DEFAULT for default profile
|
||||||
@param return_profile_keys: if True, return unmanaged profile keys (like C.PROF_KEY_ALL). This keys must be managed by the caller
|
@param return_profile_keys: if True, return unmanaged profile keys (like C.PROF_KEY_ALL). This keys must be managed by the caller
|
||||||
@return: requested profile name
|
@return: requested profile name
|
||||||
@raise exceptions.ProfileUnknownError if profile doesn't exists
|
@raise exceptions.ProfileUnknownError: profile doesn't exists
|
||||||
|
@raise exceptions.ProfileNotSetError: if C.PROF_KEY_NONE is used
|
||||||
"""
|
"""
|
||||||
if profile_key == '@DEFAULT@':
|
if profile_key == '@DEFAULT@':
|
||||||
default = self.host.memory.memory_data.get('Profile_default')
|
default = self.host.memory.memory_data.get('Profile_default')
|
||||||
|
|
@ -204,7 +205,7 @@ class Params(object):
|
||||||
default = self.host.memory.memory_data['Profile_default'] = self.storage.getProfilesList()[0]
|
default = self.host.memory.memory_data['Profile_default'] = self.storage.getProfilesList()[0]
|
||||||
except IndexError:
|
except IndexError:
|
||||||
log.info(_('No profile exist yet'))
|
log.info(_('No profile exist yet'))
|
||||||
return ""
|
raise exceptions.ProfileUnknownError
|
||||||
return default # FIXME: temporary, must use real default value, and fallback to first one if it doesn't exists
|
return default # FIXME: temporary, must use real default value, and fallback to first one if it doesn't exists
|
||||||
elif profile_key == C.PROF_KEY_NONE:
|
elif profile_key == C.PROF_KEY_NONE:
|
||||||
raise exceptions.ProfileNotSetError
|
raise exceptions.ProfileNotSetError
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue