Argo CD CLI error when installing on Windows 10 via powershell - windows

I'm trying to install ArgoCD CLI on my windows 10 PC by following the command from the website substituting the version but receive the below error. It does not seem to like the + operator? Can anybody assist?
PS C:\Users\dell.docker> $url = "https://github.com/argoproj/argo-cd/releases/download/" + v2.2.3 + "/argocd-windows-amd64.exe"
At line:1 char:66
+ ... = "https://github.com/argoproj/argo-cd/releases/download/" + v2.2.3 ...
+ ~
You must provide a value expression following the '+' operator.
At line:1 char:67
+ ... ps://github.com/argoproj/argo-cd/releases/download/" + v2.2.3 + "/arg ...
+ ~~~~~~
Unexpected token 'v2.2.3' in expression or statement.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : ExpectedValueExpression

You must quote the version number:
$url = "https://github.com/argoproj/argo-cd/releases/download/" + 'v2.2.3' + "/argocd-windows-amd64.exe"
Of course, you can also use only one quoted string to begin with, which - due to use of an expandable (double-quoted) string ("...") - would even work if the version number were provided via a variable:
$version = 'v2.2.3' # Quoting is required here too - '...' is a verbatim string
$url = "https://github.com/argoproj/argo-cd/releases/download/$version/argocd-windows-amd64.exe"
It does not seem to like the + operator
It's not the + operator that's the problem, it's the use of what you intend to be a string literal - v2.2.3 - without quoting.
Operators operate in the context of expressions in PowerShell (expression mode), and in expressions all string literals require quoting.
By contrast, only when you pass arguments to commands (argument mode) may you pass string values (without spaces and other metacharacters) without quoting:
Write-Output v2.2.3 # OK - quoting optional
See the conceptual about_Parsing help topic for more information about these two fundamental parsing modes.

Related

jmeter+influxdb Backend Listener: howto specify password?

I use Jmeter Backend Listener url:
influxdbUrl = http://XX.XXX.XX.XXX:8086/write?db=JMeter&u=jusr&p=C-UBBC-"<
I get an error:
java.lang.IllegalStateException: Failed calling setupTest Caused by: java.net.URISyntaxException: Illegal character in query at index 76: http://XX.XXX.XX.XXX:8086/write?db=JMeter&u=jusr&p=C-UBBC-"<
Problem in special characters in password: C-UBBC-"<
How to fix it?
Not every character is allowed in an URL, you can use alphanumeric and few special ones, in particular ; , / ? : # & = + $ - _ . ! ~ * ' ( ) #. Everything else needs to be percent-encoded
Wrap your password into __urlencode() function and it should resolve your issue.
More information on JMeter Functions concept: Apache JMeter Functions - An Introduction

ML Gradle task.Server.Eval.Task setting variables using xquery

I'm using ml-gradle to run a block of XQuery to update the MarkLogic database. The problem I am running into is I need to wrap all of the code in quotes, but since the code itself has quotes in it I am running into some errors when I try to declare variables i.e. let $config. Does anyone know a way around this? I was thinking I could concatenate all of the code into one big string so it ignores the first and last quotation.
task addCron(type: com.marklogic.gradle.task.ServerEvalTask) {
xquery = "xquery version \"1.0-ml\";\n" +
"import module namespace admin = \"http://marklogic.com/xdmp/admin\" at \"/MarkLogic/admin.xqy\";\n" +
"declare namespace group = \"http://marklogic.com/xdmp/group\";\n" +
" let $config := admin:get-configuration()\n" +
It bombs out when it is trying to declare $config as a variable. With the error:
> Could not get unknown property 'config' for task ':
Here is an example that works
task setSchemasPermissions(type: com.marklogic.gradle.task.ServerEvalTask) {
doFirst {
println "Changing permissions in " + mlAppConfig.schemasDatabaseName + " for:"
}
xquery = "xdmp:invoke('/admin/fix-permissions.xqy', (), map:entry('database', xdmp:database('" + mlAppConfig.schemasDatabaseName + "')))"
}
Here is some documentation for ServerEvalTask: https://github.com/marklogic-community/ml-gradle/wiki/Writing-your-own-task
I suspect you are hitting some string template mechanism in Groovy/Gradle. Try escaping the $ sign as well.
Note that you can use both single and double quotes in XQuery code.
HTH!

How to output objects to various coordinates of a powershell console window at the same time?

I have been using powershell on a win 10 environment for a few months now, so still new to powershell and am trying use the powershell console as a technical point of display, whereby it cycles/loops through various components of data and displays the information at various coordinates of the console window. The problem I have is it can only display the data from any one particular loop at any one time. I suspect a type of multithreading is going to be needed like runspaces or psjobs, but I believe they are both background functions and cant display data in real-time, so not sure if the console even supports this kind of request.
Perhaps there is another way of going about this
I have tried putting all my scripts and get- command under one loop but it doesnt provide the "look" and feel we are trying to achieve. I want to be able to use the entire window as realestate for outputing objects. I have looked at psjobs and runspaces but they seem to work in the background.
So the code presented should output the get-service ojbects and the get-process objects to the coordinates specified at the same time.
function OBJ1{
[console]::setcursorposition(60,120)
Get-Process
]}
function OBJ2{
[console]::setcursorposition(10,70)
Get-Service
]}
Workflow obj3
{
Parallel
{
obj1
obj2
}
}
obj3
Instead the errors I get are:
<!-- language: lang-none -->
Microsoft.PowerShell.Utility\Write-Error : Exception calling "SetCursorPosition" with "2" argument(s): "The handle is invalid.
"
At obj3:20 char:20
+
+ CategoryInfo : NotSpecified: (:) [Write-Error], RemoteException
+ FullyQualifiedErrorId : System.Management.Automation.RemoteException,Microsoft.PowerShell.Commands.WriteErrorCommand
+ PSComputerName : [localhost]
Microsoft.PowerShell.Utility\Write-Error : Exception calling "SetCursorPosition" with "2" argument(s): "The handle is invalid.
"
At obj3:20 char:20
+
+ CategoryInfo : NotSpecified: (:) [Write-Error], RemoteException
+ FullyQualifiedErrorId : System.Management.Automation.RemoteException,Microsoft.PowerShell.Commands.WriteErrorCommand
+ PSComputerName : [localhost]

