@@ -64,7 +64,7 @@ class BaseExecutionMode(Enum):
64
64
65
65
# Metadata string values
66
66
class MetaValues (Enum ):
67
- STREAMABLE = 'streamable '
67
+ TRANSMIT = 'transmit '
68
68
69
69
70
70
@dataclass
@@ -82,38 +82,38 @@ class BaseConfig:
82
82
# No other config objects make use of positional parameters, so this should be fine.
83
83
#
84
84
# Example use case: RunnerConfig("/tmp/demo", playbook="main.yml", ...)
85
- private_data_dir : str | None = field (metadata = {MetaValues .STREAMABLE : False }, default = None )
85
+ private_data_dir : str | None = field (metadata = {MetaValues .TRANSMIT : False }, default = None )
86
86
87
- artifact_dir : str | None = field (metadata = {MetaValues .STREAMABLE : False }, default = None )
87
+ artifact_dir : str | None = field (metadata = {MetaValues .TRANSMIT : False }, default = None )
88
88
check_job_event_data : bool = False
89
89
container_auth_data : dict [str , str ] | None = None
90
- container_image : str = ""
90
+ container_image : str | None = None
91
91
container_options : list [str ] | None = None
92
92
container_volume_mounts : list [str ] | None = None
93
93
container_workdir : str | None = None
94
94
envvars : dict [str , Any ] | None = None
95
- fact_cache : str | None = field (metadata = {MetaValues .STREAMABLE : False }, default = None )
95
+ fact_cache : str | None = field (metadata = {MetaValues .TRANSMIT : False }, default = None )
96
96
fact_cache_type : str = 'jsonfile'
97
97
host_cwd : str | None = None
98
- ident : str | None = field (metadata = {MetaValues .STREAMABLE : False }, default = None )
98
+ ident : str | None = field (metadata = {MetaValues .TRANSMIT : False }, default = None )
99
99
json_mode : bool = False
100
- keepalive_seconds : int | None = field (metadata = {MetaValues .STREAMABLE : False }, default = None )
100
+ keepalive_seconds : int | None = field (metadata = {MetaValues .TRANSMIT : False }, default = None )
101
101
passwords : dict [str , str ] | None = None
102
102
process_isolation : bool = False
103
103
process_isolation_executable : str = defaults .default_process_isolation_executable
104
- project_dir : str | None = field (metadata = {MetaValues .STREAMABLE : False }, default = None )
104
+ project_dir : str | None = field (metadata = {MetaValues .TRANSMIT : False }, default = None )
105
105
quiet : bool = False
106
106
rotate_artifacts : int = 0
107
107
settings : dict | None = None
108
108
ssh_key : str | None = None
109
109
suppress_env_files : bool = False
110
110
timeout : int | None = None
111
111
112
- event_handler : Callable [[dict ], None ] | None = field (metadata = {MetaValues .STREAMABLE : False }, default = None )
113
- status_handler : Callable [[dict , BaseConfig ], bool ] | None = field (metadata = {MetaValues .STREAMABLE : False }, default = None )
114
- artifacts_handler : Callable [[str ], None ] | None = field (metadata = {MetaValues .STREAMABLE : False }, default = None )
115
- cancel_callback : Callable [[], bool ] | None = field (metadata = {MetaValues .STREAMABLE : False }, default = None )
116
- finished_callback : Callable [[BaseConfig ], None ] | None = field (metadata = {MetaValues .STREAMABLE : False }, default = None )
112
+ event_handler : Callable [[dict ], None ] | None = field (metadata = {MetaValues .TRANSMIT : False }, default = None )
113
+ status_handler : Callable [[dict , BaseConfig ], bool ] | None = field (metadata = {MetaValues .TRANSMIT : False }, default = None )
114
+ artifacts_handler : Callable [[str ], None ] | None = field (metadata = {MetaValues .TRANSMIT : False }, default = None )
115
+ cancel_callback : Callable [[], bool ] | None = field (metadata = {MetaValues .TRANSMIT : False }, default = None )
116
+ finished_callback : Callable [[BaseConfig ], None ] | None = field (metadata = {MetaValues .TRANSMIT : False }, default = None )
117
117
118
118
_CONTAINER_ENGINES = ('docker' , 'podman' )
119
119
@@ -123,6 +123,8 @@ def __post_init__(self) -> None:
123
123
self .command : list [str ] = []
124
124
self .registry_auth_path : str
125
125
self .container_name : str = "" # like other properties, not accurate until prepare is called
126
+ if self .container_image is None :
127
+ self .container_image = ''
126
128
127
129
# ignore this for now since it's worker-specific and would just trip up old runners
128
130
# self.keepalive_seconds = keepalive_seconds
@@ -139,6 +141,7 @@ def __post_init__(self) -> None:
139
141
raise ConfigurationError (f"Unable to create private_data_dir { self .private_data_dir } " ) from error
140
142
else :
141
143
self .private_data_dir = tempfile .mkdtemp (prefix = defaults .AUTO_CREATE_NAMING , dir = defaults .AUTO_CREATE_DIR )
144
+ register_for_cleanup (self .private_data_dir )
142
145
143
146
if self .artifact_dir is None :
144
147
self .artifact_dir = os .path .join (self .private_data_dir , 'artifacts' )
@@ -147,7 +150,9 @@ def __post_init__(self) -> None:
147
150
148
151
if self .ident is None :
149
152
self .ident = str (uuid4 ())
153
+ self .ident_set_by_user = False
150
154
else :
155
+ self .ident_set_by_user = True
151
156
self .ident = str (self .ident )
152
157
153
158
self .artifact_dir = os .path .join (self .artifact_dir , self .ident )
@@ -185,7 +190,6 @@ def prepare_env(self, runner_mode: str = 'pexpect') -> None:
185
190
Manages reading environment metadata files under ``private_data_dir`` and merging/updating
186
191
with existing values so the :py:class:`ansible_runner.runner.Runner` object can read and use them easily
187
192
"""
188
-
189
193
if self .ident is None :
190
194
raise ConfigurationError ("ident value cannot be None" )
191
195
if self .artifact_dir is None :
@@ -520,6 +524,9 @@ def wrap_args_for_containerization(self,
520
524
if self .private_data_dir is None :
521
525
raise ConfigurationError ("private_data_dir value cannot be None" )
522
526
527
+ if self .container_image is None :
528
+ raise ConfigurationError ("container_image value cannot be None" )
529
+
523
530
new_args = [self .process_isolation_executable ]
524
531
new_args .extend (['run' , '--rm' ])
525
532
0 commit comments