Merge lp:~bteleaga/gwacl/windowsgwacl into lp:gwacl

Proposed by Bogdan Teleaga
Status: Merged
Approved by: Andrew Wilkins
Approved revision: 244
Merged at revision: 244
Proposed branch: lp:~bteleaga/gwacl/windowsgwacl
Merge into: lp:gwacl
Prerequisite: lp:~axwalk/gwacl/gwacl-update-version
Diff against target: 546 lines (+346/-27)
4 files modified
helpers_apiobjects_test.go (+66/-2)
management_base_test.go (+1/-1)
xmlobjects.go (+140/-10)
xmlobjects_test.go (+139/-14)
To merge this branch: bzr merge lp:~bteleaga/gwacl/windowsgwacl
Reviewer Review Type Date Requested Status
Andrew Wilkins (community) Approve
Review via email: mp+266090@code.launchpad.net

Commit message

This is a patch directly on top of https://code.launchpad.net/~axwalk/gwacl/gwacl-update-version/+merge/266071.

It adds some XML that will basically mean windows VM's can now be launched and resource extensions can be defined. New role and configuration set types have been defined.

Description of the change

This is a patch directly on top of https://code.launchpad.net/~axwalk/gwacl/gwacl-update-version/+merge/266071.

It adds some XML that will basically mean windows VM's can now be launched and resource extensions can be defined. New role and configuration set types have been defined.

