mirror of https://github.com/docker/docs.git
Merge pull request #2149 from mnowster/2146-improve-bool-warning-message
Improve boolean warning message.
This commit is contained in:
commit
dbe311caaa
|
@ -57,9 +57,9 @@ def format_boolean_in_environment(instance):
|
||||||
"""
|
"""
|
||||||
if isinstance(instance, bool):
|
if isinstance(instance, bool):
|
||||||
log.warn(
|
log.warn(
|
||||||
"Warning: There is a boolean value, {0} in the 'environment' key.\n"
|
"Warning: There is a boolean value in the 'environment' key.\n"
|
||||||
"Environment variables can only be strings.\nPlease add quotes to any boolean values to make them string "
|
"Environment variables can only be strings.\nPlease add quotes to any boolean values to make them string "
|
||||||
"(eg, '{0}').\nThis warning will become an error in a future release. \r\n".format(instance)
|
"(eg, 'True', 'yes', 'N').\nThis warning will become an error in a future release. \r\n"
|
||||||
)
|
)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
|
@ -319,7 +319,7 @@ class ConfigTest(unittest.TestCase):
|
||||||
|
|
||||||
@mock.patch('compose.config.validation.log')
|
@mock.patch('compose.config.validation.log')
|
||||||
def test_logs_warning_for_boolean_in_environment(self, mock_logging):
|
def test_logs_warning_for_boolean_in_environment(self, mock_logging):
|
||||||
expected_warning_msg = "Warning: There is a boolean value, True in the 'environment' key."
|
expected_warning_msg = "Warning: There is a boolean value in the 'environment' key."
|
||||||
config.load(
|
config.load(
|
||||||
build_config_details(
|
build_config_details(
|
||||||
{'web': {
|
{'web': {
|
||||||
|
|
Loading…
Reference in New Issue