Octopus Deploy JSON Configuration Variable Feature not working - json

I must be missing something simple with this JSON Configuration Variable feature. I have the following JSON:
{
"EventProcessorFactory": "Factory"
"HubConfiguration": [
{
"ArchiveStorageConnectionString": "Connection string"
"ArchiveStorageContainerName": "containerName"
"EventHubGroupName": "ehs-peds-dev"
}
],
"HeartBeatConfiguration": {
"EventHubGroupName": "GroupName",
"EventHubName": "HubName"
"SharedAccessKey": "AccessKey"
"SharedAccessKeyName": "EventPublishers",
"EndPointURL": "URL"
}
}
I want to replace the ArchiveStorageConnectionString (and other properties of HubConfiguration) but I can't figure out what the correct syntax is. HubConfiguration is an array of HubConfigurations (although in this case I only have 1).
I've tried
HubConfiguration:1:ArchiveStorageConnectionString
But that doesn't work. I've also tried
HubConfiguration:0:ArchiveStorageConnectionString
0:HubConfiguration:0:ArchiveStorageConnectionString
1:HubConfiguration:1:ArchiveStorageConnectionString
but none of this seem to work. Any pointers would be greatly appreciated.

The Octopus code that matches and replaces the variables is here:
https://github.com/OctopusDeploy/Calamari/blob/949008eaaafb8865305c7760e8f8448a5eaabb1a/source/Calamari/Integration/JsonVariables/JsonConfigurationVariableReplacer.cs
Some unit tests are here:
https://github.com/OctopusDeploy/Calamari/blob/949008eaaafb8865305c7760e8f8448a5eaabb1a/source/Calamari.Tests/Fixtures/JsonVariables/JsonConfigurationVariableReplacerFixture.cs
I would have expected this to work:
HubConfiguration:0:ArchiveStorageConnectionString
There does seem to be a problem with your JSON - this line should end with a ,:
"EventProcessorFactory": "Factory"
Do you get any output in your deployment when the convention runs?

Related

How to pass a list as an environment variable to an AWS Lambda function from a JSON config file?

I have a JSON file that is going to contain a number of different lists per client that I am deploying for. These lists are going to serve as container overrides for an ECS task that my Lambda function will be invoking. The JSON config file would look something like this:
{
"clientName": {
"environment": [
{
"name": "name1",
"value": "value1"
}
]
}
}
And my serverless.yml would look something like this:
environment:
CONTAINER_ENVIRONMENT: ${file(serverlessConfig.json):${env:CLIENT_NAME}.environment}
Which results in the following error:
Could not resolve "CONTAINER_ENVIRONMENT" environment variable: Unsupported environment variable format:
[
{
"name": "name1",
"value": "value1"
}
]
I've tried using CloudFormation intrinsic functions such as Fn::Join and Fn::ToJsonString. These both threw an error when trying to run locally using sls invoke local (the errors were the same as the above). After some digging it seems that these functions aren't compatible with the serverless environment property.
The only thing that has worked so far is storing the list as a string in a .env file, but that's not really ideal since these configs could take a number of different environment objects.
Is there any way to get this to work with the setup that I have going?

How to get a json value dynamically?

in Jmeter, for the message below i want to get the value of tag CC2650HumidityData (or tag name and tag value) but I don't know the name of tag; it is contained in a variable.
I've used this json path:
$.message.inputData[*].${tagName}
$.message.inputData[*].vars.get("tagName")
but without success.
This is an example of message:
{
"message": {
"inputData": [
{
"CC2650HumidityData": "51",
"dateTime": "2020-12-18T08:35:21.342Z"
},
{
"CC2650BarometricPressureData": "21",
"dateTime": "2020-12-18T08:35:15.136Z"
}
]
}
}
Could you help me?
Your first option, to wit this one: $.message.inputData[*].${tagName} should work just fine
Just make sure that your tagName variable exists and has the anticipated value, it can be done using Debug Sampler and View Results Tree listener combination
Also be aware that you won't be able to use JSONPath Tester mode of the View Results Tree listener for testing JSONPath queries as it doesn't evaluate variables, you will need to run your test to see the variables values (or use this Dummy Sampler like I did)

The name cannot contain any of the following symbols: '[, ], .'.'. for Compose in Azure Logic App

I have below JSON which I need to update inside a logic app
{
"name": "SampleDoc",
"type": "123",
"properties": {
"GP.Test": "M1",
"MG.Test": "C1"
}
}
I have used following setProperty syntax: -
#setProperty(variables('ResponseBody'),'properties', setProperty(variables('ResponseBody')['properties'], 'test','abc'),
setProperty(variables('ResponseBody')['properties'], 'GP.Test','M2'))
My desired JSON output should be
{
"name": "SampleDoc",
"type": "123",
"properties": {
"GP.Test": "M2",
"MG.Test": "C1"
}
}
But when I am running this, I am getting this error: -
InvalidTemplate. Unable to process template language expressions in action 'Compose' inputs at line '1' and column '2617': 'The provided property name 'GP.Test' has these invalid characters '.'. The name cannot contain any of the following symbols: '[, ], .'.'.
Could anyone suggest if we can handle '.' inside compose or any other way for achieving this?
Yes that is correct behavior that is occurring in the logic apps. The reason is that you have used the set property function to set the value of the GP.Test property. When working with the expressions in logic apps, the '.' operator is reserved operator and will be used to access sub properties etc of the expressions, functions etc. Hence you get the error. The solution to this is actually simple, you use the compose action directly without using the set property. Sample screenshot below.
Or if you want complex transformations, then using the liquid transformations through the integration account is the way to go

Custom code completion for class methods?

In MATLAB, it is possible to define code suggestions and completions as explained in the documentation page titled "Customize Code Suggestions and Completions".
The snippets given therein, e.g.
{
"_schemaVersion": "1.0.0",
"anotherFunc":
{
"inputs":
[
{"name":"input1", "kind":"required", "type":["numeric"]},
{"name":"input2", "kind":"required", "type":["numeric"]}
]
}
}
show how we can control the predictions of functions found (presumably) in separate files in the same folder as functionSignatures.json.
Suppose I have a method called myMethod which resides in a class called myClass. Creating a JSON as above with "myMethod" instead of "anotherFunc" didn't seem to have an effect.
My question is - how can we define completions for class methods using this technique?
After some trial and error, it appears that the prediction/completion logic expects to see syntax like:
"myClass.myMethod"
In other words, this should work:
{
"_schemaVersion": "1.0.0",
"myClass.myMethod":
{
"inputs":
[
...
]
}
}

Unable to return right object from Json

I've used json for the below selenium ruby syntax
#driver.find_element(:css, "#poi-tabs *[class='tab ']")
This works as expected
#driver.find_element(:css, JSON.parse(file)['xyz']['elemen'])
But the below FAILS to work, since the value :css taken from .json file is not supporting here
#driver.find_element(JSON.parse(file)['xyz']['selecto'], JSON.parse(file)['xyz']['elemen'])
Note:
When I print "selecto" and "elemen", both brings the exact output but not sure about the format; is there any format to handle it ? or any other workaround
Available or.json
{
"xyz": {
"selecto": ":css",
"elemen": "#poi-tabs *[class='tab ']"
}
}
#driver.find_element(:css, JSON.parse(file)['xyz']['elemen'])
Here :css is a symbol whereas in
#driver.find_element(JSON.parse(file)['xyz']['selecto'], JSON.parse(file)['xyz']['elemen'])
:css is a string. So you are not getting desired result.
Try
#driver.find_element(eval(JSON.parse(file)['xyz']['selecto']), JSON.parse(file)['xyz']['elemen'])