~julian-edwards/gwacl/user-data-config

« back to all changes in this revision

Viewing changes to example/management/run.go

  • Committer: Julian Edwards
  • Date: 2013-07-01 01:36:03 UTC
  • Revision ID: julian.edwards@canonical.com-20130701013603-lw1lok0o9nj6e5lg
Optional pausing after VM startup

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
var certFile string
22
22
var subscriptionID string
23
23
var verbose bool
 
24
var pause bool
24
25
 
25
26
func getParams() error {
26
27
    flag.StringVar(&certFile, "cert", "", "Name of your management certificate file (in PEM format).")
27
28
    flag.StringVar(&subscriptionID, "subscriptionid", "", "Your Azure subscription ID.")
28
29
    flag.BoolVar(&verbose, "verbose", false, "Print debugging output")
 
30
    flag.BoolVar(&pause, "pause", false, "Wait for user input after the VM is brought up (useful for further testing)")
29
31
 
30
32
    flag.Parse()
31
33
 
128
130
    fmt.Println("Adding VM deployment...")
129
131
    hostname := makeRandomIdentifier("gwaclhost", 25)
130
132
    password := "Ubuntu123"
131
 
    //password := makeRandomIdentifier("pwd-", 16)
132
133
    vhdName := makeRandomIdentifier("gwacldisk", 16)
133
134
    configurationSet := gwacl.NewLinuxProvisioningConfiguration(hostname, "ubuntu", password, "TEST_USER_DATA", false)
134
135
 
163
164
    fmt.Printf("Got %d instance(s)\n", len(instances))
164
165
    fmt.Println("Done listing VM\n")
165
166
 
166
 
    var wait string
167
 
    fmt.Println("TYPE SOMETHING AND PRESS ENTER TO TERMINATE EVERYTHING")
168
 
    fmt.Scan(&wait)
 
167
    if pause {
 
168
        var wait string
 
169
        fmt.Println("Pausing so you can play with the newly-created VM")
 
170
        fmt.Println("To clear up, type something and press enter to continue")
 
171
        fmt.Scan(&wait)
 
172
    }
169
173
 
170
174
    fmt.Println("Stopping VM...")
171
175
    err = api.ShutdownRole(&gwacl.ShutdownRoleRequest{hostServiceName, deployment.Name, role.RoleName})