add buffer to read template into
This commit is contained in:
parent
0117f53721
commit
7d72870179
|
@ -1,6 +1,7 @@
|
||||||
package classic
|
package classic
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
"text/template"
|
"text/template"
|
||||||
|
|
||||||
|
@ -44,6 +45,7 @@ func (s *stepCreateIPReservation) Run(state multistep.StateBag) multistep.StepAc
|
||||||
ui.Say("Creating Instance...")
|
ui.Say("Creating Instance...")
|
||||||
|
|
||||||
// generate launch plan definition for this instance
|
// generate launch plan definition for this instance
|
||||||
|
var buffer bytes.Buffer
|
||||||
err = instanceTemplate.Execute(&buffer, instanceOptions{
|
err = instanceTemplate.Execute(&buffer, instanceOptions{
|
||||||
Username: config.Username,
|
Username: config.Username,
|
||||||
IdentityDomain: config.IdentityDomain,
|
IdentityDomain: config.IdentityDomain,
|
||||||
|
@ -55,10 +57,8 @@ func (s *stepCreateIPReservation) Run(state multistep.StateBag) multistep.StepAc
|
||||||
fmt.Printf("Error creating launch plan definition: %s", err)
|
fmt.Printf("Error creating launch plan definition: %s", err)
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
// command line call
|
// for API docs see
|
||||||
// $ opc compute launch-plans add --request-body=./master-instance.json
|
// https://docs.oracle.com/en/cloud/iaas/compute-iaas-cloud/stcsa/op-launchplan--post.html
|
||||||
// ...
|
|
||||||
|
|
||||||
instanceID, err := client.CreateInstance(publicKey)
|
instanceID, err := client.CreateInstance(publicKey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = fmt.Errorf("Problem creating instance: %s", err)
|
err = fmt.Errorf("Problem creating instance: %s", err)
|
||||||
|
|
Loading…
Reference in New Issue