File tree Expand file tree Collapse file tree 3 files changed +9
-5
lines changed
Expand file tree Collapse file tree 3 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -268,9 +268,13 @@ def _get_volumes(data):
268268def _expand_path (in_str ):
269269 try :
270270 output = expand_env_vars (in_str )
271- except ( KeyError , ValueError ) :
271+ except KeyError as ke :
272272 # pylint: disable=raise-missing-from
273- raise ConfigError ("Unset environmental variable used in '{}'" .format (in_str ))
273+ raise ConfigError ("Unset environment variable '{}' used in '{}'" .format (ke .args [0 ], in_str ))
274+ except ValueError as ve :
275+ raise ConfigError ("Unable to expand string '{}' due to parsing "
276+ "errors" .format (in_str )) from ve
277+
274278 return output
275279
276280class ScubaVolume :
Original file line number Diff line number Diff line change @@ -82,7 +82,7 @@ def writeln(f, line):
8282 f .write (line + '\n ' )
8383
8484def expand_env_vars (in_str ):
85- """Expand environmental variables in a string
85+ """Expand environment variables in a string
8686
8787 Can raise `KeyError` if a variable is referenced but not defined, similar to
8888 bash's nounset (set -u) option"""
Original file line number Diff line number Diff line change @@ -885,7 +885,7 @@ def test_alias_volumes_set(self):
885885 assert v .options == ['z' , 'ro' ]
886886
887887 def test_volumes_with_env_vars_simple (self ):
888- '''volume definitions can contain environmental variables'''
888+ '''volume definitions can contain environment variables'''
889889 os .environ ["TEST_VOL_PATH" ] = "/bar/baz"
890890 os .environ ["TEST_VOL_PATH2" ] = "/moo/doo"
891891 with open ('.scuba.yml' , 'w' ) as f :
@@ -906,7 +906,7 @@ def test_volumes_with_env_vars_simple(self):
906906 assert v .options == []
907907
908908 def test_volumes_with_env_vars_complex (self ):
909- '''complex volume definitions can contain environmental variables'''
909+ '''complex volume definitions can contain environment variables'''
910910 os .environ ["TEST_HOME" ] = "/home/testuser"
911911 os .environ ["TEST_TMP" ] = "/tmp"
912912 os .environ ["TEST_MAIL" ] = "/var/spool/mail/testuser"
You can’t perform that action at this time.
0 commit comments