Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore option to set a file #79

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Asm/Ansible/Command/AnsiblePlaybook.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down