How write BeanShellPostProcessor script for comparing two values

I want compare two values and pick which one is equal to second variable.
I have written code like below in BeanShellPostProcessor
HitID = vars.get("AddPrpc139");
b=139
if(HitID.equals(b))
{
log.info("......value=");
}else
{
log.info("......value=");
}
But i am getting below error
2018-11-27 14:48:53,504 ERROR o.a.j.u.BeanShellInterpreter: Error invoking bsh method: eval In file: inline evaluation of: `` HitID = vars.get("AddPrpc139"); b=139 if(HitID.equals(b)) { log.info("......val . . . '' Encountered "if" at line 4, column 1.
2018-11-27 14:48:53,504 WARN o.a.j.e.BeanShellPostProcessor: Problem in BeanShell script: org.apache.jorphan.util.JMeterException: Error invoking bsh method: eval In file: inline evaluation of: `` HitID = vars.get("AddPrpc139"); b=139 if(HitID.equals(b)) { log.info("......val . . . '' Encountered "if" at line 4, column 1.
Java/Beanshell expect ; at end of the line. Also b can be inlined
HitID = vars.get("AddPrpc139");
if("139".equals(HitIDb))
{
Also consider moving to JSR223 PostProcessor
You need to follow Java syntax rules, to wit you need to add a semicolon after b=139 line.
You should also surround this 139 with quotation marks otherwise JMeter will be comparing a String with an Integer and you will always get into else branch even if the values will be the same
Amended code:
HitID = vars.get("AddPrpc139");
b = "139";
if (HitID.equals(b)) {
log.info("Values are equal, expected: " + b + ", got: " + HitID);
} else {
log.info("Values are NOT equal, expected: " + b + ", got: " + HitID);
}'
Demo:
Be aware that according to JMeter Best Practices you should be using JSR223 PostProcessor with Groovy language starting from JMeter 3.1. Groovy is more modern language, it is compatible with latest Java features and it has much better performance. Check out Apache Groovy - Why and How You Should Use It article for more details.

how to replace string in SpEL expression?

firstly,thanks for attention
i defined ftp adapter in my spring integration project and used mv command to move files in ftp server,directory structure is:
ftp-root
-----------Directory1\
-----------------in\
---------------------------file.in
-----------------out\
i want to move file file.in in ftp-root\Directory1\in\ directory to move ftp-root\Directory1\out\ with .out.rpt extension ftp-root\Directory1\out\a.out
i used int-ftp:outbound-gateway adapter to run mv command on ftp server,my code is:
<int-ftp:outbound-gateway id="gatewayMv"
session-factory="ftpSessionFactory"
expression="payload.remoteDirectory + '/' + payload.filename"
request-channel="mvChannel"
command="mv"
rename-expression="payload.remoteDirectory + '/' + payload.filename "
reply-channel="aggregateResultsChannel"/>
how to use SpEL expression to replace in with out in rename-expression option?
rename-expression="payload.remoteDirectory + '/' + payload.filename.replaceFirst('in', 'out')"
In most cases SpEL work like the regular Java. Since filename is a String you can apply for it any string operation.
thanks for #Artem Bilan ane #Gary for answer
the other way to working with string
define a bean as bellow :
public class StringUtil {
public String replacement(String value,String var1,String var2) {
return value.replace(var1,var2);
}
}
and in expression option set to:
rename-expression="#stringUtil.replacement(payload.remoteDirectory + '/' + payload.filename,'in','out')"

Resources