From 6b2d1413dfebfa05c460ac1b2b30354c2147cb07 Mon Sep 17 00:00:00 2001 From: Tom Janssen Date: Thu, 24 Mar 2022 15:48:55 +0100 Subject: [PATCH] restore option to set a file --- Asm/Ansible/Command/AnsiblePlaybook.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Asm/Ansible/Command/AnsiblePlaybook.php b/Asm/Ansible/Command/AnsiblePlaybook.php index 98dcfb4..5e9e159 100644 --- a/Asm/Ansible/Command/AnsiblePlaybook.php +++ b/Asm/Ansible/Command/AnsiblePlaybook.php @@ -175,7 +175,7 @@ public function diff(): AnsiblePlaybookInterface * * Example: * ```php - * $ansible = new Ansible()->playbook()->extraVars('/path/to/extra/vars.yml'); + * $ansible = new Ansible()->playbook()->extraVars('@"/path/to/extra/vars.yml"'); * ``` * * ## String @@ -210,8 +210,8 @@ public function extraVars(string|array $extraVars = ''): AnsiblePlaybookInterfac throw new InvalidArgumentException(sprintf('Expected string|array, got "%s"', gettype($extraVars))); } - if (!str_contains($extraVars, '=')) { - throw new InvalidArgumentException('The extra vars raw string should be in the "key=value" form.'); + if (!str_contains($extraVars, '=') && !str_starts_with($extraVars, '@')) { + throw new InvalidArgumentException('The extra vars raw string should either be in the "key=value" form or be a file path starting with @.'); } $this->addOption('--extra-vars', $extraVars);