Make installing the guest agent configurable

I know this would probably go into an option struct, but I think that
should be another refactor. So for now just added a `bool`.

And while touching this file I also made it’s 100+ lines a little
shorter which makes reviewing on GH a lot nicer.
This commit is contained in:
Sander van Harmelen 2015-05-18 17:54:28 +02:00
Родитель 8fc04323d5
Коммит 28c498647d
1 изменённых файлов: 20 добавлений и 6 удалений

Просмотреть файл

@ -10,7 +10,13 @@ import (
// image source. "remoteImageSourceURL" can be any publically accessible URL to
// a VHD file, including but not limited to a SAS Azure Storage blob url. "os"
// needs to be either "Linux" or "Windows". "label" is optional.
func ConfigureDeploymentFromRemoteImage(role *vm.Role, remoteImageSourceURL, os, newDiskName, destinationVhdStorageURL, label string) error {
func ConfigureDeploymentFromRemoteImage(
role *vm.Role,
remoteImageSourceURL string,
os string,
newDiskName string,
destinationVhdStorageURL string,
label string) error {
if role == nil {
return fmt.Errorf(errParamNotSpecified, "role")
}
@ -28,28 +34,36 @@ func ConfigureDeploymentFromRemoteImage(role *vm.Role, remoteImageSourceURL, os,
// ConfigureDeploymentFromPlatformImage configures VM Role to deploy from a
// platform image. See osimage package for methods to retrieve a list of the
// available platform images. "label" is optional.
func ConfigureDeploymentFromPlatformImage(role *vm.Role, imageName, destinationVhdStorageURL, label string) error {
func ConfigureDeploymentFromPlatformImage(
role *vm.Role,
imageName string,
mediaLink string,
label string) error {
if role == nil {
return fmt.Errorf(errParamNotSpecified, "role")
}
role.OSVirtualHardDisk = &vm.OSVirtualHardDisk{
SourceImageName: imageName,
MediaLink: destinationVhdStorageURL,
MediaLink: mediaLink,
}
return nil
}
// ConfigureDeploymentFromVMImage configures VM Role to deploy from a previously
// captured VM image.
func ConfigureDeploymentFromVMImage(role *vm.Role, vmImageName, destinationContainerStorageURL string) error {
func ConfigureDeploymentFromVMImage(
role *vm.Role,
vmImageName string,
mediaLocation string,
provisionGuestAgent bool) error {
if role == nil {
return fmt.Errorf(errParamNotSpecified, "role")
}
role.VMImageName = vmImageName
role.MediaLocation = destinationContainerStorageURL
role.ProvisionGuestAgent = false
role.MediaLocation = mediaLocation
role.ProvisionGuestAgent = provisionGuestAgent
return nil
}