Merge lp:~rvb/gwacl/example-clean-up into lp:gwacl

Proposed by Raphaël Badin
Status: Merged
Approved by: Raphaël Badin
Approved revision: 219
Merged at revision: 218
Proposed branch: lp:~rvb/gwacl/example-clean-up
Merge into: lp:gwacl
Diff against target: 70 lines (+14/-10)
1 file modified
example/management/run.go (+14/-10)
To merge this branch: bzr merge lp:~rvb/gwacl/example-clean-up
Reviewer Review Type Date Requested Status
Gavin Panella Approve
Review via email: mp+180118@code.launchpad.net

Commit message

Use virtual network and affinity group in example script.

Description of the change

This branch fixes the management example script: now the created hosted service used the created affinity group and the created deployment is tied to the created virtual network.

Drive-by fix: only print the hostname/password/username when pausing (otherwise the host is short-lived anyway).

To post a comment you must log in.
Revision history for this message
Gavin Panella (allenap) wrote :

Consider wrapping some of the longer lines.

review: Approve
Revision history for this message
Raphaël Badin (rvb) wrote :

> Consider wrapping some of the longer lines.

Done, thanks for the review.

Revision history for this message
Julian Edwards (julian-edwards) wrote :

There are additional revisions which have not been approved in review. Please seek review and approval of these new revisions.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'example/management/run.go'
2--- example/management/run.go 2013-08-06 05:11:29 +0000
3+++ example/management/run.go 2013-08-14 13:09:44 +0000
4@@ -137,15 +137,16 @@
5 Infof("Getting OS Image for release '%s' and location '%s'...\n", release, location)
6 images, err := api.ListOSImages()
7 checkError(err)
8- preciseImage, err := images.GetLatestUbuntuImage(release, location)
9+ image, err := images.GetLatestUbuntuImage(release, location)
10 checkError(err)
11- sourceImageName := preciseImage.Name
12+ sourceImageName := image.Name
13 Infof("Got image named '%s'\n", sourceImageName)
14 Info("Done getting OS Image\n")
15
16 hostServiceName := gwacl.MakeRandomHostedServiceName("gwacl")
17 Infof("Creating a hosted service: '%s'...\n", hostServiceName)
18 createHostedService := gwacl.NewCreateHostedServiceWithLocation(hostServiceName, "testLabel", location)
19+ createHostedService.AffinityGroup = affinityGroupName
20 err = api.AddHostedService(createHostedService)
21 checkError(err)
22 Info("Done creating a hosted service\n")
23@@ -186,7 +187,8 @@
24 password := "Ubuntu123"
25 username := "ubuntu"
26 vhdName := gwacl.MakeRandomDiskName("gwacldisk")
27- linuxConfigurationSet := gwacl.NewLinuxProvisioningConfigurationSet(hostname, username, password, "TEST_USER_DATA", "false")
28+ linuxConfigurationSet := gwacl.NewLinuxProvisioningConfigurationSet(
29+ hostname, username, password, "TEST_USER_DATA", "false")
30 inputendpoint := gwacl.InputEndpoint{LocalPort: 22, Name: "sshport", Port: 22, Protocol: "TCP"}
31 networkConfigurationSet := gwacl.NewNetworkConfigurationSet([]gwacl.InputEndpoint{inputendpoint}, nil)
32
33@@ -210,9 +212,12 @@
34 diskLabel := makeRandomIdentifier("gwacl", 64)
35 vhd := gwacl.NewOSVirtualHardDisk("", diskLabel, diskName, mediaLink, sourceImageName, "Linux")
36 roleName := gwacl.MakeRandomRoleName("gwaclrole")
37- role := gwacl.NewRole("ExtraSmall", roleName, []gwacl.ConfigurationSet{*linuxConfigurationSet, *networkConfigurationSet}, []gwacl.OSVirtualHardDisk{*vhd})
38+ role := gwacl.NewRole("ExtraSmall", roleName,
39+ []gwacl.ConfigurationSet{*linuxConfigurationSet, *networkConfigurationSet},
40+ []gwacl.OSVirtualHardDisk{*vhd})
41 machineName := makeRandomIdentifier("gwaclmachine", 20)
42- deployment := gwacl.NewDeploymentForCreateVMDeployment(machineName, "Staging", machineName, []gwacl.Role{*role}, "")
43+ deployment := gwacl.NewDeploymentForCreateVMDeployment(
44+ machineName, "Production", machineName, []gwacl.Role{*role}, virtualNetworkName)
45 err = api.AddDeployment(deployment, hostServiceName)
46 checkError(err)
47 Info("Done adding VM deployment\n")
48@@ -236,11 +241,6 @@
49 checkError(err)
50 Info("Got deployment info\n")
51
52- Info("host:", fqdn)
53- Info("username:", username)
54- Info("password:", password)
55- Info("")
56-
57 Info("Adding role input endpoint...")
58 endpoint := gwacl.InputEndpoint{
59 Name: gwacl.MakeRandomHostname("endpoint-"),
60@@ -271,6 +271,10 @@
61
62 if pause {
63 var wait string
64+ fmt.Println("host:", fqdn)
65+ fmt.Println("username:", username)
66+ fmt.Println("password:", password)
67+ fmt.Println("")
68 fmt.Println("Pausing so you can play with the newly-created VM")
69 fmt.Println("To clear up, type something and press enter to continue")
70 fmt.Scan(&wait)

Subscribers

People subscribed via source and target branches

to all changes: