This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Is there any way change a Nodes External flag via SDK

Is there any way change a Nodes External flag via SDK?   I am doing this via perl using the JSON/REST calls

This same call works for other properties.

  my $result = $swqldb->update($node_info->{uri}, {External => 'true'});

I keep getting the following error.

   'ERROR' => 'ERROR CODE:[400] [action:swis://ISWEGSFCP16002.solarwinds.local/Orion/Orion.Nodes/NodeID=13216] - {"Message":"Incorrect syntax near the keyword \'External\'.","ExceptionType":"System.Data.SqlClient.SqlException","FullException":"System.Data.SqlClient.SqlException (0x80131904): Incorrect syntax near the keyword \'External\'.\\u000d\\u000a   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)\\u000d\\u000a   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()\\u000d\\u000a   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)\\u000d\\u000a   at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()\\u000d\\u000a   at System.Data.SqlClient.SqlDataReader.get_MetaData()\\u000d\\u000a   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)\\u000d\\u000a   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)\\u000d\\u000a   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)\\u000d\\u000a   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)\\u000d\\u000a   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)\\u000d\\u000a   at System.Data.SqlClient.SqlCommand.ExecuteReader()\\u000d\\u000a   at SolarWinds.Data.Providers.Orion.Plugins.EntityCrudHandler.GetEntityDetails(IDictionary`2[] keyColumns, String entityDetailsSelectQuery)\\u000d\\u000a   at SolarWinds.Data.Providers.Orion.Plugins.EntityCrudHandler.ValidateAndGetEditableColumns(IDictionary`2& columnsToBeUpdated, IDictionary`2[] keyColumns, List`1 nonEditableColumns, String entityDetailsSelectQuery)\\u000d\\u000a   at SolarWinds.Data.Providers.Orion.CrudHandlers.NodeCrudHandler.Update(IEnumerable`1 infos, Action`1 baseCall)\\u000d\\u000a   at SolarWinds.InformationService.Core.CrudProcessor.UpdateInternal(Boolean bulkMode, SwisUriResolver uriResolver, IDictionary`2 propertiesToUpdate, IQueryExecutionContext context)\\u000d\\u000a   at SolarWinds.InformationService.Core.CrudProcessor.Update(IServiceHost serviceHost, SwisUri uri, IDictionary`2 propertiesToUpdate, IQueryExecutionContext context)\\u000d\\u000a   at SolarWinds.InformationService.Core.InformationService.Update(String uri, IDictionary`2 propertiesToUpdate)\\u000d\\u000aClientConnectionId:65150303-5238-4e56-87b3-b5c5922e538b"} []'

  • You have hit a bug. "External" is both a column name in the Nodes table and also a SQL Server keyword, so we have to quote it with [brackets] when referring to that column in queries. It looks like there is code on the Update code path that is not using brackets. I filed this bug internally. I don't see a workaround, so you are effectively blocked from changing this property programmatically.

  • A workaround that I am doing for now is the following.  Note: I had to use the SWQL ExecuteSQL call in order to do this.

           my $result = $swqldb->run_sql("UPDATE NodesData SET [External] = ". $properties->{External} ." WHERE NodeID = ". $node_info->{nodeid});

    my run_sql method does the following:

       my $payload = [$sql];

       my $entityName = "Orion.Reporting";

       my $verbName = "ExecuteSQL";

       my $result = do_eval{ $self->invoke($entityName, $verbName, $payload) };