Can some one help me how to set env when then the value has more than one values
Ex:
{name: Java_opts
value: '-D spring.profiles.active =dev'
name : test
valuev: test}
I want to replace java opts like below without replacing other variables
{
name :Java_opts
Value :'-D spring.profiles.active =dev Djava.ssl.truststore=dev/test
{
I have tries follwing ways
Oc set env dc/service "Java_opts ="-D spring.profiles.active =dev -Djava.ssl.truststore=dev/tesr
It is give an error as we are passing two values for java_opts
Second approch:
I have tried oc patch command
This command is replacing the complete env section
Can somebody help me in this?
Setting an environment variable to multiple values is not possible, however in your case you just want to add multiple arguments, which is of course possible. Also, oc set env allows you to set multiple variables at once.
So to set multiple JAVA_OPTS and also TEST, use the following command:
oc set env dc/my-deploymentconf JAVA_OPTS="-Dspring.profiles.active=dev -Djava.ssl.truststore=dev/test" TEST="abc"
Related
I have set an env variable called BRANCH and in there I have "release/v4.1.2". I'm on ubuntu and I want to update that env variable to just be left with "v4.1.2". I am totally stuck. Nothing I try works.
something like this?
run:|
BRANCH="${BRANCH//[^0-9]/}"
You could use the Bash Shell Parameter Expansion feature, like:
>echo "${BRANCH#"release/"}"
v4.1.2
so you can combine it in your action like:
run:|
release="${BRANCH#"release/"}"
echo "BRANCH=${release}" >> $GITHUB_ENV
By setting an env variable, like described here
I have a Snakemake workflow where one of the top-level config entries is an array of variable size (in this particular example, a sibling may or may not be included in the analysis). Currently I'm using the following config file.
{
"case": "/scratch/standage/12175/BAMs/12175.proband.bam",
"controls": [
"/scratch/standage/12175/BAMs/12175.mother.bam",
"/scratch/standage/12175/BAMs/12175.father.bam"
]
}
I know snakemake allows one to specify config options on the command line with the --config flag. Since the case value is a single string, this is trivial to do on the command line. But what about the controls value(s)? Is it possible to pass an array/list of values as one of the config options on the command line?
Is it possible to pass an array/list of values as one of the config options on the command line
I doubt that is directly possible, but you could pass a quoted string of space (or comma or whatever) separated values that you split to list inside the Snakefile:
snakemake -C controls='control1 control2 ...'
Then inside the Snakefile:
controls= config['controls'].split(' ')
An alternative solution would be to pass variables on the command line like so...
snakemake --config case=proband.bam control1=mother.bam control2=father.bam
...and then to parse the configuration settings dynamically in the Snakefile. For example, any config key matching the regular expression control\d+ corresponds to a control sample.
So it's possible, but a bit of a stretch, and the config file is probably the better/cleaner option.
I'm trying to pass in parameters inline to a ARM template from within PowerShell using the following command:
azure group deployment create -f my_arm_template.json -g myresourcegroup -p '{\"slot\":\"blue\"}' --verbose
and receive the error:
Error converting value "blue" to type 'Microsoft.WindowsAzure.ResourceStack.Frontdoor.Data.Definitions.DeploymentParameterDefinition'. Path 'properties.parameters.slot'
I'm using the example given from this page:
https://azure.microsoft.com/en-us/documentation/articles/resource-group-template-deploy/
I have tried without escaping the quotes just like the example and various other ways but every other attempt breaks when trying to validate my template.
UPDATE 1: I have tried this from CMD in addition to Powershell with the same results.
The problem wasn't the way I was escaping the JSON but it was the value I was giving. Instead of:
{"slot":"blue"}
it should have been:
{"slot":{"value":"blue"}}
So from the docs, I can query my container for its volumes:
docker inspect --format="{{.Volumes}}" container
this returns paths in the format:
map[/container/path/1:/host/path/1 /container/path/2:/host/path/2]
My question is, how do you extract a single path out of this returned data? Say I only wanted the /host/path/2 so i could use it in a script to backup the data in that volume.
The argument to --format is a standard go text/template expression. If you want to get the host path corresponding to a particular container path, you could do this:
$ docker inspect -f '{{index .Volumes "/container/path/1"}}' container
/host/path/1
If you want to produce a list of host:container pairs, you could do this:
$ docker inspect -f '{{range $key, $value := .Volumes}}{{printf "%s:%s\n" $key $value}}{{end}}'
Which would get you:
/container/path/1:/host/path/1
/container/path/2:/host/path/2
In this example, we're taking advantage of this syntax:
A pipeline inside an action may initialize a variable to capture the
result. The initialization has syntax
$variable := pipeline
where $variable is the name of the variable. An action that declares a
variable produces no output.
If a "range" action initializes a variable, the variable is set to the
successive elements of the iteration. Also, a "range" may declare two
variables, separated by a comma:
range $index, $element := pipeline
in which case $index and $element are set to the successive values of
the array/slice index or map key and element, respectively. Note that
if there is only one variable, it is assigned the element; this is
opposite to the convention in Go range clauses.
How to read a shell environment variable in your Tcl script.
So anyone please help me. I am very new in TCL.
Use $::env to access any environment variables e.g. to access the TMP environment variable do this:
set tmpdir $::env(TMP)
More info here http://wiki.tcl.tk/1624
$ export var=42
$ tclsh
% puts $env(var)
42
Environment variables are accessible via the built-in global variable env (fully qualified it is ::env). You use this like any other Tcl array.
If you want to print a list of all environment variables you can use something like this:
proc dump_env_vars {} {
foreach name [array names ::env] {
puts "$name == $::env($name)"
}
}
Of course, to access just a single variable you use it like any other array, for example:
puts "HOME = '$::env(HOME)'"
For more information see the env page on the Tcler's wiki and the env section of the tclvars man page
To read a shell environment variable in Tcl script, try doing something like this:
global env
set olddisplay $env(DISPLAY)
set env(DISPLAY) unix:0
This might be expressed as well in this fashion:
set olddisplay $::env(DISPLAY)
set ::env(DISPLAY) unix:0
and forget about global.
You can check to see if the variable exists by doing something like:
if {[info exists env(VARNAME)]} {
# okay, it's there, use it
set value $env(VARNAME)
} else {
# the environment var isn't set, use a default
set value "the default value"
}
This is source.