Allow skipping the database need.

This commit is contained in:
Olivier 'reivilibre' 2021-03-10 15:27:49 +00:00
parent 93678709c7
commit c692e0acd2

View File

@ -147,10 +147,14 @@ class PostgresCommands(Recipe):
self.database = check_type(args.get("database"), str)
self.commands = check_type(args.get("commands"), list)
self.skip_database_need = check_type(
args.get("skip_database_need", False), bool
)
def prepare(self, preparation: Preparation, head: Head) -> None:
super().prepare(preparation, head)
preparation.needs("postgres-database", self.database)
if not self.skip_database_need:
preparation.needs("postgres-database", self.database)
async def cook(self, kitchen: Kitchen) -> None:
ch = await kitchen.start(PostgresTransaction(self.database))