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

Update composer.json & added exception to AnsiblePlaybook.php #64

Merged
merged 2 commits into from
Mar 2, 2021
Merged
Show file tree
Hide file tree
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
15 changes: 10 additions & 5 deletions Asm/Ansible/Command/AnsiblePlaybook.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,15 @@ public function extraVars($extraVars = ''): AnsiblePlaybookInterface
if (empty($extraVars))
return $this;

// Throw exception when $extraVars is an object
if (gettype($extraVars) === 'object') {
throw new InvalidArgumentException(sprintf('Expected string|array, got "%s"', gettype($extraVars)));
}

// Building the key=>value parameter
if (is_array($extraVars)){
if (is_array($extraVars)) {
$vars = [];
foreach ($extraVars as $key => $value){
foreach ($extraVars as $key => $value) {
$vars[] = sprintf('%s=%s', $key, $value);
}
$this->addOption('--extra-vars', implode(' ', $vars));
Expand Down Expand Up @@ -392,7 +397,7 @@ public function colors(bool $colors = true): AnsiblePlaybookInterface
*/
public function json(): AnsiblePlaybookInterface
{
$this->processBuilder->setEnv('ANSIBLE_STDOUT_CALLBACK','json');
$this->processBuilder->setEnv('ANSIBLE_STDOUT_CALLBACK', 'json');

return $this;
}
Expand Down Expand Up @@ -571,9 +576,9 @@ public function version(): AnsiblePlaybookInterface
*/
public function flushCache(): AnsiblePlaybookInterface
{
$this->addParameter('--flush-cache');
$this->addParameter('--flush-cache');

return $this;
return $this;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
}
],
"require": {
"php": "^7.1.0",
"php": "^7.1.0|>8.0.0",
"psr/log": "^1.1",
"symfony/process": "^4.0|^5.0"
},
Expand Down
Loading