Browse Source

Skip label if some config file was passed by stdin

com.docker.compose.project.config_files must contain valid file paths

Signed-off-by: Nicolas De Loof <[email protected]>
Nicolas De Loof 6 years ago
parent
commit
fa9e8bd641
1 changed files with 13 additions and 7 deletions
  1. 13 7
      compose/cli/command.py

+ 13 - 7
compose/cli/command.py

@@ -159,22 +159,28 @@ def get_project(project_dir, config_path=None, project_name=None, verbose=False,
 
 def execution_context_labels(config_details, environment_file):
     extra_labels = [
-        '{0}={1}'.format(LABEL_WORKING_DIR, os.path.abspath(config_details.working_dir)),
-        '{0}={1}'.format(LABEL_CONFIG_FILES, config_files_label(config_details)),
+        '{0}={1}'.format(LABEL_WORKING_DIR, os.path.abspath(config_details.working_dir))
     ]
+
+    if not use_config_from_stdin(config_details):
+        extra_labels.append('{0}={1}'.format(LABEL_CONFIG_FILES, config_files_label(config_details)))
+
     if environment_file is not None:
         extra_labels.append('{0}={1}'.format(LABEL_ENVIRONMENT_FILE,
                                              os.path.normpath(environment_file)))
     return extra_labels
 
 
-def config_files_label(config_details):
-    return ",".join(
-        map(str, (config_file_path(c.filename) for c in config_details.config_files)))
+def use_config_from_stdin(config_details):
+    for c in config_details.config_files:
+        if not c.filename:
+            return True
+    return False
 
 
-def config_file_path(config_file):
-    return os.path.normpath(config_file) if config_file else 'stdin'
+def config_files_label(config_details):
+    return ",".join(
+        map(str, (os.path.normpath(c.filename) for c in config_details.config_files)))
 
 
 def get_project_name(working_dir, project_name=None, environment=None):