From 5bf6526380be70723e90d589acb16b6877e17249 Mon Sep 17 00:00:00 2001 From: David Scott Date: Thu, 20 Jul 2017 10:54:43 +0100 Subject: [PATCH 1/2] metadata: avoid printing large chunks of configuration json to the console If the configuration .json has contents like: { "etc": { "ssl": { "certs": { "ca-certificates.crt": { "perm": "0644", "content": "large amount of certificate text" } } } }, ... } then we print a warning because the node "ssl" has no "perm". Previously the warning would include the contents of "ssl", which would be large (and in theory could include secret information). This patch modifies the warning print to only print the key and not the value. Without this patch, I see on the console: 2017/07/20 10:03:04 CDROM: Probe succeeded 2017/07/20 10:03:04 No permission provided ssl:map[certs:map[ca-certificates.crt:map[perm:0644 content:large amount of certificate text]]] - 000-metadata With this patch, I see on the console: 2017/07/20 09:54:18 CDROM: Probe succeeded 2017/07/20 09:54:18 No permission provided ssl - 000-metadata Signed-off-by: David Scott --- pkg/metadata/main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/metadata/main.go b/pkg/metadata/main.go index f447b2eda..b151137f0 100644 --- a/pkg/metadata/main.go +++ b/pkg/metadata/main.go @@ -173,11 +173,11 @@ func processUserData(data []byte) error { switch fi := i.(type) { case map[string]interface{}: if _, ok := fi["perm"]; !ok { - log.Printf("No permission provided %s:%s", f, fi) + log.Printf("No permission provided %s", f) continue } if _, ok := fi["content"]; !ok { - log.Printf("No content provided %s:%s", f, fi) + log.Printf("No content provided %s", f) continue } c = fi["content"].(string) From 13ff6d5d94a121b79ca3c4b5e761900190fbf169 Mon Sep 17 00:00:00 2001 From: David Scott Date: Thu, 20 Jul 2017 11:24:18 +0100 Subject: [PATCH 2/2] Update to linuxkit/metadata:428093dd1c4178e8ba1952af44b46c0fd16f8e79 Signed-off-by: David Scott --- blueprints/docker-for-mac/base.yml | 2 +- examples/aws.yml | 2 +- examples/gcp.yml | 2 +- examples/vultr.yml | 2 +- projects/etcd/etcd.yml | 2 +- projects/etcd/prom-us-central1-f.yml | 2 +- projects/kubernetes/kube-master.yml | 2 +- projects/kubernetes/kube-node.yml | 2 +- projects/swarmd/swarmd.yml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/blueprints/docker-for-mac/base.yml b/blueprints/docker-for-mac/base.yml index 81bf38cad..73a28713a 100644 --- a/blueprints/docker-for-mac/base.yml +++ b/blueprints/docker-for-mac/base.yml @@ -10,7 +10,7 @@ init: onboot: # support metadata for optional config in /var/config - name: metadata - image: linuxkit/metadata:f122f1b4e873f1d08cd67bd9105385fd923af0cb + image: linuxkit/metadata:428093dd1c4178e8ba1952af44b46c0fd16f8e79 - name: sysctl image: linuxkit/sysctl:d1a43c7c91e92374766f962dc8534cf9508756b0 - name: sysfs diff --git a/examples/aws.yml b/examples/aws.yml index 4c82b2e78..8d5942f61 100644 --- a/examples/aws.yml +++ b/examples/aws.yml @@ -13,7 +13,7 @@ onboot: image: linuxkit/dhcpcd:4b7b8bb024cebb1bbb9c8026d44d7cbc8e202c41 command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"] - name: metadata - image: linuxkit/metadata:f122f1b4e873f1d08cd67bd9105385fd923af0cb + image: linuxkit/metadata:428093dd1c4178e8ba1952af44b46c0fd16f8e79 services: - name: rngd image: linuxkit/rngd:1516d5d70683a5d925fe475eb1b6164a2f67ac3b diff --git a/examples/gcp.yml b/examples/gcp.yml index ff0223fe0..faaa80b55 100644 --- a/examples/gcp.yml +++ b/examples/gcp.yml @@ -13,7 +13,7 @@ onboot: image: linuxkit/dhcpcd:4b7b8bb024cebb1bbb9c8026d44d7cbc8e202c41 command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"] - name: metadata - image: linuxkit/metadata:f122f1b4e873f1d08cd67bd9105385fd923af0cb + image: linuxkit/metadata:428093dd1c4178e8ba1952af44b46c0fd16f8e79 services: - name: getty image: linuxkit/getty:0a2955f3d7a10a0e71972791c3ba6400118f327e diff --git a/examples/vultr.yml b/examples/vultr.yml index 79e049efe..8c2deb3f5 100644 --- a/examples/vultr.yml +++ b/examples/vultr.yml @@ -13,7 +13,7 @@ onboot: image: linuxkit/dhcpcd:4b7b8bb024cebb1bbb9c8026d44d7cbc8e202c41 command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"] - name: metadata - image: linuxkit/metadata:f122f1b4e873f1d08cd67bd9105385fd923af0cb + image: linuxkit/metadata:428093dd1c4178e8ba1952af44b46c0fd16f8e79 services: - name: getty image: linuxkit/getty:0a2955f3d7a10a0e71972791c3ba6400118f327e diff --git a/projects/etcd/etcd.yml b/projects/etcd/etcd.yml index 2df627226..088b2a14e 100644 --- a/projects/etcd/etcd.yml +++ b/projects/etcd/etcd.yml @@ -18,7 +18,7 @@ onboot: image: linuxkit/dhcpcd:4b7b8bb024cebb1bbb9c8026d44d7cbc8e202c41 command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"] - name: metadata - image: linuxkit/metadata:f122f1b4e873f1d08cd67bd9105385fd923af0cb + image: linuxkit/metadata:428093dd1c4178e8ba1952af44b46c0fd16f8e79 services: - name: rngd image: linuxkit/rngd:1516d5d70683a5d925fe475eb1b6164a2f67ac3b diff --git a/projects/etcd/prom-us-central1-f.yml b/projects/etcd/prom-us-central1-f.yml index d0d041048..409b2c2f3 100644 --- a/projects/etcd/prom-us-central1-f.yml +++ b/projects/etcd/prom-us-central1-f.yml @@ -13,7 +13,7 @@ onboot: image: linuxkit/dhcpcd:4b7b8bb024cebb1bbb9c8026d44d7cbc8e202c41 command: ["/sbin/dhcpcd", "--nobackground", "-f", "/dhcpcd.conf", "-1"] - name: metadata - image: linuxkit/metadata:f122f1b4e873f1d08cd67bd9105385fd923af0cb + image: linuxkit/metadata:428093dd1c4178e8ba1952af44b46c0fd16f8e79 services: - name: rngd image: mobylinux/rngd:3dad6dd43270fa632ac031e99d1947f20b22eec9 diff --git a/projects/kubernetes/kube-master.yml b/projects/kubernetes/kube-master.yml index 6ef31353d..c8060c19a 100644 --- a/projects/kubernetes/kube-master.yml +++ b/projects/kubernetes/kube-master.yml @@ -14,7 +14,7 @@ onboot: - name: binfmt image: linuxkit/binfmt:0bde4ebd422099f45c5ee03217413523ad2223e5 - name: metadata - image: linuxkit/metadata:f122f1b4e873f1d08cd67bd9105385fd923af0cb + image: linuxkit/metadata:428093dd1c4178e8ba1952af44b46c0fd16f8e79 - name: format image: linuxkit/format:84a997e69051a1bf05b7c1926ab785bb07932954 - name: mounts diff --git a/projects/kubernetes/kube-node.yml b/projects/kubernetes/kube-node.yml index 5a0d4a124..bd2e9e3a3 100644 --- a/projects/kubernetes/kube-node.yml +++ b/projects/kubernetes/kube-node.yml @@ -14,7 +14,7 @@ onboot: - name: binfmt image: linuxkit/binfmt:0bde4ebd422099f45c5ee03217413523ad2223e5 - name: metadata - image: linuxkit/metadata:f122f1b4e873f1d08cd67bd9105385fd923af0cb + image: linuxkit/metadata:428093dd1c4178e8ba1952af44b46c0fd16f8e79 - name: format image: linuxkit/format:84a997e69051a1bf05b7c1926ab785bb07932954 - name: mounts diff --git a/projects/swarmd/swarmd.yml b/projects/swarmd/swarmd.yml index 1471c2c9f..cc1be5b9a 100644 --- a/projects/swarmd/swarmd.yml +++ b/projects/swarmd/swarmd.yml @@ -20,7 +20,7 @@ onboot: image: linuxkit/mount:ac8939c4102f97c084d9ddfd445c1908fce6d768 command: ["/mount.sh", "/var/lib/swarmd"] - name: metadata - image: linuxkit/metadata:f122f1b4e873f1d08cd67bd9105385fd923af0cb + image: linuxkit/metadata:428093dd1c4178e8ba1952af44b46c0fd16f8e79 services: - name: getty image: linuxkit/getty:9f27c1272b6d128c9a09745e916f151d09cb0d27