| 195 | self.pull_memory = set() |
| 196 | |
| 197 | def _execute_compose(self, *args, **kwargs): |
| 198 | # execute as a docker compose command |
| 199 | try: |
| 200 | result = super().run(f'--file={self.config.path}', *args, |
| 201 | env=self.config.env, **kwargs) |
| 202 | result.check_returncode() |
| 203 | except subprocess.CalledProcessError as e: |
| 204 | def formatdict(d, template): |
| 205 | return '\n'.join( |
| 206 | template.format(k, v) for k, v in sorted(d.items()) |
| 207 | ) |
| 208 | msg = ( |
| 209 | "`{cmd}` exited with a non-zero exit code {code}, see the " |
| 210 | "process log above.\n\nThe {bin} command was " |
| 211 | "invoked with the following parameters:\n\nDefaults defined " |
| 212 | "in .env:\n{dotenv}\n\nArchery was called with:\n{params}" |
| 213 | ) |
| 214 | raise RuntimeError( |
| 215 | msg.format( |
| 216 | cmd=' '.join(e.cmd), |
| 217 | code=e.returncode, |
| 218 | bin=self.bin, |
| 219 | dotenv=formatdict(self.config.dotenv, template=' {}: {}'), |
| 220 | params=formatdict( |
| 221 | self.config.params, template=' export {}={}' |
| 222 | ) |
| 223 | ) |
| 224 | ) |
| 225 | |
| 226 | def _execute_docker(self, *args, **kwargs): |
| 227 | # execute as a plain docker cli command |