summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeon Anavi <leon.anavi@konsulko.com>2017-08-17 15:46:00 +0300
committerLeon Anavi <leon.anavi@konsulko.com>2017-08-17 15:56:43 +0300
commitdee9bf7a66253d782c1cb78ab57990774d00ec3e (patch)
tree0e8956e458feff1b3c9b400060500808ca20dbb3
parent8a0ef9f142555c553d714668c611eae3df9f7a89 (diff)
downloadmeta-updater-dee9bf7a66253d782c1cb78ab57990774d00ec3e.tar.gz
Show warnings if credentials are not provided
Print warnings if variable SOTA_PACKED_CREDENTIALS is not set or if the specified file does not exist. Signed-off-by: Leon Anavi <leon.anavi@konsulko.com>
-rw-r--r--classes/image_types_ostree.bbclass23
1 files changed, 16 insertions, 7 deletions
diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass
index 6a1b33e..8c9f262 100644
--- a/classes/image_types_ostree.bbclass
+++ b/classes/image_types_ostree.bbclass
@@ -133,9 +133,11 @@ IMAGE_CMD_ostree () {
133 133
134 # deploy SOTA credentials 134 # deploy SOTA credentials
135 if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then 135 if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then
136 cp ${SOTA_PACKED_CREDENTIALS} var/sota/sota_provisioning_credentials.zip 136 if [ -e ${SOTA_PACKED_CREDENTIALS} ]; then
137 # Device should not be able to push data to treehub 137 cp ${SOTA_PACKED_CREDENTIALS} var/sota/sota_provisioning_credentials.zip
138 zip -d var/sota/sota_provisioning_credentials.zip treehub.json 138 # Device should not be able to push data to treehub
139 zip -d var/sota/sota_provisioning_credentials.zip treehub.json
140 fi
139 fi 141 fi
140 142
141 if [ -n "${SOTA_SECONDARY_ECUS}" ]; then 143 if [ -n "${SOTA_SECONDARY_ECUS}" ]; then
@@ -183,10 +185,17 @@ IMAGE_CMD_ostree () {
183IMAGE_TYPEDEP_ostreepush = "ostree" 185IMAGE_TYPEDEP_ostreepush = "ostree"
184IMAGE_DEPENDS_ostreepush = "sota-tools-native:do_populate_sysroot" 186IMAGE_DEPENDS_ostreepush = "sota-tools-native:do_populate_sysroot"
185IMAGE_CMD_ostreepush () { 187IMAGE_CMD_ostreepush () {
188 # Print warnings if credetials are not set or if the file has not been found.
186 if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then 189 if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then
187 garage-push --repo=${OSTREE_REPO} \ 190 if [ -e ${SOTA_PACKED_CREDENTIALS} ]; then
188 --ref=${OSTREE_BRANCHNAME} \ 191 garage-push --repo=${OSTREE_REPO} \
189 --credentials=${SOTA_PACKED_CREDENTIALS} \ 192 --ref=${OSTREE_BRANCHNAME} \
190 --cacert=${STAGING_ETCDIR_NATIVE}/ssl/certs/ca-certificates.crt 193 --credentials=${SOTA_PACKED_CREDENTIALS} \
194 --cacert=${STAGING_ETCDIR_NATIVE}/ssl/certs/ca-certificates.crt
195 else
196 bbwarn "SOTA_PACKED_CREDENTIALS file does not exist."
197 fi
198 else
199 bbwarn "SOTA_PACKED_CREDENTIALS not set. Please add SOTA_PACKED_CREDENTIALS."
191 fi 200 fi
192} 201}