Dim default settings file deprecation warning

There's no reason to show it, if FUELCLIENT_CUSTOM_SETTINGS
variable is already set and the problem won't happen after
the actual deprecation.

Closes-bug: #1426331
Change-Id: I3ad3e7d4b3e90edfd93e0ff707c6ea3365d38f81
This commit is contained in:
Roman Prykhodchenko
2015-03-05 12:12:38 +01:00
parent 4eb787f1ad
commit 1b74dfa3fa

View File

@@ -49,10 +49,12 @@ class FuelClientSettings(object):
project_settings_file = os.path.join(project_path,
'fuelclient_settings.yaml')
external_default_settings = '/etc/fuel/client/config.yaml'
external_user_settings = os.environ.get('FUELCLIENT_CUSTOM_SETTINGS')
# NOTE(romcheg): when external default settings file is removed
# this deprecation warning should be removed as well.
if os.path.exists(external_default_settings):
if os.path.exists(external_default_settings) and \
external_default_settings != external_user_settings:
six.print_('DEPRECATION WARNING: file {0} is found and will be '
'used as a source for settings. However, it deprecated '
'and will not be used by default in the ongoing '
@@ -64,8 +66,7 @@ class FuelClientSettings(object):
self._add_file_if_exists(external_default_settings, settings_files)
# Add a custom settings file specified by user
self._add_file_if_exists(os.environ.get('FUELCLIENT_CUSTOM_SETTINGS'),
settings_files)
self._add_file_if_exists(external_user_settings, settings_files)
self.config = {}
for sf in settings_files: