Merge pull request #389 from jmencak/cond-profile-loading
Add conditional profile loading
This commit is contained in:
commit
7d62870d7d
1 changed files with 7 additions and 0 deletions
|
|
@ -31,6 +31,10 @@ class Locator(object):
|
|||
|
||||
def get_config(self, profile_name, skip_files=None):
|
||||
ret = None
|
||||
conditional_load = profile_name[0:1] == "-"
|
||||
if conditional_load:
|
||||
profile_name = profile_name[1:]
|
||||
|
||||
for dir_name in reversed(self._load_directories):
|
||||
# basename is protection not to get out of the path
|
||||
config_file = self._get_config_filename(dir_name, os.path.basename(profile_name))
|
||||
|
|
@ -42,6 +46,9 @@ class Locator(object):
|
|||
if os.path.isfile(config_file):
|
||||
return config_file
|
||||
|
||||
if conditional_load and ret is None:
|
||||
ret = ""
|
||||
|
||||
return ret
|
||||
|
||||
def check_profile_name_format(self, profile_name):
|
||||
|
|
|
|||
Loading…
Reference in a new issue