cloudconfig: Process metadata before userdata

This gives the options in userdata a higher precedence over metadata.
This commit is contained in:
Alex Crawford 2014-06-24 17:39:48 -07:00
parent e1222c9885
commit a5dec7d7bd

View File

@ -98,6 +98,15 @@ func main() {
} }
env := initialize.NewEnvironment("/", ds.ConfigRoot(), workspace, convertNetconf, sshKeyName, subs) env := initialize.NewEnvironment("/", ds.ConfigRoot(), workspace, convertNetconf, sshKeyName, subs)
if len(metadataBytes) > 0 {
if err := processMetadata(string(metadataBytes), env); err != nil {
fmt.Printf("Failed to process meta-data: %v\n", err)
die()
}
} else {
fmt.Println("No meta-data to handle.")
}
if len(userdataBytes) > 0 { if len(userdataBytes) > 0 {
if err := processUserdata(string(userdataBytes), env); err != nil { if err := processUserdata(string(userdataBytes), env); err != nil {
fmt.Printf("Failed to process user-data: %v\n", err) fmt.Printf("Failed to process user-data: %v\n", err)
@ -108,15 +117,6 @@ func main() {
} else { } else {
fmt.Println("No user-data to handle.") fmt.Println("No user-data to handle.")
} }
if len(metadataBytes) > 0 {
if err := processMetadata(string(metadataBytes), env); err != nil {
fmt.Printf("Failed to process meta-data: %v\n", err)
die()
}
} else {
fmt.Println("No meta-data to handle.")
}
} }
func getDatasource() datasource.Datasource { func getDatasource() datasource.Datasource {