To post a comment you must log in.
Revision history for this message
Andrew Wilkins (axwalk) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'helpers_apiobjects_test.go'
--- helpers_apiobjects_test.go 2014-12-02 00:36:45 +0000
+++ helpers_apiobjects_test.go 2015-07-28 13:15:20 +0000
@@ -48,6 +48,25 @@
48 return NewLinuxProvisioningConfigurationSet(hostname, username, password, customdata, disableSSH)48 return NewLinuxProvisioningConfigurationSet(hostname, username, password, customdata, disableSSH)
49}49}
5050
51func makeWindowsProvisioningConfiguration() *ConfigurationSet {
52 ComputerName := MakeRandomString(10)
53 Password := MakeRandomString(10)
54 AdminUsername := MakeRandomString(10)
55 TimeZone := MakeRandomString(10)
56 AdditionalUnattendContent := MakeRandomString(10)
57 CustomData := MakeRandomString(10)
58 EnableAutomaticUpdates := BoolToString(MakeRandomBool())
59
60 StoreLocation := MakeRandomString(10)
61 StoreName := MakeRandomString(10)
62 Thumbprint := MakeRandomString(10)
63 CertSettings := []CertificateSetting{CertificateSetting{StoreLocation, StoreName, Thumbprint}}
64
65 WinRMListener := &WinRMListener{WinRMProtocolHTTP, Thumbprint}
66
67 return NewWindowsProvisioningConfigurationSet(ComputerName, Password, EnableAutomaticUpdates, TimeZone, CertSettings, WinRMListener, AdminUsername, AdditionalUnattendContent, CustomData)
68}
69
51func makeOSVirtualHardDisk() *OSVirtualHardDisk {70func makeOSVirtualHardDisk() *OSVirtualHardDisk {
52 HostCaching := BoolToString(MakeRandomBool())71 HostCaching := BoolToString(MakeRandomBool())
53 DiskLabel := MakeRandomString(10)72 DiskLabel := MakeRandomString(10)
@@ -63,7 +82,7 @@
63 SourceImageName: SourceImageName}82 SourceImageName: SourceImageName}
64}83}
6584
66func makeRole() *Role {85func makeLinuxRole() *Role {
67 RoleSize := "ExtraSmall"86 RoleSize := "ExtraSmall"
68 RoleName := MakeRandomString(10)87 RoleName := MakeRandomString(10)
69 RoleType := "PersistentVMRole"88 RoleType := "PersistentVMRole"
@@ -77,6 +96,51 @@
77 ConfigurationSets: configset}96 ConfigurationSets: configset}
78}97}
7998
99func makeWindowsRole() *Role {
100 RoleSize := "ExtraSmall"
101 RoleName := MakeRandomString(10)
102 RoleType := "PersistentVMRole"
103 config := makeWindowsProvisioningConfiguration()
104 configset := []ConfigurationSet{*config}
105 provisionGuestAgent := BoolToString(MakeRandomBool())
106 resourceReference := makeWindowsResourceExtensionReference()
107
108 return &Role{
109 RoleSize: RoleSize,
110 RoleName: RoleName,
111 RoleType: RoleType,
112 ConfigurationSets: configset,
113 ProvisionGuestAgent: provisionGuestAgent,
114 ResourceExtensionReferences: &[]ResourceExtensionReference{*resourceReference},
115 }
116}
117
118func makeWindowsResourceExtensionReference() *ResourceExtensionReference {
119 refName := MakeRandomString(10)
120 publisher := MakeRandomString(10)
121 name := MakeRandomString(10)
122 version := MakeRandomString(10)
123 state := MakeRandomString(10)
124
125 param1 := makeWindowsResourceExtensionParameter(true)
126 param2 := makeWindowsResourceExtensionParameter(false)
127
128 return NewResourceExtensionReference(refName, publisher, name, version, state,
129 []ResourceExtensionParameter{*param1, *param2})
130}
131
132func makeWindowsResourceExtensionParameter(private bool) *ResourceExtensionParameter {
133 key := MakeRandomString(10)
134 value := MakeRandomString(10)
135 var paramType ResourceExtensionParameterType
136 if private {
137 paramType = ResourceExtensionParameterTypePrivate
138 } else {
139 paramType = ResourceExtensionParameterTypePublic
140 }
141 return NewResourceExtensionParameter(key, value, paramType)
142}
143
80func makeDnsServer() *DnsServer {144func makeDnsServer() *DnsServer {
81 name := MakeRandomString(10)145 name := MakeRandomString(10)
82 address := MakeRandomString(10)146 address := MakeRandomString(10)
@@ -91,7 +155,7 @@
91 DeploymentSlot := "Staging"155 DeploymentSlot := "Staging"
92 Label := MakeRandomString(10)156 Label := MakeRandomString(10)
93 VirtualNetworkName := MakeRandomString(10)157 VirtualNetworkName := MakeRandomString(10)
94 role := makeRole()158 role := makeLinuxRole()
95 RoleList := []Role{*role}159 RoleList := []Role{*role}
96 Dns := []DnsServer{*makeDnsServer()}160 Dns := []DnsServer{*makeDnsServer()}
97161
98162
=== modified file 'management_base_test.go'
--- management_base_test.go 2015-07-28 13:15:20 +0000
+++ management_base_test.go 2015-07-28 13:15:20 +0000
@@ -706,7 +706,7 @@
706 serviceName := "serviceName"706 serviceName := "serviceName"
707 configurationSet := NewLinuxProvisioningConfigurationSet("testHostname12345", "test", "test123#@!", "user-data", "false")707 configurationSet := NewLinuxProvisioningConfigurationSet("testHostname12345", "test", "test123#@!", "user-data", "false")
708 vhd := NewOSVirtualHardDisk("hostCaching", "diskLabel", "diskName", "http://mediaLink", "sourceImageName", "os")708 vhd := NewOSVirtualHardDisk("hostCaching", "diskLabel", "diskName", "http://mediaLink", "sourceImageName", "os")
709 role := NewRole("ExtraSmall", "test-role-123", vhd, []ConfigurationSet{*configurationSet})709 role := NewLinuxRole("ExtraSmall", "test-role-123", vhd, []ConfigurationSet{*configurationSet})
710 deployment := NewDeploymentForCreateVMDeployment("test-machine-name", "Staging", "testLabel", []Role{*role}, "testNetwork")710 deployment := NewDeploymentForCreateVMDeployment("test-machine-name", "Staging", "testLabel", []Role{*role}, "testNetwork")
711 err := api.AddDeployment(deployment, serviceName)711 err := api.AddDeployment(deployment, serviceName)
712712
713713
=== modified file 'xmlobjects.go'
--- xmlobjects.go 2015-07-28 13:15:20 +0000
+++ xmlobjects.go 2015-07-28 13:15:20 +0000
@@ -35,13 +35,37 @@
35 return string(out), nil35 return string(out), nil
36}36}
3737
38// CertificateSetting specifies the parameters for the certificate which to
39// provision to the new Virtual Machine.
40type CertificateSetting struct {
41 StoreLocation string
42 StoreName string
43 Thumbprint string
44}
45
46// WinRMListener specifies the protocol and certificate information for a WinRM
47// listener.
48type WinRMListener struct {
49 Protocol WinRMProtocol
50 CertificateThumbprint string `xml:",omitempty"`
51}
52
53type WinRMProtocol string
54
55// Enum values for WinRMProtocol
56const (
57 WinRMProtocolHTTP WinRMProtocol = "Http"
58 WinRMProtocolHTTPS WinRMProtocol = "Https"
59)
60
38//61//
39// ConfigurationSet bits62// ConfigurationSet bits
40//63//
4164
42const (65const (
43 CONFIG_SET_LINUX_PROVISIONING = "LinuxProvisioningConfiguration"66 CONFIG_SET_LINUX_PROVISIONING = "LinuxProvisioningConfiguration"
44 CONFIG_SET_NETWORK = "NetworkConfiguration"67 CONFIG_SET_WINDOWS_PROVISIONING = "WindowsProvisioningConfiguration"
68 CONFIG_SET_NETWORK = "NetworkConfiguration"
45)69)
4670
47// A ConfigurationSet object can be different things depending on its 'type'.71// A ConfigurationSet object can be different things depending on its 'type'.
@@ -55,9 +79,19 @@
55 Hostname string `xml:"HostName,omitempty"`79 Hostname string `xml:"HostName,omitempty"`
56 Username string `xml:"UserName,omitempty"`80 Username string `xml:"UserName,omitempty"`
57 Password string `xml:"UserPassword,omitempty"`81 Password string `xml:"UserPassword,omitempty"`
58 CustomData string `xml:"CustomData,omitempty"`
59 DisableSSHPasswordAuthentication string `xml:"DisableSshPasswordAuthentication,omitempty"`82 DisableSSHPasswordAuthentication string `xml:"DisableSshPasswordAuthentication,omitempty"`
6083
84 // WindowsProvisioningConfiguration fields.
85 ComputerName string `xml:"ComputerName,omitempty"`
86 AdminPassword string `xml:"AdminPassword,omitempty"`
87 EnableAutomaticUpdates string `xml:"EnableAutomaticUpdates,omitempty"`
88 TimeZone string `xml:"TimeZone,omitempty"`
89 StoredCertificateSettings []CertificateSetting `xml:"StoredCertificateSettings,omitempty"`
90 WinRMListeners *WinRMListener `xml:"WinRM>Listeners>Listener,omitempty"`
91 AdminUsername string `xml:"AdminUsername,omitempty"`
92 AdditionalUnattendContent string `xml:"AdditionalUnattendContent,omitempty"`
93
94 CustomData string `xml:"CustomData,omitempty"`
61 // NetworkConfiguration fields.95 // NetworkConfiguration fields.
62 // We use slice pointers to work around a Go bug:96 // We use slice pointers to work around a Go bug:
63 // https://code.google.com/p/go/issues/detail?id=416897 // https://code.google.com/p/go/issues/detail?id=4168
@@ -98,6 +132,24 @@
98 }132 }
99}133}
100134
135func NewWindowsProvisioningConfigurationSet(
136 ComputerName, AdminPassword, EnableAutomaticUpdates string, TimeZone string,
137 StoredCertificateSettings []CertificateSetting, WinRMListeners *WinRMListener,
138 AdminUsername, AdditionalUnattendContent, CustomData string) *ConfigurationSet {
139 return &ConfigurationSet{
140 ConfigurationSetType: CONFIG_SET_WINDOWS_PROVISIONING,
141 ComputerName: ComputerName,
142 AdminPassword: AdminPassword,
143 EnableAutomaticUpdates: EnableAutomaticUpdates,
144 TimeZone: TimeZone,
145 StoredCertificateSettings: StoredCertificateSettings,
146 WinRMListeners: WinRMListeners,
147 AdminUsername: AdminUsername,
148 CustomData: CustomData,
149 AdditionalUnattendContent: AdditionalUnattendContent,
150 }
151}
152
101// NewNetworkConfiguration creates a ConfigurationSet of type "NetworkConfiguration".153// NewNetworkConfiguration creates a ConfigurationSet of type "NetworkConfiguration".
102func NewNetworkConfigurationSet(154func NewNetworkConfigurationSet(
103 inputEndpoints []InputEndpoint, subnetNames []string) *ConfigurationSet {155 inputEndpoints []InputEndpoint, subnetNames []string) *ConfigurationSet {
@@ -333,6 +385,69 @@
333 return fmt.Sprintf("http://%s.blob.core.windows.net/%s", StorageName, StoragePath)385 return fmt.Sprintf("http://%s.blob.core.windows.net/%s", StorageName, StoragePath)
334}386}
335387
388// ResourceExtensionReference contains a collection of resource extensions that
389// are to be installed on the Virtual Machine. The VM Agent must be installed on
390// the Virtual Machine to install resource extensions. For more information, see
391// Manage Extensions:
392//
393// https://msdn.microsoft.com/en-us/library/dn606311.aspx.
394type ResourceExtensionReference struct {
395 ReferenceName string `xml:"ReferenceName"`
396 Publisher string `xml:"Publisher"`
397 Name string `xml:"Name"`
398 Version string `xml:"Version"`
399 ParameterValues []ResourceExtensionParameter `xml:"ResourceExtensionParameterValues>ResourceExtensionParameterValue,omitempty"`
400 State string `xml:"State,omitempty"`
401}
402
403func (r *ResourceExtensionReference) Serialize() (string, error) {
404 return toxml(r)
405}
406
407func NewResourceExtensionReference(
408 ReferenceName, Publisher, Name, Version, State string,
409 ParameterValues []ResourceExtensionParameter,
410) *ResourceExtensionReference {
411 return &ResourceExtensionReference{
412 ReferenceName: ReferenceName,
413 Publisher: Publisher,
414 Name: Name,
415 Version: Version,
416 ParameterValues: ParameterValues,
417 State: State,
418 }
419}
420
421// ResourceExtensionParameter specifies the key, value, and type of a parameter that is passed to the
422// resource extension when it is installed.
423type ResourceExtensionParameter struct {
424 Key string
425 Value string
426 Type ResourceExtensionParameterType // If this value is set to Private, the parameter will not be returned by Get Deployment ().
427}
428
429type ResourceExtensionParameterType string
430
431// Enum values for ResourceExtensionParameterType
432const (
433 ResourceExtensionParameterTypePublic ResourceExtensionParameterType = "Public"
434 ResourceExtensionParameterTypePrivate ResourceExtensionParameterType = "Private"
435)
436
437func (r *ResourceExtensionParameter) Serialize() (string, error) {
438 return toxml(r)
439}
440
441func NewResourceExtensionParameter(
442 Key, Value string, Type ResourceExtensionParameterType,
443) *ResourceExtensionParameter {
444 return &ResourceExtensionParameter{
445 Key: Key,
446 Value: Value,
447 Type: Type,
448 }
449}
450
336type Role struct {451type Role struct {
337 XMLNS string `xml:"xmlns,attr,omitempty"`452 XMLNS string `xml:"xmlns,attr,omitempty"`
338 RoleName string `xml:"RoleName"`453 RoleName string `xml:"RoleName"`
@@ -341,12 +456,13 @@
341 MediaLocation string `xml:"MediaLocation,omitempty"`456 MediaLocation string `xml:"MediaLocation,omitempty"`
342 ConfigurationSets []ConfigurationSet `xml:"ConfigurationSets>ConfigurationSet"`457 ConfigurationSets []ConfigurationSet `xml:"ConfigurationSets>ConfigurationSet"`
343 // TODO(axw) ResourceExtensionReferences458 // TODO(axw) ResourceExtensionReferences
344 AvailabilitySetName string `xml:"AvailabilitySetName,omitempty"`459 ResourceExtensionReferences *[]ResourceExtensionReference `xml:"ResourceExtensionReferences>ResourceExtensionReference,omitempty"`
345 DataVirtualHardDisks *[]DataVirtualHardDisk `xml:"DataVirtualHardDisks>DataVirtualHardDisk,omitempty"`460 AvailabilitySetName string `xml:"AvailabilitySetName,omitempty"`
346 OSVirtualHardDisk *OSVirtualHardDisk `xml:"OSVirtualHardDisk,omitempty"`461 DataVirtualHardDisks *[]DataVirtualHardDisk `xml:"DataVirtualHardDisks>DataVirtualHardDisk,omitempty"`
347 RoleSize string `xml:"RoleSize"`462 OSVirtualHardDisk *OSVirtualHardDisk `xml:"OSVirtualHardDisk,omitempty"`
348 ProvisionGuestAgent bool `xml:"ProvisionGuestAgent,omitempty"`463 RoleSize string `xml:"RoleSize"`
349 DefaultWinRmCertificateThumbprint string `xml:"DefaultWinRmCertificateThumbprint,omitempty"`464 ProvisionGuestAgent string `xml:"ProvisionGuestAgent,omitempty"`
465 DefaultWinRmCertificateThumbprint string `xml:"DefaultWinRmCertificateThumbprint,omitempty"`
350 // TODO(axw) VMImageInput466 // TODO(axw) VMImageInput
351}467}
352468
@@ -358,7 +474,7 @@
358 return toxml(c)474 return toxml(c)
359}475}
360476
361func NewRole(RoleSize, RoleName string, vhd *OSVirtualHardDisk, ConfigurationSets []ConfigurationSet) *Role {477func newRole(RoleSize, RoleName string, vhd *OSVirtualHardDisk, ConfigurationSets []ConfigurationSet) *Role {
362 return &Role{478 return &Role{
363 RoleSize: RoleSize,479 RoleSize: RoleSize,
364 RoleName: RoleName,480 RoleName: RoleName,
@@ -368,6 +484,20 @@
368 }484 }
369}485}
370486
487func NewLinuxRole(RoleSize, RoleName string, vhd *OSVirtualHardDisk, ConfigurationSets []ConfigurationSet) *Role {
488 return newRole(RoleSize, RoleName, vhd, ConfigurationSets)
489}
490
491func NewWindowsRole(
492 RoleSize, RoleName string, vhd *OSVirtualHardDisk, ConfigurationSets []ConfigurationSet,
493 ResourceExtensionReferences *[]ResourceExtensionReference, ProvisionGuestAgent string,
494) *Role {
495 role := newRole(RoleSize, RoleName, vhd, ConfigurationSets)
496 role.ResourceExtensionReferences = ResourceExtensionReferences
497 role.ProvisionGuestAgent = ProvisionGuestAgent
498 return role
499}
500
371//501//
372// DnsServer bits502// DnsServer bits
373//503//
374504
=== modified file 'xmlobjects_test.go'
--- xmlobjects_test.go 2015-07-28 13:15:20 +0000
+++ xmlobjects_test.go 2015-07-28 13:15:20 +0000
@@ -22,7 +22,7 @@
22// Tests for Marshallers22// Tests for Marshallers
23//23//
2424
25func (suite *xmlSuite) TestConfigurationSet(c *C) {25func (suite *xmlSuite) TestLinuxConfigurationSet(c *C) {
26 config := makeLinuxProvisioningConfiguration()26 config := makeLinuxProvisioningConfiguration()
2727
28 xml, err := config.Serialize()28 xml, err := config.Serialize()
@@ -33,12 +33,52 @@
33 <HostName>%s</HostName>33 <HostName>%s</HostName>
34 <UserName>%s</UserName>34 <UserName>%s</UserName>
35 <UserPassword>%s</UserPassword>35 <UserPassword>%s</UserPassword>
36 <CustomData>%s</CustomData>
37 <DisableSshPasswordAuthentication>%v</DisableSshPasswordAuthentication>36 <DisableSshPasswordAuthentication>%v</DisableSshPasswordAuthentication>
37 <CustomData>%s</CustomData>
38 </ConfigurationSet>`)38 </ConfigurationSet>`)
39 expected := fmt.Sprintf(template, config.Hostname, config.Username,39 expected := fmt.Sprintf(template, config.Hostname, config.Username,
40 config.Password, config.CustomData,40 config.Password, config.DisableSSHPasswordAuthentication,
41 config.DisableSSHPasswordAuthentication)41 config.CustomData)
42 c.Check(strings.TrimSpace(xml), Equals, strings.TrimSpace(expected))
43}
44
45func (suite *xmlSuite) TestWindowsConfigurationSet(c *C) {
46 config := makeWindowsProvisioningConfiguration()
47
48 xml, err := config.Serialize()
49 c.Assert(err, IsNil)
50 template := dedent.Dedent(`
51 <ConfigurationSet>
52 <ConfigurationSetType>WindowsProvisioningConfiguration</ConfigurationSetType>
53 <ComputerName>%s</ComputerName>
54 <AdminPassword>%s</AdminPassword>
55 <EnableAutomaticUpdates>%s</EnableAutomaticUpdates>
56 <TimeZone>%v</TimeZone>
57 <StoredCertificateSettings>
58 <StoreLocation>%s</StoreLocation>
59 <StoreName>%s</StoreName>
60 <Thumbprint>%s</Thumbprint>
61 </StoredCertificateSettings>
62 <WinRM>
63 <Listeners>
64 <Listener>
65 <Protocol>%s</Protocol>
66 <CertificateThumbprint>%s</CertificateThumbprint>
67 </Listener>
68 </Listeners>
69 </WinRM>
70 <AdminUsername>%s</AdminUsername>
71 <AdditionalUnattendContent>%s</AdditionalUnattendContent>
72 <CustomData>%s</CustomData>
73 </ConfigurationSet>`)
74 expected := fmt.Sprintf(template, config.ComputerName, config.AdminPassword,
75 config.EnableAutomaticUpdates, config.TimeZone,
76 config.StoredCertificateSettings[0].StoreLocation,
77 config.StoredCertificateSettings[0].StoreName,
78 config.StoredCertificateSettings[0].Thumbprint,
79 config.WinRMListeners.Protocol, config.WinRMListeners.CertificateThumbprint,
80 config.AdminUsername, config.AdditionalUnattendContent,
81 config.CustomData)
42 c.Check(strings.TrimSpace(xml), Equals, strings.TrimSpace(expected))82 c.Check(strings.TrimSpace(xml), Equals, strings.TrimSpace(expected))
43}83}
4484
@@ -146,8 +186,8 @@
146 c.Check(strings.TrimSpace(xml), Equals, strings.TrimSpace(expected))186 c.Check(strings.TrimSpace(xml), Equals, strings.TrimSpace(expected))
147}187}
148188
149func (suite *xmlSuite) TestRole(c *C) {189func (suite *xmlSuite) TestLinuxRole(c *C) {
150 role := makeRole()190 role := makeLinuxRole()
151 config := role.ConfigurationSets[0]191 config := role.ConfigurationSets[0]
152192
153 xml, err := role.Serialize()193 xml, err := role.Serialize()
@@ -162,16 +202,101 @@
162 <HostName>%s</HostName>202 <HostName>%s</HostName>
163 <UserName>%s</UserName>203 <UserName>%s</UserName>
164 <UserPassword>%s</UserPassword>204 <UserPassword>%s</UserPassword>
165 <CustomData>%s</CustomData>
166 <DisableSshPasswordAuthentication>%v</DisableSshPasswordAuthentication>205 <DisableSshPasswordAuthentication>%v</DisableSshPasswordAuthentication>
206 <CustomData>%s</CustomData>
167 </ConfigurationSet>207 </ConfigurationSet>
168 </ConfigurationSets>208 </ConfigurationSets>
169 <RoleSize>%s</RoleSize>209 <RoleSize>%s</RoleSize>
170 </Role>`)210 </Role>`)
171 expected := fmt.Sprintf(template, role.RoleName,211 expected := fmt.Sprintf(template, role.RoleName,
172 config.ConfigurationSetType, config.Hostname, config.Username,212 config.ConfigurationSetType, config.Hostname, config.Username,
173 config.Password, config.CustomData,213 config.Password, config.DisableSSHPasswordAuthentication,
174 config.DisableSSHPasswordAuthentication, role.RoleSize)214 config.CustomData, role.RoleSize)
215 c.Check(strings.TrimSpace(xml), Equals, strings.TrimSpace(expected))
216}
217
218func (suite *xmlSuite) TestWindowsRole(c *C) {
219 role := makeWindowsRole()
220 config := role.ConfigurationSets[0]
221 resources := role.ResourceExtensionReferences
222 resource := (*resources)[0]
223
224 xml, err := role.Serialize()
225 c.Assert(err, IsNil)
226 template := dedent.Dedent(`
227 <Role>
228 <RoleName>%s</RoleName>
229 <RoleType>PersistentVMRole</RoleType>
230 <ConfigurationSets>
231 <ConfigurationSet>
232 <ConfigurationSetType>WindowsProvisioningConfiguration</ConfigurationSetType>
233 <ComputerName>%s</ComputerName>
234 <AdminPassword>%s</AdminPassword>
235 <EnableAutomaticUpdates>%s</EnableAutomaticUpdates>
236 <TimeZone>%v</TimeZone>
237 <StoredCertificateSettings>
238 <StoreLocation>%s</StoreLocation>
239 <StoreName>%s</StoreName>
240 <Thumbprint>%s</Thumbprint>
241 </StoredCertificateSettings>
242 <WinRM>
243 <Listeners>
244 <Listener>
245 <Protocol>%s</Protocol>
246 <CertificateThumbprint>%s</CertificateThumbprint>
247 </Listener>
248 </Listeners>
249 </WinRM>
250 <AdminUsername>%s</AdminUsername>
251 <AdditionalUnattendContent>%s</AdditionalUnattendContent>
252 <CustomData>%s</CustomData>
253 </ConfigurationSet>
254 </ConfigurationSets>
255 <ResourceExtensionReferences>
256 <ResourceExtensionReference>
257 <ReferenceName>%s</ReferenceName>
258 <Publisher>%s</Publisher>
259 <Name>%s</Name>
260 <Version>%s</Version>
261 <ResourceExtensionParameterValues>
262 <ResourceExtensionParameterValue>
263 <Key>%s</Key>
264 <Value>%s</Value>
265 <Type>%s</Type>
266 </ResourceExtensionParameterValue>
267 <ResourceExtensionParameterValue>
268 <Key>%s</Key>
269 <Value>%s</Value>
270 <Type>%s</Type>
271 </ResourceExtensionParameterValue>
272 </ResourceExtensionParameterValues>
273 <State>%s</State>
274 </ResourceExtensionReference>
275 </ResourceExtensionReferences>
276 <RoleSize>%s</RoleSize>
277 <ProvisionGuestAgent>%s</ProvisionGuestAgent>
278 </Role>`)
279 expected := fmt.Sprintf(template, role.RoleName,
280 config.ComputerName, config.AdminPassword,
281 config.EnableAutomaticUpdates, config.TimeZone,
282 config.StoredCertificateSettings[0].StoreLocation,
283 config.StoredCertificateSettings[0].StoreName,
284 config.StoredCertificateSettings[0].Thumbprint,
285 config.WinRMListeners.Protocol, config.WinRMListeners.CertificateThumbprint,
286 config.AdminUsername, config.AdditionalUnattendContent,
287 config.CustomData,
288 resource.ReferenceName, resource.Publisher, resource.Name,
289 resource.Version,
290 resource.ParameterValues[0].Key,
291 resource.ParameterValues[0].Value,
292 resource.ParameterValues[0].Type,
293 resource.ParameterValues[1].Key,
294 resource.ParameterValues[1].Value,
295 resource.ParameterValues[1].Type,
296 resource.State,
297 role.RoleSize,
298 role.ProvisionGuestAgent,
299 )
175 c.Check(strings.TrimSpace(xml), Equals, strings.TrimSpace(expected))300 c.Check(strings.TrimSpace(xml), Equals, strings.TrimSpace(expected))
176}301}
177302
@@ -712,8 +837,8 @@
712 <HostName>%s</HostName>837 <HostName>%s</HostName>
713 <UserName>%s</UserName>838 <UserName>%s</UserName>
714 <UserPassword>%s</UserPassword>839 <UserPassword>%s</UserPassword>
840 <DisableSshPasswordAuthentication>%v</DisableSshPasswordAuthentication>
715 <CustomData>%s</CustomData>841 <CustomData>%s</CustomData>
716 <DisableSshPasswordAuthentication>%v</DisableSshPasswordAuthentication>
717 </ConfigurationSet>842 </ConfigurationSet>
718 </ConfigurationSets>843 </ConfigurationSets>
719 <RoleSize>%s</RoleSize>844 <RoleSize>%s</RoleSize>
@@ -733,8 +858,8 @@
733 expected := fmt.Sprintf(template, deployment.Name,858 expected := fmt.Sprintf(template, deployment.Name,
734 deployment.DeploymentSlot, deployment.Label,859 deployment.DeploymentSlot, deployment.Label,
735 role.RoleName, config.ConfigurationSetType, config.Hostname,860 role.RoleName, config.ConfigurationSetType, config.Hostname,
736 config.Username, config.Password, config.CustomData,861 config.Username, config.Password, config.DisableSSHPasswordAuthentication,
737 config.DisableSSHPasswordAuthentication, role.RoleSize,862 config.CustomData, role.RoleSize,
738 deployment.VirtualNetworkName, dns.Name, dns.Address)863 deployment.VirtualNetworkName, dns.Name, dns.Address)
739 c.Check(strings.TrimSpace(xml), Equals, strings.TrimSpace(expected))864 c.Check(strings.TrimSpace(xml), Equals, strings.TrimSpace(expected))
740}865}
@@ -1034,7 +1159,7 @@
1034 deploymentSlot := "staging"1159 deploymentSlot := "staging"
1035 label := "deploymentLabel"1160 label := "deploymentLabel"
1036 vhd := NewOSVirtualHardDisk("hostCaching", "diskLabel", "diskName", "mediaLink", "sourceImageName", "os")1161 vhd := NewOSVirtualHardDisk("hostCaching", "diskLabel", "diskName", "mediaLink", "sourceImageName", "os")
1037 roles := []Role{*NewRole("size", "name", vhd, []ConfigurationSet{})}1162 roles := []Role{*NewLinuxRole("size", "name", vhd, []ConfigurationSet{})}
1038 virtualNetworkName := "network"1163 virtualNetworkName := "network"
10391164
1040 deployment := NewDeploymentForCreateVMDeployment(name, deploymentSlot, label, roles, virtualNetworkName)1165 deployment := NewDeploymentForCreateVMDeployment(name, deploymentSlot, label, roles, virtualNetworkName)
@@ -1305,7 +1430,7 @@
1305 configset := []ConfigurationSet{*config}1430 configset := []ConfigurationSet{*config}
1306 vhd := NewOSVirtualHardDisk("hostCaching", "diskLabel", "diskName", "mediaLink", "sourceImageName", "os")1431 vhd := NewOSVirtualHardDisk("hostCaching", "diskLabel", "diskName", "mediaLink", "sourceImageName", "os")
13071432
1308 role := NewRole(rolesize, rolename, vhd, configset)1433 role := NewLinuxRole(rolesize, rolename, vhd, configset)
1309 c.Check(role.RoleSize, Equals, rolesize)1434 c.Check(role.RoleSize, Equals, rolesize)
1310 c.Check(role.RoleName, Equals, rolename)1435 c.Check(role.RoleName, Equals, rolename)
1311 c.Check(role.ConfigurationSets, DeepEquals, configset)1436 c.Check(role.ConfigurationSets, DeepEquals, configset)

Subscribers

People subscribed via source and target branches

to all changes: