Skip to content

Commit

Permalink
shellhub-rootfs-postcommand.bbclass: Allow overriding of Tenant ID
Browse files Browse the repository at this point in the history
The SHELLHUB_ROOTFS_TENANT_ID allow for override of existing ShellHub
Tenant ID during rootfs generation.

Signed-off-by: Otavio Salvador <[email protected]>
  • Loading branch information
otavio committed Sep 16, 2021
1 parent c26e296 commit 5de8a77
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions classes/shellhub-rootfs-postcommand.bbclass
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Allow overriding of ShellHub Tenant ID
#
# Required variable:
#
# SHELLHUB_ROOTFS_TENANT_ID
#
# The SHELLHUB_ROOTFS_TENANT_ID allow for override of existing ShellHub Tenant
# ID during rootfs generation.
#
# Copyright 2021 (C) O.S. Systems Software LTDA.


# Override the TENANT_ID from existing ShellHub configuration file.
ROOTFS_POSTPROCESS_COMMAND += 'shellhub_override_tenant_id ;'
shellhub_override_tenant_id () {
if [ ! -e "${IMAGE_ROOTFS}${sysconfdir}/default/shellhub-agent" ]; then
bbfatal "'${sysconfdir}/default/shellhub-agent' doesn't exist."
fi

if [ -z "${SHELLHUB_ROOTFS_TENANT_ID}" ]; then
bbfatal "SHELLHUB_ROOTFS_TENANT_ID variable is undefined."
fi

sed -i 's%^TENANT_ID=.*%TENANT_ID="${SHELLHUB_ROOTFS_TENANT_ID}"%g' \
${IMAGE_ROOTFS}${sysconfdir}/default/shellhub-agent
}

0 comments on commit 5de8a77

Please sign in to comment.