Skip to content

Commit

Permalink
Merge branch 'petericebear-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
hiddeco committed Mar 24, 2016
2 parents e04fd85 + a125380 commit a4cf280
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 1 deletion.
44 changes: 44 additions & 0 deletions doc/vps.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,50 @@ $client->vps()->getOperatingSystems();
$client->vps()->installOperatingSystem('fooVps', 'ubuntu-14.04-transip', 'baymax.foo.com');
````

#### Install an operating system Unattended on a VPS.
````php
try {
$base64InstallText = base64_encode('
## Mirror settings
d-i mirror/country string manual
d-i mirror/http/hostname string mirror.transip.net
d-i mirror/http/directory string /debian/debian

## Automatically choose keymapping, since VNC client will translate to the clients one
d-i keymap select us

## Automatically select the networking interface
d-i netcfg/choose_interface select auto

## Install ACPId so the machine is responsive to Ctrl+Alt+Del etc
d-i pkgsel/include string acpid

# Any hostname and domain names assigned from dhcp take precedence over
# values set here. However, setting the values still prevents the questions
# from being shown, even if values come from dhcp.
d-i netcfg/get_hostname string test-vps
d-i netcfg/get_domain string example.com

# Controls whether or not the hardware clock is set to UTC.
d-i clock-setup/utc boolean true

# You may set this to any valid setting for $TZ; see the contents of
# /usr/share/zoneinfo/ for valid values.
d-i time/zone string Europe/Amsterdam

# Controls whether to use NTP to set the clock during the install
d-i clock-setup/ntp boolean true
');

$client->vps()->installOperatingSystemUnattended('fooVps','debian-8',$base64InstallText);
echo 'Operating system install in progress';
} catch (SoapFault $f) {
// It is possible that an error occurs when connecting to the TransIP Soap API,
// those errors will be thrown as a SoapFault exception.
echo 'An error occurred: ' . $f->getMessage(), PHP_EOL;
}
````

#### Get IP addresses for a VPS.
````php
$client->vps()->getIpsForVps('fooVps');
Expand Down
16 changes: 16 additions & 0 deletions src/Api/Vps.php
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,22 @@ public function installOperatingSystem($vpsName, $operatingSystemName, $hostname
return $this->call(self::SERVICE, 'installOperatingSystem', [$vpsName, $operatingSystemName, $hostname]);
}

/**
* Install an operating system on a vps with a unattended installfile.
*
* @param string $vpsName The name of the VPS
* @param string $operatingSystemName The name of the operating to install
* @param string $base64InstallText base64_encoded preseed/kickstart text
*
* @throws \SoapFault
*
* @return mixed
*/
public function installOperatingSystemUnattended($vpsName, $operatingSystemName, $base64InstallText)
{
return $this->call(self::SERVICE, 'installOperatingSystemUnattended', [$vpsName, $operatingSystemName, $base64InstallText]);
}

/**
* Get IP addresses for a VPS.
*
Expand Down
2 changes: 1 addition & 1 deletion src/Soap/SoapClientDirector.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
class SoapClientDirector
{
const CLIENT_VERSION = 5.2;
const CLIENT_VERSION = 5.3;

/**
* @var string
Expand Down

0 comments on commit a4cf280

Please sign in to comment.