Skip to content

Commit

Permalink
[4.8] Add support to disable installation of DO agent (#322)
Browse files Browse the repository at this point in the history
* add $disable_agent support

Based on https://docs.digitalocean.com/products/droplets/how-to/manage-agent/ with_droplet_agent parameter

* fix: correct api call to false bool

* Update Droplet.php

---------

Co-authored-by: Graham Campbell <GrahamCampbell@users.noreply.github.com>
  • Loading branch information
dbfx and GrahamCampbell committed Oct 8, 2023
1 parent 6497159 commit 08bbf3b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Api/Droplet.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,13 @@ public function getById(int $id)
* @param bool $monitoring
* @param array $volumes
* @param array $tags
* @param bool $disableAgent
*
* @throws ExceptionInterface
*
* @return DropletEntity|DropletEntity[]|null
*/
public function create($names, string $region, string $size, $image, bool $backups = false, bool $ipv6 = false, $vpcUuid = false, array $sshKeys = [], string $userData = '', bool $monitoring = true, array $volumes = [], array $tags = [])
public function create($names, string $region, string $size, $image, bool $backups = false, bool $ipv6 = false, $vpcUuid = false, array $sshKeys = [], string $userData = '', bool $monitoring = true, array $volumes = [], array $tags = [], bool $disableAgent = false)
{
$data = \is_array($names) ? ['names' => $names] : ['name' => $names];

Expand All @@ -117,6 +118,10 @@ public function create($names, string $region, string $size, $image, bool $backu
'monitoring' => $monitoring ? 'true' : 'false',
]);

if ($disableAgent) {
$data['with_droplet_agent'] = 'false';
}

if (0 < \count($sshKeys)) {
$data['ssh_keys'] = $sshKeys;
}
Expand Down

0 comments on commit 08bbf3b

Please sign in to comment.