Only sync web users if teh sqlite db exists

This commit is contained in:
Jason Ertel
2021-06-01 10:26:33 -04:00
parent c4ae8c3418
commit ed8c85df2b

View File

@@ -185,6 +185,7 @@ function syncElastic() {
syncElasticSystemRole "$authPillarJson" "so_monitor_user" "remote_monitoring_collector" "$rolesFileTmp"
syncElasticSystemRole "$authPillarJson" "so_monitor_user" "remote_monitoring_agent" "$rolesFileTmp"
if [[ -f "$databasePath" ]]; then
# Generate the new users file
echo "select '{\"user\":\"' || ici.identifier || '\", \"data\":' || ic.config || '}'" \
"from identity_credential_identifiers ici, identity_credentials ic " \
@@ -208,6 +209,9 @@ function syncElastic() {
[[ $? != 0 ]] && fail "Unable to read credential IDs from database"
mv -f "$rolesFileTmp" "$elasticRolesFile"
[[ $? != 0 ]] && fail "Unable to create users file: $elasticRolesFile"
else
info "Database file does not exist yet, skipping users export"
fi
}
function syncAll() {