From a5dec7d7bd4f772e37a97108621c59ad1b237b98 Mon Sep 17 00:00:00 2001 From: Alex Crawford Date: Tue, 24 Jun 2014 17:39:48 -0700 Subject: [PATCH] cloudconfig: Process metadata before userdata This gives the options in userdata a higher precedence over metadata. --- coreos-cloudinit.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/coreos-cloudinit.go b/coreos-cloudinit.go index 5876828..8079bbc 100644 --- a/coreos-cloudinit.go +++ b/coreos-cloudinit.go @@ -98,6 +98,15 @@ func main() { } 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 err := processUserdata(string(userdataBytes), env); err != nil { fmt.Printf("Failed to process user-data: %v\n", err) @@ -108,15 +117,6 @@ func main() { } else { 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 {