Solved

Parameter "eventsConfigFilePath" defined. Using configuration from file.

  • 20 July 2023
  • 1 reply
  • 12 views

Userlevel 7
Badge +2
  • Community Manager
  • 101 replies

When I caller the script with:

 

powershell tosca_execution_client.ps1 -toscaServerUrl %[DEX_URL] -projectName %[DEX_Project] -events [TestEvents] clientId %[DEX_Client_ID] clientSecret %[DEX_Client_Secret]

 

I get the error message:

 

2023-07-18 13:09:34 +2 [INF] Starting ToscaExecutionClient...

2023-07-18 13:09:34 +2 [INF] Parameter "eventsConfigFilePath" defined. Using configuration from file.

Get-Content : Der Pfad "C:\..." kann nicht gefunden werden, da er nicht vorhanden ist.

In C:\...\tosca_execution_client.ps1:581 Zeichen:22

+     $script:events = Get-Content -Path $eventsConfigFilePath -Raw

+                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : ObjectNotFound: (C:\...:String) [Get-Content], ItemNotFoundException

    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetContentCommand

 

2023-07-18 13:09:34 +2 [INF] ClientId and clientSecret are provided. Authentication will be enabled. Fetch access token with provided credentials...

2023-07-18 13:09:34 +2 [INF] Fetching access token with provided credentials...

2023-07-18 13:09:34 +2 [ERR] ToscaExecutionClient failed to fetch the access token.

2023-07-18 13:09:34 +2 [ERR] {"error":"invalid_client"}

2023-07-18 13:09:34 +2 [INF] Enqueue execution with provided parameters...

2023-07-18 13:09:34 +2 [INF] Fetching access token with provided credentials...

2023-07-18 13:09:34 +2 [ERR] ToscaExecutionClient failed to fetch the access token.

2023-07-18 13:09:34 +2 [ERR] {"error":"invalid_client"}

2023-07-18 13:09:34 +2 [ERR] ToscaExecutionClient failed to enqueue the execution.

2023-07-18 13:09:34 +2 [ERR] Der Remoteserver hat einen Fehler zurückgegeben: (401) Nicht autorisiert.

 

But I have not specified aeventsConfigFilePath. What is going on?

 

[Originally asked and solved on Support Hub]

 

icon

Best answer by Kat 20 July 2023, 16:24

View original

1 reply

Userlevel 7
Badge +2

Answering my own Question:

The -events option doesn't work as documented. At least not in the version I was using. Use -eventsConfigFilePath and a JSON file instead. It's cleaner and scales better anyway.

The correct syntax is using a single dash and space(es) between parameter name and parameter value.

powershell ToscaExecutionClient\tosca_execution_client.ps1	^
-toscaServerUrl %DEX_URL% ^
-projectName %DEX_Project% ^
-eventsConfigFilePath %~dp0\%DEX_Job%.json ^
-clientId %DEX_Client_ID% ^
-clientSecret %DEX_Client_Secret% ^
-creator %USERNAME%:%DEX_Job% ^
-importResults true

Reply