1- from collections import OrderedDict
2-
31import os
2+ from collections import OrderedDict
43from pathlib import PurePosixPath
4+ from typing import TYPE_CHECKING , Union
55
6+ from configcrunch import variable_helper
67from dotenv import dotenv_values
78from schema import Schema , Optional , Or
8- from typing import TYPE_CHECKING , Union
99
10- from configcrunch import variable_helper
1110from riptide .config .document .common_service_command import ContainerDefinitionYamlConfigDocument
1211from riptide .config .files import get_project_meta_folder , CONTAINER_SRC_PATH
1312from riptide .config .service .config_files import process_config
1817 from riptide .config .document .project import Project
1918 from riptide .config .document .app import App
2019
21-
2220HEADER = 'command'
2321KEY_IDENTIFIER_IN_SERVICE_COMMAND = 'in_service_with_role'
2422
@@ -30,6 +28,7 @@ class Command(ContainerDefinitionYamlConfigDocument):
3028 Placed inside an :class:`riptide.config.document.app.App`.
3129
3230 """
31+
3332 @classmethod
3433 def header (cls ) -> str :
3534 return HEADER
@@ -273,7 +272,8 @@ def collect_volumes(self) -> OrderedDict:
273272 services_already_checked .append (service )
274273 for config_name , config in service ["config" ].items ():
275274 force_recreate = False
276- if "force_recreate" in service ["config" ][config_name ] and service ["config" ][config_name ]["force_recreate" ]:
275+ if "force_recreate" in service ["config" ][config_name ] and service ["config" ][config_name ][
276+ "force_recreate" ]:
277277 force_recreate = True
278278 bind_path = str (PurePosixPath ('/src/' ).joinpath (PurePosixPath (config ["to" ])))
279279 process_config (volumes , config_name , config , service , bind_path , regenerate = force_recreate )
@@ -308,7 +308,23 @@ def collect_environment(self) -> dict:
308308 :return: dict. Returned format is ``{key1: value1, key2: value2}``.
309309 """
310310 env = os .environ .copy ()
311- keys_to_remove = {"PATH" , "PS1" , "USERNAME" , "PWD" , "SHELL" , "HOME" , "TMPDIR" }.intersection (set (env .keys ()))
311+ keys_to_remove = {
312+ "PATH" ,
313+ "PS1" ,
314+ "USER" ,
315+ "USERNAME" ,
316+ "PWD" ,
317+ "SHELL" ,
318+ "HOME" ,
319+ "TMPDIR" ,
320+ "XDG_CACHE_HOME" ,
321+ "XDG_CONFIG_DIRS" ,
322+ "XDG_CONFIG_HOME" ,
323+ "XDG_DATA_DIRS" ,
324+ "XDG_DATA_HOME" ,
325+ "XDG_RUNTIME_DIR" ,
326+ "XDG_STATE_HOME"
327+ }.intersection (set (env .keys ()))
312328 for key in keys_to_remove :
313329 del env [key ]
314330
@@ -395,6 +411,7 @@ def volume_path(self) -> str:
395411 host: '/home/peter/my_projects/project1/_riptide/cmd_data/command_name/command_cache'
396412 container: '/foo/bar/cache'
397413 """
398- path = os .path .join (get_project_meta_folder (self .get_project ().folder ()), 'cmd_data' , self .internal_get ("$name" ))
414+ path = os .path .join (get_project_meta_folder (self .get_project ().folder ()), 'cmd_data' ,
415+ self .internal_get ("$name" ))
399416 os .makedirs (path , exist_ok = True )
400417 return path
0 commit comments