env_setup_user_profile script will now ignore user's attributes which do not have a value
# See the License for the specific language governing permissions and
# limitations under the License.
+function is_jq_null() {
+ _VAL="$1"
+ if [ -z "$_VAL" ] || [ "$_VAL" == "null" ]; then
+ return 0
+ else
+ return 1
+ fi
+}
+
_OWNER_ATTRIBUTES_ENV_FILE="$1"
_OWNER_ATTRIBUTES_BLACKLIST="confirmed_notifications ssh_prv ssh_pub"
_OWNER_ATTRIBUTES_FILE_PATTERN="\"(.*)\" > \"(\\/.*)\""
@@ -69,6 +78,11 @@ for _ATTRIBUTE_NAME in $_OWNER_ATTRIBUTES_NAMES; do
continue
fi
+ if is_jq_null "$_ATTRIBUTE_ENV_VALUE"; then
+ echo "[WARN] Variable $_ATTRIBUTE_ENV_NAME has no value set, skipping it"
+ continue
+ fi
+
if [ -z "$CP_OWNER_ATTRIBUTES_WHITELIST" ] || \
( [ "$CP_OWNER_ATTRIBUTES_WHITELIST" ] && [[ " $CP_OWNER_ATTRIBUTES_WHITELIST " == *" ${_ATTRIBUTE_NAME} "* ]] ); then
if [[ $_ATTRIBUTE_ENV_VALUE =~ $_OWNER_ATTRIBUTES_FILE_PATTERN ]]; then
