Skip to content

Commit

Permalink
fix: quoting marks missing in partition in database cronjob
Browse files Browse the repository at this point in the history
  • Loading branch information
tschneider-aneo committed Nov 15, 2024
1 parent e62c928 commit 281912c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions armonik/partitions-in-database-cron.tf
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@ resource "kubernetes_cron_job_v1" "partitions_in_database" {
locals {
script_cron = <<EOF
#!/bin/bash
export nbElements=$(mongosh --tlsCAFile $MongoDB__CAFile --tlsAllowInvalidCertificates --tlsAllowInvalidHostnames --tls --username $MongoDB__User --password $MongoDB__Password mongodb://$MongoDB__Host:$MongoDB__Port/database?authSource=$MongoDB__AuthSource&directConnection=true --eval 'db.PartitionData.countDocuments()' --quiet)
export nbElements=$(mongosh --tlsCAFile $MongoDB__CAFile --tlsAllowInvalidCertificates --tlsAllowInvalidHostnames --tls --username $MongoDB__User --password $MongoDB__Password "mongodb://$MongoDB__Host:$MongoDB__Port/database?authSource=$MongoDB__AuthSource&directConnection=true" --eval 'db.PartitionData.countDocuments()' --quiet)
if [[ $nbElements != ${length(local.partition_names)} ]]; then
mongosh --tlsCAFile $MongoDB__CAFile --tlsAllowInvalidCertificates --tlsAllowInvalidHostnames --tls --username $MongoDB__User --password $MongoDB__Password mongodb://$MongoDB__Host:$MongoDB__Port/database?authSource=$MongoDB__AuthSource&directConnection=true --eval 'db.PartitionData.insertMany(${jsonencode(local.partitions_data)})'
mongosh --tlsCAFile $MongoDB__CAFile --tlsAllowInvalidCertificates --tlsAllowInvalidHostnames --tls --username $MongoDB__User --password $MongoDB__Password "mongodb://$MongoDB__Host:$MongoDB__Port/database?authSource=$MongoDB__AuthSource&directConnection=true" --eval 'db.PartitionData.insertMany(${jsonencode(local.partitions_data)})'
fi
EOF
}

0 comments on commit 281912c

Please sign in to comment.