Help with dynamic yaml file #124
Replies: 3 comments 7 replies
-
If you mean that you don't know what dasel -f ~/secret1.yaml -m 'com.amd.platform.servicebroker.elasticsearch.[*].clusterCredentials.username'
elastic If you know what Here's an example bash script that will create the correct selector string based on the cluster name/id and store the results in variables: #!/bin/bash
CLUSTER_ID=$1
FILE="secret1.yaml"
get_cluster_info() {
CLUSTER_ID=$1
PROPERTY=$2
SELECTOR="com.amd.platform.servicebroker.elasticsearch.${CLUSTER_ID}.${PROPERTY}"
COMMAND="dasel -f ${FILE} ${SELECTOR}"
echo $($COMMAND)
}
USERNAME=$(get_cluster_info "${CLUSTER_ID}" "clusterCredentials.username")
PASSWORD=$(get_cluster_info "${CLUSTER_ID}" "clusterCredentials.password")
URLS=$(get_cluster_info "${CLUSTER_ID}" "urls")
echo "Username: ${USERNAME}"
echo "Password: ${PASSWORD}"
echo "Urls: ${URLS}" Usage: $ ./eg.sh clusterid1
Username: elastic
Password: 9RC0Tz2z85n8bMmI2qc944Rq
Urls: es-test-es-http.platform.svc.cluster.local:9200 |
Beta Was this translation helpful? Give feedback.
-
Hi tom, I had tried the command suggested by you, before raising the ticket. Howvever i could see below error: Command: Error:
|
Beta Was this translation helpful? Give feedback.
-
Hi Tom, With respect to the TOML configuration mentioned in the previous comment where I'm looking to replace just the value of the parameters, I tried few things and below is the observation: ORIGINAL FILE: [couchbase]
username = "nfsanitybucket"
network = "auto"
pathToPassword = "secrets/couchbase-password.toml"
bucket = "nfsanitybucket"
collections = []
hostnameVerification = true
metadataBucket = ""
hosts = [ "platform-couchbase-cluster-srv",]
secureConnection = true
metadataCollection = ""
scope = ""
[couchbase.clientCertificate]
path = "path/to/couchbase-client-cert.p12"
use = false
pathToPassword = "secrets/couchbase-client-cert-password.toml"
[couchbase.dcp]
flowControlBuffer = "128mb"
compression = true
persistencePollingInterval = "100ms"
[elasticsearch]
username = "es_clusterid1"
pathToPassword = "secrets/elasticsearch-password.toml"
hosts = [ "elastic-operator-user-es-http.ocp-install1-pgoprtest.svc.cluster.local:9200",]
secureConnection = true
[[elasticsearch.type]]
ignore = true
prefix = "_sync:"
[[elasticsearch.type]]
index = "airlines"
prefix = "airline_"
pipeline = ""
[[elasticsearch.type]]
regex = ".*port_.*"
index = "airports"
[[elasticsearch.type]]
regex = "(?<index>.+?)::.*"
[[elasticsearch.type]]
index = "airlines"
prefix = "route_"
ignoreDeletes = true
routing = "/airlineid"
[[elasticsearch.type]]
matchOnQualifiedKey = true
regex = "(?<index>[^.]+.[^.]+).*"
[[elasticsearch.type]]
matchOnQualifiedKey = true
regex = "[^.]+.(?<index>[^.]+).*"
[[elasticsearch.type]]
index = "etc"
prefix = ""
[elasticsearch.clientCertificate]
path = "path/to/elasticsearch-client-cert.p12"
use = false
pathToPassword = "secrets/elasticsearch-client-cert-password.toml"
[elasticsearch.typeDefaults]
index = ""
pipeline = ""
ignore = false
typeName = "_doc"
ignoreDeletes = false
matchOnQualifiedKey = false
[elasticsearch.docStructure]
documentContentAtTopLevel = false
metadataFieldName = "meta"
wrapCounters = false
[elasticsearch.aws]
region = ""
[elasticsearch.rejectionLog]
index = "cbes-rejects"
typeName = "_doc"
[elasticsearch.bulkRequestLimits]
bytes = "10mb"
timeout = "1m"
actions = 1000
concurrentRequests = 2 For the section Since the Command1 replaces everything under [couchbase], I tried to use the Commnd2 which also adds the original content under Command2: But the output has only the The output is now as below, the other sections of
Thanks |
Beta Was this translation helpful? Give feedback.
-
Hi,
I have file as below:
I'm trying to fetch the value for username, pasword and urls
I can achive using
./dasel -f ~/secret1.yaml com.amdocs.platform.servicebroker.elasticsearch.clusterid.urls'
&
/dasel -f ~/secret1.yaml 'com.amdocs.platform.servicebroker.elasticsearch.clusterid.cluserCredentails.username'
but the value
clusterid1
is dyanmicCan you please help how this can be achieved ?
Also is there a way to store the output in a variable ?
Beta Was this translation helpful? Give feedback.
All reactions