Error in Spinnaker Pipeline Webhook stage - spring-el

My pipeline cannot run manually and source json shows pipeline template as invalid. Also states, #stage function could not be mapped to typedvalue. I have similar pipeline stages created from the copy of failing stage and they work as expected. But the parent one is invalid.
expressionEvaluationSummary" : { "#stage( #root.execution, 'Get SHA')
['context']['webhook']['build'['object']['sha']" : [ { "description" :
"Failed to evaluate [repository_refspec] EL1022E: The function 'stage'
mapped to an object of type 'class
org.springframework.expression.TypedValue' which cannot be invoked",
"exceptionType" :
"org.springframework.expression.spel.SpelEvaluationException

This was missing the pipelineId used in evaluating the expression to resolve to current instance and not of type class

Related

Combining two $exists en MongoDB .find

I would like to find documents that contain some fields, by using $exists. In particular, I am interested in two fields: payload.fields.MDI_CC_DIAG_DTC_LIST and payload.asset.
If I want to find only documents that contain the first one, this is my query:
db.getCollection("dtc").find({"payload.fields.MDI_CC_DIAG_DTC_LIST": {$exists: true}}).count()
It gives me 2265 documents.
When I try to find documents that contain two fields (the ones described above), I use this code:
db.getCollection("dtc").find({"payload.fields.MDI_CC_DIAG_DTC_LIST": {$exists: true}}, {"payload.asset": {$exists: true}}, {multi: true})count()
It throws me an error:
Failed to retrieve documents
[coches.dtc# localhost:27017 [direct]] : An error occurred while retrieving documents!
Stacktrace:
|_/ java.lang.Exception: [coches.dtc# localhost:27017 [direct]] : An error occurred while retrieving documents!
|____/ Illegal argument: Invalid number of arguments to find().
What am I coding wrongly?
Your query has couple of issues, try below one :
db.getCollection("dtc")
.find({
"payload.fields.MDI_CC_DIAG_DTC_LIST": { $exists: true },
"payload.asset": { $exists: true }
})
.count();
Issues :
.find() would take two arguments .find({...},{...}) first one being filter (All filters against collection go here) & second one is projection (Which is used to either exclude or include certain fields from result documents). Here you're passing in 3 args. But in general when it comes to node.js 3rd one could be a callback function but it has nothing to do with actual query being executed on database.
There is no such thing called {multi: true} on .find(). multi will be passed as 3rd option/arg to .update() operations in order to update multiple documents matching filtered criteria.
That's just a typo. Instead of adding another property to your query, you've passed it as a second argument to find.
Try this:
/* ... */ true}}, {"payload.asset" /* ... */
/* ... */ true}, "payload.asset" /* ... */

Adding a field mapping to 'base64Encode' an index field by calling REST endpoint not working: "A resource without a type name was found"

I'm trying to update a search index (using the Update Indexer) by sending a PUT request to https://searchservicename.search.windows.net/indexes/indexName?api-version=2017-11-11 and it's not working.
If I make the exact same request with the list of fields, the request works as expected and I receive a 200. As soon as I try to add fieldMappings as well, I get an error.
My Json I'm adding to the request as "application/json":
{
"name": "indexName",
"fields": [
<List of Valid Fields w/ Valid Types>
],
"fieldMappings": [
{
"sourceFieldName": "fieldName",
"targetFieldName": "fieldName",
"mappingFunction": {
"name": "base64Encode"
}
}
]
}
When calling the API, the error I'm getting is:
{Search request failed: {"error":{"code":"","message":"The request is invalid. Details: index : A resource without a type name was found, but no expected type was specified. To allow entries without type information, the expected type must also be specified when the model is specified.\r\n"}}
I expect the request to return 200 and have the field mapping added.
The error I get seems to be related to the list of fields but as mentioned before, the request works as expected with the same body minus the field mappings.
Let me know if you need any other information from me - Thanks.
Field mappings should be added to an indexer, not an index. Based on your request, you are trying to update an index.

loopbackjs/mongodb returning duplicate key error on bulk upsert operation

I'm trying to upsert multiple documents at once by using a PUT verb to a loopback based Rest API.
The body of the message contains an array of json objects.
[
{"_id" : "1",
"data" : "foo"
},
{"_id" : "2",
"data" : "bar"
}
]
On an empty database this works just fine (create). All documents are created as expected.
But if I run the same call again (update), I receive an error containing an array of similar error messages:
E11000 duplicate key error index: testdatabase.node.$id dup key: { : "1" }
After some further investigation, I found out that if I pass a single object, the upsert works fine.
{"_id" : "1",
"data" : "foo"
}
BUT: if I pas an array with the same single object, the error is back.
[
{"_id" : "1",
"data" : "foo"
}
]
Single upserts are not an option, because I have to update thousands of documents using the Rest Api.
loopback version: 2.22
The upsert function takes a single model as a paramater.
Take a look at the documentation.
In order to update different models as you want, you will have to use the native driver.
EDIT
I dug into loopback source code and found out that the PUT request uses the upsert function of the connector.
Which means that it expects one model and not an array, maybe loopback doesn't enforce it.
You can find the relevant code here.
Anyway, the closest thing to upserting multiple models is the bulk operation of mongodb, but this leads to self implementation.

Best approach for automatically adding child nodes to a ExtJS TreePanel when an update happens matching some criteria?

I am working with a TreePanel/TreeStore in ExtJS 4.1.1, with autoSync enabled and API calls to server endpoints defined via an Ajax proxy.
When a node is created with certain properties set, I have the server automatically add 2 child nodes during the autoSync call to the create API endpoint, and the server response text looks like this:
{
"success" : true,
"errorMsg" : null,
"children" : {
"id" : "toolbox-42",
"parentId" : null,
"itemName" : "My Toolbox",
"nodeType" : "toolbox",
"children" : [{
"id" : "tool-91",
"parentId" : "toolbox-42",
"itemName" : "Default Tool 1",
"nodeType" : "tool",
"leaf" : true,
}, {
"id" : "tool-92",
"parentId" : "toolbox-42",
"itemName" : "Default Tool 2",
"nodeType" : "tool",
"leaf" : true
}
]
}
}
Setting the node's properties via the "children" key at the root level works just fine. The "id" property is set at the inserted node just fine.
My problem is that the child nodes that the server added don't appear in the tree. How do I get these added to the tree view?
Here are some solutions I have considered:
In the server response, make the root level "children" object into an array, and append the new nodes to the end of the array (instead of nesting them under their parent node). The extractData method in Ext.data.reader.Reader (source here) indicates all returned records will be extracted. But, the commitRecords method in Ext.data.Operation (here) only updates the number of clientRecords included in the request, which obviously does not include any new records coming down the pike in the server's response.
After the server's response, manually add the records to the treestore client-side using the "children" node in the server's response. But, there seems to be no easy way to mark these records as "already synced".
Don't add the records on the server at all; instead, manually add them on the client before the sync operation takes place (thus, the sync operation will give the server 3 inserts to do). But, the child nodes in the create request won't have a parentId set, because the server hasn't yet added the parent node and returned the id as a response.
Attach an event handler that will fire once after the server has added the parent node, and then add the child nodes programmatically on the client (which would then be auto-synced to the server). But, this would requires 2 server round trips. Also, the only candidate event I know of is 'write' in Ext.data.TreeStore, and there is no corresponding 'failwrite' event which could be used to remove the listener in case the write operation fails. I could add an abstraction layer to provide that... but I would rather not if Sencha already built a better way.
Any other suggestions? I will accept a suggestion that works or any statement/link describing how Sencha recommends addressing this problem.
Thanks.
UPDATE: My store, proxy, and reader are configured as follows:
var store = Ext.create('Ext.data.TreeStore', {
model : 'App.models.Task',
autoLoad : true,
autoSync : true,
proxy : {
type : 'ajax',
api : {
create : appUrl + 'Data/InsertTreeData',
read : appUrl + 'Data/GetTreeData',
update : appUrl + 'Data/UpdateTreeData',
destroy : appUrl + 'Data/DeleteTreeData'
},
reader : {
type : 'json',
messageProperty : 'errorMsg'
}
}
});
What I do when I add a node to the tree on the server side is grab the parent object id (it could be the root and that is fine) and then run the refreshParent routine that looks like this:
var node = this.store.getNodeById(id);
if (node){
this.store.load({node:node});
}
Context here is the tree panel. This routine reloads specific branch of the tree.

Reference Parent Object in Apex

I have a custom object set up within Salesforce called Solar_Install. I have a S2S connection with another installation of Salesforce. I want to share the custom object with them as well as the parent object (Account), partly because child objects inherit the autoshare property from their parent so I have to.
I have an Apex trigger on the child object (the Solar_Install) which looks like this:
trigger shareWithPartner on Solar_Install__c (after insert) {
PartnerNetworkRecordConnection newConnection =
new PartnerNetworkRecordConnection(
ConnectionId = '12AB3456789CDEF',
LocalRecordId = trigger.new[0].id,
SendClosedTasks = false,
SendOpenTasks = false,
SendEmails = false,
ParentRecordId = ???);
insert newConnection;
}
but I don't know what to put in for the ??? value. I have tried various things:
trigger.new[0].Account_c.AccountId
Error: Compile Error: Invalid foreign key relationship: Solar_Install__c.Account_c at line 10 column 57
Account_c
Error: Compile Error: Variable does not exist: Account_c at line 10 column 42
etc. Does anyone know how I reference the parent (Account) Id from this custom object in order that I can specify it as the ParentRecordId?
Cheers
Did you try traversing the Account relationship with Account_r.Id or Account_c (with two underscores)? These should be the same, but the latter would preferred because it doesn't require a join.

Resources