@@ -97,7 +97,8 @@ def get_app_config(raw_config, base_image, config_file, source_dir):
9797
9898 entrypoint = validation_utils .get_field_value (raw_config , 'entrypoint' , str )
9999 if not PRINTABLE_REGEX .match (entrypoint ):
100- raise ValueError ('Invalid character in "entrypoint" field of app.yaml' )
100+ raise ValueError (
101+ 'Invalid "entrypoint" value in app.yaml: {!r}' .format (entrypoint ))
101102
102103 # Mangle entrypoint in the same way as the Cloud SDK
103104 # (googlecloudsdk/third_party/appengine/api/validation.py)
@@ -116,7 +117,8 @@ def get_app_config(raw_config, base_image, config_file, source_dir):
116117 valid_versions = str (sorted (PYTHON_INTERPRETER_VERSION_MAP .keys ()))
117118 raise ValueError (
118119 'Invalid "python_version" field in "runtime_config" section '
119- 'of app.yaml. Valid options are:\n {}' .format (valid_versions ))
120+ 'of app.yaml: {!r}. Valid options are: {}' .
121+ format (python_version , valid_versions ))
120122
121123 # Examine user's files
122124 has_requirements_txt = os .path .isfile (
@@ -167,14 +169,15 @@ def generate_files(app_config):
167169 else :
168170 optional_entrypoint = ''
169171
170- dockerfile = (
172+ dockerfile = '' . join ([
171173 get_data ('Dockerfile.preamble.template' ).format (
172- base_image = app_config .base_image ) +
174+ base_image = app_config .base_image ),
173175 get_data ('Dockerfile.virtualenv.template' ).format (
174- python_version = app_config .dockerfile_python_version ) +
175- optional_requirements_txt +
176- get_data ('Dockerfile.install_app' ) +
177- optional_entrypoint )
176+ python_version = app_config .dockerfile_python_version ),
177+ optional_requirements_txt ,
178+ get_data ('Dockerfile.install_app' ),
179+ optional_entrypoint ,
180+ ])
178181
179182 return {
180183 'Dockerfile' : dockerfile ,
@@ -193,7 +196,7 @@ def generate_dockerfile_command(base_image, config_file, source_dir):
193196 # Read yaml file. Does not currently support multiple services
194197 # with configuration filenames besides app.yaml
195198 with io .open (config_file , 'r' , encoding = 'utf8' ) as yaml_config_file :
196- raw_config = yaml .load (yaml_config_file )
199+ raw_config = yaml .safe_load (yaml_config_file )
197200
198201 # Determine complete configuration
199202 app_config = get_app_config (raw_config , base_image , config_file ,
0 commit comments